Change method to detect end of playlist (fixes issue #113)
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>
Fri, 2 Apr 2010 17:51:54 +0000 (19:51 +0200)
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>
Sun, 31 Oct 2010 10:26:52 +0000 (11:26 +0100)
youtube-dl

index 957438b1d33605a1bdcb95746875195449600b86..3735c7eac7798aa2926eecf15d49f0b9f665404b 100755 (executable)
@@ -1496,7 +1496,7 @@ class YoutubePlaylistIE(InfoExtractor):
        _VALID_URL = r'(?:http://)?(?:\w+\.)?youtube.com/(?:view_play_list|my_playlists)\?.*?p=([^&]+).*'
        _TEMPLATE_URL = 'http://www.youtube.com/view_play_list?p=%s&page=%s&gl=US&hl=en'
        _VIDEO_INDICATOR = r'/watch\?v=(.+?)&'
-       _MORE_PAGES_INDICATOR = r'/view_play_list?p=%s&page=%s'
+       _MORE_PAGES_INDICATOR = r'(?m)>\s*Next\s*</a>'
        _youtube_ie = None
 
        def __init__(self, youtube_ie, downloader=None):
@@ -1542,7 +1542,7 @@ class YoutubePlaylistIE(InfoExtractor):
                                        ids_in_page.append(mobj.group(1))
                        video_ids.extend(ids_in_page)
 
-                       if (self._MORE_PAGES_INDICATOR % (playlist_id.upper(), pagenum + 1)) not in page:
+                       if re.search(self._MORE_PAGES_INDICATOR, page) is None:
                                break
                        pagenum = pagenum + 1