Change method to detect end of playlist (fixes issue #113)

pull/8/head
Ricardo Garcia 15 years ago
parent ae3fc475eb
commit ce5cafea40

@ -1496,7 +1496,7 @@ class YoutubePlaylistIE(InfoExtractor):
_VALID_URL = r'(?:http://)?(?:\w+\.)?youtube.com/(?:view_play_list|my_playlists)\?.*?p=([^&]+).*' _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' _TEMPLATE_URL = 'http://www.youtube.com/view_play_list?p=%s&page=%s&gl=US&hl=en'
_VIDEO_INDICATOR = r'/watch\?v=(.+?)&' _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 _youtube_ie = None
def __init__(self, youtube_ie, downloader=None): def __init__(self, youtube_ie, downloader=None):
@ -1542,7 +1542,7 @@ class YoutubePlaylistIE(InfoExtractor):
ids_in_page.append(mobj.group(1)) ids_in_page.append(mobj.group(1))
video_ids.extend(ids_in_page) 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 break
pagenum = pagenum + 1 pagenum = pagenum + 1

Loading…
Cancel
Save