Add bestvideo and worstvideo to special format names (#2163)

This commit is contained in:
Jaime Marquínez Ferrándiz 2014-03-14 17:01:47 +01:00
parent aba77bbfc2
commit bc6d597828
4 changed files with 45 additions and 15 deletions

View file

@ -667,6 +667,18 @@ class YoutubeDL(object):
if f.get('vcodec') == 'none']
if audio_formats:
return audio_formats[0]
elif format_spec == 'bestvideo':
video_formats = [
f for f in available_formats
if f.get('acodec') == 'none']
if video_formats:
return video_formats[-1]
elif format_spec == 'worstvideo':
video_formats = [
f for f in available_formats
if f.get('acodec') == 'none']
if video_formats:
return video_formats[0]
else:
extensions = ['mp4', 'flv', 'webm', '3gp']
if format_spec in extensions: