1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-29 11:44:33 +01:00

Added code to fetch each individual Youtube playlist's title when getting a list of playlists from a channel.

This commit is contained in:
Joe Bruno 2018-05-02 00:21:49 -04:00
parent 8513963468
commit 61a480be5d

View File

@ -312,10 +312,14 @@ class YoutubePlaylistBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor):
class YoutubePlaylistsBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor): class YoutubePlaylistsBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor):
def _process_page(self, content): def _process_page(self, content):
for playlist_id in orderedSet(re.findall( for playlist_id in orderedSet(re.findall(
r'<h3[^>]+class="[^"]*yt-lockup-title[^"]*"[^>]*><a[^>]+href="/?playlist\?list=([0-9A-Za-z-_]{10,})"', r'<h3[^>]+class="[^"]*yt-lockup-title[^"]*"[^>]*><a[^>]+href="/?playlist\?list=([0-9A-Za-z-_]{10,})"', content)):
content)): playlistURL = 'https://www.youtube.com/playlist?list=%s' % playlist_id
yield self.url_result(
'https://www.youtube.com/playlist?list=%s' % playlist_id, 'YoutubePlaylist') # get the data from that page and grab the title
playlistTitle = self._og_search_title(self._download_webpage(playlistURL, playlist_id))
playlistTitle = playlistTitle[:playlistTitle.find(" -")]
yield self.url_result(playlistURL, 'YoutubePlaylist', video_title=playlistTitle)
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)