aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-12-09 19:57:39 +0100
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-12-09 19:57:39 +0100
commitf83ae7816b64ff23fbef602d7ade3fd00b57e5aa (patch)
treec30096d8a752a66d1950af5fd8c432557ac7b2b7
parentf148ea4473697a1e6666e789b0bfae8f0b4804e4 (diff)
Fix problem when requesting an existing format explicitly with -f2010.12.09
-rwxr-xr-xyoutube-dl11
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube-dl b/youtube-dl
index e6177e363..a8e3bd36c 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -944,7 +944,7 @@ class YoutubeIE(InfoExtractor):
video_token = urllib.unquote_plus(video_info['token'][0])
# Decide which formats to download
- requested_format = self._downloader.params.get('format', None)
+ req_format = self._downloader.params.get('format', None)
get_video_template = 'http://www.youtube.com/get_video?video_id=%s&t=%s&eurl=&el=&ps=&asv=&fmt=%%s' % (video_id, video_token)
if 'fmt_url_map' in video_info:
@@ -958,12 +958,15 @@ class YoutubeIE(InfoExtractor):
if len(existing_formats) == 0:
self._downloader.trouble(u'ERROR: no known formats available for video')
return
- if requested_format is None:
+ if req_format is None:
video_url_list = [(existing_formats[0], url_map[existing_formats[0]])] # Best quality
- elif requested_format == '-1':
+ elif req_format == '-1':
video_url_list = [(f, url_map[f]) for f in existing_formats] # All formats
else:
- video_url_list = [(requested_format, get_video_template % requested_format)] # Specific format
+ if req_format in url_map:
+ video_url_list = [(req_format, url_map[req_format])] # Specific format
+ else:
+ video_url_list = [(req_format, get_video_template % req_format)] # Specific format
elif 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
self.report_rtmp_download()