mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 07:51:26 +01:00
Compare commits
No commits in common. "6a2a913e7e9804b7df2a01bb23ae3ef2527e19da" and "9028171afa14deaa0c75891eeb29d0bb7ea852a2" have entirely different histories.
6a2a913e7e
...
9028171afa
|
@ -33,7 +33,7 @@ class AltCensoredIE(InfoExtractor):
|
|||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
res = self.url_result(f'https://archive.org/details/youtube-{video_id}', ArchiveOrgIE)
|
||||
res = self.url_result('https://archive.org/details/youtube-%s' % video_id, ArchiveOrgIE)
|
||||
# Extractor indirection doesn't allow merging info from the original extractor.
|
||||
# Youtube view count or thumbnail extracted from altcensored can't be merge back
|
||||
# into underlying archive.org info json
|
||||
|
@ -41,7 +41,7 @@ class AltCensoredIE(InfoExtractor):
|
|||
|
||||
|
||||
class AltCensoredChannelIE(InfoExtractor):
|
||||
_VALID_URL = r'https?://(?:www\.)altcensored\.com/channel/(?!page|table)(?P<id>[^/?#]+)'
|
||||
_VALID_URL = r'https?://(?:www\.)altcensored\.com/channel/(?P<id>[^/?#]+)'
|
||||
_PAGE_SIZE = 24
|
||||
_TESTS = [{
|
||||
'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw',
|
||||
|
@ -57,20 +57,20 @@ class AltCensoredChannelIE(InfoExtractor):
|
|||
|
||||
webpage = self._download_webpage(url, channel_id, note='Download channel info',
|
||||
errnote='Unable to get channel info')
|
||||
title = self._html_search_meta('altcen_title', webpage, 'title', fatal=False)
|
||||
page_count = int_or_none(self._html_search_regex(
|
||||
r'<a[^>]+href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count', default='1'))
|
||||
title = self._html_search_meta('og:title', webpage)
|
||||
page_count = int(self._html_search_regex(r'<a href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count'))
|
||||
|
||||
def page_func(page_num):
|
||||
page_num += 1
|
||||
webpage = self._download_webpage(
|
||||
f'https://altcensored.com/channel/{channel_id}/page/{page_num}',
|
||||
channel_id, note=f'Downloading page {page_num}')
|
||||
'https://altcensored.com/channel/%s/page/%d' % (channel_id, page_num + 1),
|
||||
channel_id, note='Download page #%d' % (page_num + 1),
|
||||
errnote='Unable to get page #%d' % (page_num + 1),
|
||||
)
|
||||
|
||||
items = re.findall(r'<a[^>]+href="(/watch\?v=[^"]+)', webpage)
|
||||
return [self.url_result(urljoin('https://www.altcensored.com', path), AltCensoredIE)
|
||||
for path in orderedSet(items)]
|
||||
# deduplicate consecutive items (multiple <a> per video)
|
||||
items = [self.url_result('https://www.altcensored.com' + key, AltCensoredIE) for key, _group in groupby(items)]
|
||||
return items
|
||||
|
||||
return self.playlist_result(
|
||||
InAdvancePagedList(page_func, page_count, self._PAGE_SIZE),
|
||||
playlist_id=channel_id, playlist_title=title)
|
||||
entries = InAdvancePagedList(page_func, page_count, self._PAGE_SIZE)
|
||||
return self.playlist_result(entries, playlist_id=channel_id, playlist_title=title)
|
||||
|
|
Loading…
Reference in New Issue
Block a user