From d119b54df6a02d3985284c36586f6ff7e4cac969 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Sat, 12 Feb 2011 20:19:20 +0100 Subject: [PATCH 1/2] Support more common YouTube playlist URLs --- youtube-dl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index dd875a38e..0f9724637 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2096,7 +2096,7 @@ class YahooSearchIE(InfoExtractor): class YoutubePlaylistIE(InfoExtractor): """Information Extractor for YouTube playlists.""" - _VALID_URL = r'(?:http://)?(?:\w+\.)?youtube.com/(?:(?:view_play_list|my_playlists|artist)\?.*?(p|a)=|user/.*?/user/|p/)([^&]+).*' + _VALID_URL = r'(?:http://)?(?:\w+\.)?youtube.com/(?:(?:view_play_list|my_playlists|artist)\?.*?(p|a)=|user/.*?/user/|p/|user/.*?#[pg]/c/)([0-9A-Za-z]+)(?:/.*?/([0-9A-Za-z_-]+))?.*' _TEMPLATE_URL = 'http://www.youtube.com/%s?%s=%s&page=%s&gl=US&hl=en' _VIDEO_INDICATOR = r'/watch\?v=(.+?)&' _MORE_PAGES_INDICATOR = r'(?m)>\s*Next\s*' @@ -2124,6 +2124,11 @@ class YoutubePlaylistIE(InfoExtractor): self._downloader.trouble(u'ERROR: invalid url: %s' % url) return + # Single video case + if mobj.group(3) is not None: + self._youtube_ie.extract(mobj.group(3)) + return + # Download playlist pages # prefix is 'p' as default for playlists but there are other types that need extra care playlist_prefix = mobj.group(1) From 7cc3c6fd62d82bac36c583a8d1dc6c2f6da8c178 Mon Sep 17 00:00:00 2001 From: Gergely Imreh Date: Sun, 13 Feb 2011 19:02:56 +0800 Subject: [PATCH 2/2] Fix possible missing parameter in playlist url extraction The "playlist_prefix" parameter was missing when parsing playlist urls that match the recently added format, e.g.: http://www.youtube.com/user/stanforduniversity#g/c/9D558D49CA734A02 For these URLs (basically, for every playlist type so far, except the artist list) playlist_prefix has to be equal to "p" for correct exctraction. --- youtube-dl | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube-dl b/youtube-dl index 0f9724637..26af2e5bc 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2135,6 +2135,7 @@ class YoutubePlaylistIE(InfoExtractor): if playlist_prefix == 'a': playlist_access = 'artist' else: + playlist_prefix = 'p' playlist_access = 'view_play_list' playlist_id = mobj.group(2) video_ids = []