diff options
author | Jaime Marquínez Ferrándiz <[email protected]> | 2014-03-14 17:01:47 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <[email protected]> | 2014-03-14 17:01:47 +0100 |
commit | bc6d5978284599fdc9a3ea5cc2c3d30883a8fdc0 (patch) | |
tree | 928aef776f1f7b4686b8b201e26fdce3136af8ed /youtube_dl/YoutubeDL.py | |
parent | aba77bbfc275440af00ab4bfe8de2733009f4bd8 (diff) | |
download | youtube-dl-bc6d5978284599fdc9a3ea5cc2c3d30883a8fdc0.tar.gz youtube-dl-bc6d5978284599fdc9a3ea5cc2c3d30883a8fdc0.zip |
Add bestvideo and worstvideo to special format names (#2163)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r-- | youtube_dl/YoutubeDL.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index a4214de78..5095f87d2 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -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: |