aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-04-02 17:13:40 +0200
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-10-31 11:26:48 +0100
commitd063db38103c2ac263b98efbc9038656bc3904d8 (patch)
treef0a79fbf6e2d43800cc67f5b14ffc52a1c7e2320
parent61945318317eb2334021231de59afa0f36ddc8f3 (diff)
Try el=detailpage if el=embedded fails for YouTube
-rwxr-xr-xyoutube-dl22
1 files changed, 13 insertions, 9 deletions
diff --git a/youtube-dl b/youtube-dl
index 9c939023e..f6db799ec 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -783,15 +783,19 @@ class YoutubeIE(InfoExtractor):
video_extension = self._video_extensions.get(format_param, 'flv')
# Get video info
- video_info_url = 'http://www.youtube.com/get_video_info?&video_id=%s&el=embedded&ps=default&eurl=&gl=US&hl=en' % video_id
- request = urllib2.Request(video_info_url, None, std_headers)
- try:
- self.report_video_info_webpage_download(video_id)
- video_info_webpage = urllib2.urlopen(request).read()
- video_info = parse_qs(video_info_webpage)
- except (urllib2.URLError, httplib.HTTPException, socket.error), err:
- self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % str(err))
- return
+ self.report_video_info_webpage_download(video_id)
+ for el_type in ['embedded', 'detailpage']:
+ video_info_url = ('http://www.youtube.com/get_video_info?&video_id=%s&el=%s&ps=default&eurl=&gl=US&hl=en'
+ % (video_id, el_type))
+ request = urllib2.Request(video_info_url, None, std_headers)
+ try:
+ video_info_webpage = urllib2.urlopen(request).read()
+ video_info = parse_qs(video_info_webpage)
+ if 'token' in video_info:
+ break
+ except (urllib2.URLError, httplib.HTTPException, socket.error), err:
+ self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % str(err))
+ return
self.report_information_extraction(video_id)
# "t" param