about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjamiejones <github@jamie.bishopston.com>2010-11-16 13:52:23 -0800
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-11-17 20:43:27 +0100
commitb620a5f811d94a0296a9809391e3a121ad8d68e9 (patch)
treeba4893d5094a6b445865c5d91930eba352ca1b5a
parent5e596cac0adcb7e4321f0c9d84e1a813ab26777e (diff)
downloadyoutube-dl-b620a5f811d94a0296a9809391e3a121ad8d68e9.tar.gz
youtube-dl-b620a5f811d94a0296a9809391e3a121ad8d68e9.tar.xz
youtube-dl-b620a5f811d94a0296a9809391e3a121ad8d68e9.zip
Correctly parse the player URL in RTMP downloads (closes #11)
Fixed several problems courtesy of jamiejones:

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.

Finally, add "&amp;has_verified=1" to the fetch of the HMTL page to
allow fetching of age-restricted videos.
-rw-r--r--[-rwxr-xr-x]youtube-dl6
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube-dl b/youtube-dl
index dbb505f19..6a888cc3f 100755..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&amp;has_verified=1' % video_id, None, std_headers)
 		try:
 			video_webpage = urllib2.urlopen(request).read()
 		except (urllib2.URLError, httplib.HTTPException, socket.error), err:
@@ -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