Try el=detailpage if el=embedded fails for YouTube

This commit is contained in:
Ricardo Garcia 2010-04-02 17:13:40 +02:00
parent 6194531831
commit d063db3810

View File

@ -783,15 +783,19 @@ class YoutubeIE(InfoExtractor):
video_extension = self._video_extensions.get(format_param, 'flv') video_extension = self._video_extensions.get(format_param, 'flv')
# Get video info # 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 self.report_video_info_webpage_download(video_id)
request = urllib2.Request(video_info_url, None, std_headers) for el_type in ['embedded', 'detailpage']:
try: video_info_url = ('http://www.youtube.com/get_video_info?&video_id=%s&el=%s&ps=default&eurl=&gl=US&hl=en'
self.report_video_info_webpage_download(video_id) % (video_id, el_type))
video_info_webpage = urllib2.urlopen(request).read() request = urllib2.Request(video_info_url, None, std_headers)
video_info = parse_qs(video_info_webpage) try:
except (urllib2.URLError, httplib.HTTPException, socket.error), err: video_info_webpage = urllib2.urlopen(request).read()
self._downloader.trouble(u'ERROR: unable to download video info webpage: %s' % str(err)) video_info = parse_qs(video_info_webpage)
return 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) self.report_information_extraction(video_id)
# "t" param # "t" param