- player_url = None
-
- # Get video info
- self.report_video_info_webpage_download(video_id)
- for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
- video_info_url = ('http://www.youtube.com/get_video_info?&video_id=%s%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
- if 'token' not in video_info:
- # Attempt to see if YouTube has issued an error message
- if 'reason' not in video_info:
- self._downloader.trouble(u'ERROR: unable to extract "t" parameter for unknown reason')
- stream = open('reportme-ydl-%s.dat' % time.time(), 'wb')
- stream.write(video_info_webpage)
- stream.close()
- else:
- reason = urllib.unquote_plus(video_info['reason'][0])
- self._downloader.trouble(u'ERROR: YouTube said: %s' % reason.decode('utf-8'))
+ format_list = self._available_formats
+ existing_formats = [x for x in format_list if x in url_map]
+ if len(existing_formats) == 0:
+ self._downloader.trouble(u'ERROR: no known formats available for video')