[youtube:channel] Fix the extraction of autogenerated channels
The ajax pages are empty, now it looks directly in the channel's /videos pagepull/1776/head
parent
feee2ecfa9
commit
b9643eed7c
|
@ -1594,7 +1594,18 @@ class YoutubeChannelIE(InfoExtractor):
|
|||
# Download channel page
|
||||
channel_id = mobj.group(1)
|
||||
video_ids = []
|
||||
url = 'https://www.youtube.com/channel/%s/videos' % channel_id
|
||||
channel_page = self._download_webpage(url, channel_id)
|
||||
if re.search(r'channel-header-autogenerated-label', channel_page) is not None:
|
||||
autogenerated = True
|
||||
else:
|
||||
autogenerated = False
|
||||
|
||||
if autogenerated:
|
||||
# The videos are contained in a single page
|
||||
# the ajax pages can't be used, they are empty
|
||||
video_ids = self.extract_videos_from_page(channel_page)
|
||||
else:
|
||||
# Download all channel pages using the json-based channel_ajax query
|
||||
for pagenum in itertools.count(1):
|
||||
url = self._MORE_PAGES_URL % (pagenum, channel_id)
|
||||
|
|
Loading…
Reference in New Issue