[youtube] Move playlist test to extractor
[youtube-dl] / youtube_dl / extractor / youtube.py
index c77f09aace1b3c46a870121041b966baa930e7bb..10d7baef67f9ab7c832a150ba18a3f79c47c5f4e 100644 (file)
@@ -1020,6 +1020,13 @@ class YoutubePlaylistIE(YoutubeBaseInfoExtractor):
     _MORE_PAGES_INDICATOR = r'data-link-type="next"'
     _VIDEO_RE = r'href="\s*/watch\?v=(?P<id>[0-9A-Za-z_-]{11})&amp;[^"]*?index=(?P<index>\d+)'
     IE_NAME = u'youtube:playlist'
+    _TESTS = [{
+        'url': 'https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re',
+        'info_dict': {
+            'title': 'ytdl test PL',
+        },
+        'playlist_count': 3,
+    }]
 
     def _real_initialize(self):
         self._login()
@@ -1118,6 +1125,7 @@ class YoutubeTopListIE(YoutubePlaylistIE):
     IE_DESC = (u'YouTube.com top lists, "yttoplist:{channel}:{list title}"'
         u' (Example: "yttoplist:music:Top Tracks")')
     _VALID_URL = r'yttoplist:(?P<chann>.*?):(?P<title>.*?)$'
+    _TESTS = []
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
@@ -1397,6 +1405,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
                                           u'%s feed' % self._FEED_NAME,
                                           u'Downloading page %s' % i)
             feed_html = info.get('feed_html') or info.get('content_html')
+            load_more_widget_html = info.get('load_more_widget_html') or feed_html
             m_ids = re.finditer(r'"/watch\?v=(.*?)["&]', feed_html)
             ids = orderedSet(m.group(1) for m in m_ids)
             feed_entries.extend(
@@ -1404,7 +1413,7 @@ class YoutubeFeedsInfoExtractor(YoutubeBaseInfoExtractor):
                 for video_id in ids)
             mobj = re.search(
                 r'data-uix-load-more-href="/?[^"]+paging=(?P<paging>\d+)',
-                feed_html)
+                load_more_widget_html)
             if mobj is None:
                 break
             paging = mobj.group('paging')
@@ -1446,6 +1455,7 @@ class YoutubeSubscriptionsIE(YoutubePlaylistIE):
     IE_NAME = u'youtube:subscriptions'
     IE_DESC = u'YouTube.com subscriptions feed, "ytsubs" keyword (requires authentication)'
     _VALID_URL = r'https?://www\.youtube\.com/feed/subscriptions|:ytsubs(?:criptions)?'
+    _TESTS = []
 
     def _real_extract(self, url):
         title = u'Youtube Subscriptions'