Compare commits

..

No commits in common. "6a2a913e7e9804b7df2a01bb23ae3ef2527e19da" and "9028171afa14deaa0c75891eeb29d0bb7ea852a2" have entirely different histories.

View File

@ -33,7 +33,7 @@ class AltCensoredIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(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. # Extractor indirection doesn't allow merging info from the original extractor.
# Youtube view count or thumbnail extracted from altcensored can't be merge back # Youtube view count or thumbnail extracted from altcensored can't be merge back
# into underlying archive.org info json # into underlying archive.org info json
@ -41,7 +41,7 @@ class AltCensoredIE(InfoExtractor):
class AltCensoredChannelIE(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 _PAGE_SIZE = 24
_TESTS = [{ _TESTS = [{
'url': 'https://www.altcensored.com/channel/UCFPTO55xxHqFqkzRZHu4kcw', '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', webpage = self._download_webpage(url, channel_id, note='Download channel info',
errnote='Unable to get channel info') errnote='Unable to get channel info')
title = self._html_search_meta('altcen_title', webpage, 'title', fatal=False) title = self._html_search_meta('og:title', webpage)
page_count = int_or_none(self._html_search_regex( page_count = int(self._html_search_regex(r'<a href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count'))
r'<a[^>]+href="/channel/\w+/page/(\d+)">(?:\1)</a>', webpage, 'page count', default='1'))
def page_func(page_num): def page_func(page_num):
page_num += 1
webpage = self._download_webpage( webpage = self._download_webpage(
f'https://altcensored.com/channel/{channel_id}/page/{page_num}', 'https://altcensored.com/channel/%s/page/%d' % (channel_id, page_num + 1),
channel_id, note=f'Downloading page {page_num}') 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) items = re.findall(r'<a[^>]+href="(/watch\?v=[^"]+)', webpage)
return [self.url_result(urljoin('https://www.altcensored.com', path), AltCensoredIE) # deduplicate consecutive items (multiple <a> per video)
for path in orderedSet(items)] items = [self.url_result('https://www.altcensored.com' + key, AltCensoredIE) for key, _group in groupby(items)]
return items
return self.playlist_result( entries = InAdvancePagedList(page_func, page_count, self._PAGE_SIZE)
InAdvancePagedList(page_func, page_count, self._PAGE_SIZE), return self.playlist_result(entries, playlist_id=channel_id, playlist_title=title)
playlist_id=channel_id, playlist_title=title)