[youtube:playlistsbase] Restrict playlist regex (Closes #8986)
authorSergey M․ <dstftw@gmail.com>
Sat, 26 Mar 2016 14:42:18 +0000 (20:42 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 26 Mar 2016 14:42:18 +0000 (20:42 +0600)
youtube_dl/extractor/youtube.py

index 8c321f1fc930e0179336171b2f31200f5fcea5aa..28355bf4607b76c9b75da617803ff58d248e4b82 100644 (file)
@@ -234,7 +234,9 @@ class YoutubePlaylistBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor):
 
 class YoutubePlaylistsBaseInfoExtractor(YoutubeEntryListBaseInfoExtractor):
     def _process_page(self, content):
-        for playlist_id in orderedSet(re.findall(r'href="/?playlist\?list=([0-9A-Za-z-_]{10,})"', content)):
+        for playlist_id in orderedSet(re.findall(
+                r'<h3[^>]+class="[^"]*yt-lockup-title[^"]*"[^>]*><a[^>]+href="/?playlist\?list=([0-9A-Za-z-_]{10,})"',
+                content)):
             yield self.url_result(
                 'https://www.youtube.com/playlist?list=%s' % playlist_id, 'YoutubePlaylist')