From 62ba86e8a1ff4f65f9e4a77e78b49c9f89ce7325 Mon Sep 17 00:00:00 2001 From: jamiejones Date: Tue, 16 Nov 2010 13:52:23 -0800 Subject: [PATCH 1/2] The parsing for the SWF url was wrong (the "//" are now escaped and the initial .*match needs to be 'ungreedy'), so the -W setting to rtmpdump was not set, causing the decryption of the video to be wrong. Also only setting "-q" to rtmpdump if "-q" is sent to youtube-dl Finally, add "&has_verified=1" to the fetch of the HMTL page to allow fetching of age-restricted videos --- youtube-dl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100755 => 100644 youtube-dl diff --git a/youtube-dl b/youtube-dl old mode 100755 new mode 100644 index dbb505f19..5688fd119 --- a/youtube-dl +++ b/youtube-dl @@ -494,7 +494,7 @@ class FileDownloader(object): # Download using rtmpdump. rtmpdump returns exit code 2 when # the connection was interrumpted and resuming appears to be # possible. This is part of rtmpdump's normal usage, AFAIK. - basic_args = ['rtmpdump', '-q'] + [[], ['-W', player_url]][player_url is not None] + ['-r', url, '-o', filename] + basic_args = ['rtmpdump'] + [[], ['-q']][self.params.get('quiet', False)] + [[], ['-W', player_url]][player_url is not None] + ['-r', url, '-o', filename] retval = subprocess.call(basic_args + [[], ['-e', '-k', '1']][self.params.get('continuedl', False)]) while retval == 2 or retval == 1: prevsize = os.path.getsize(filename) @@ -839,9 +839,9 @@ class YoutubeIE(InfoExtractor): return # Attempt to extract SWF player URL - mobj = re.search(r'swfConfig.*"(http://.*?watch.*?-.*?\.swf)"', video_webpage) + mobj = re.search(r'swfConfig.*?"(http:\\/\\/.*?watch.*?-.*?\.swf)"', video_webpage) if mobj is not None: - player_url = mobj.group(1) + player_url = re.sub(r'\\(.)', r'\1', mobj.group(1)) else: player_url = None @@ -1027,7 +1027,7 @@ class MetacafeIE(InfoExtractor): # Check if video comes from YouTube mobj2 = re.match(r'^yt-(.*)$', video_id) if mobj2 is not None: - self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % mobj2.group(1)) + self._youtube_ie.extract('http://www.youtube.com/watch?v=%s&has_verified=1' % mobj2.group(1)) return # At this point we have a new video From fed3254e0c3c627bed28a82f07ca7674af767935 Mon Sep 17 00:00:00 2001 From: jamiejones Date: Tue, 16 Nov 2010 13:55:38 -0800 Subject: [PATCH 2/2] Accidentally added "has_verified" to the wrong line! --- youtube-dl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube-dl b/youtube-dl index 5688fd119..7246b011a 100644 --- a/youtube-dl +++ b/youtube-dl @@ -831,7 +831,7 @@ class YoutubeIE(InfoExtractor): # Get video webpage self.report_video_webpage_download(video_id) - request = urllib2.Request('http://www.youtube.com/watch?v=%s&gl=US&hl=en' % video_id, None, std_headers) + request = urllib2.Request('http://www.youtube.com/watch?v=%s&gl=US&hl=en&has_verified=1' % video_id, None, std_headers) try: video_webpage = urllib2.urlopen(request).read() except (urllib2.URLError, httplib.HTTPException, socket.error), err: @@ -1027,7 +1027,7 @@ class MetacafeIE(InfoExtractor): # Check if video comes from YouTube mobj2 = re.match(r'^yt-(.*)$', video_id) if mobj2 is not None: - self._youtube_ie.extract('http://www.youtube.com/watch?v=%s&has_verified=1' % mobj2.group(1)) + self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % mobj2.group(1)) return # At this point we have a new video