1
0
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-12-17 15:06:39 +00:00

[youtube:show] Rework in terms of playlists base extractor

This commit is contained in:
Sergey M․ 2015-11-22 04:18:20 +06:00
parent 0c14841585
commit 136dadde95

View File

@ -1863,7 +1863,7 @@ class YoutubeSearchURLIE(InfoExtractor):
} }
class YoutubeShowIE(InfoExtractor): class YoutubeShowIE(YoutubePlaylistsBaseInfoExtractor):
IE_DESC = 'YouTube.com (multi-season) shows' IE_DESC = 'YouTube.com (multi-season) shows'
_VALID_URL = r'https?://www\.youtube\.com/show/(?P<id>[^?#]*)' _VALID_URL = r'https?://www\.youtube\.com/show/(?P<id>[^?#]*)'
IE_NAME = 'youtube:show' IE_NAME = 'youtube:show'
@ -1877,26 +1877,9 @@ class YoutubeShowIE(InfoExtractor):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) playlist_id = self._match_id(url)
playlist_id = mobj.group('id') return super(YoutubeShowIE, self)._real_extract(
webpage = self._download_webpage( 'https://www.youtube.com/show/%s/playlists' % playlist_id)
'https://www.youtube.com/show/%s/playlists' % playlist_id, playlist_id, 'Downloading show webpage')
# There's one playlist for each season of the show
m_seasons = list(re.finditer(r'href="(/playlist\?list=.*?)"', webpage))
self.to_screen('%s: Found %s seasons' % (playlist_id, len(m_seasons)))
entries = [
self.url_result(
'https://www.youtube.com' + season.group(1), 'YoutubePlaylist')
for season in m_seasons
]
title = self._og_search_title(webpage, fatal=False)
return {
'_type': 'playlist',
'id': playlist_id,
'title': title,
'entries': entries,
}
class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor): class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):