summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <[email protected]>2014-03-14 17:01:47 +0100
committerJaime Marquínez Ferrándiz <[email protected]>2014-03-14 17:01:47 +0100
commitbc6d5978284599fdc9a3ea5cc2c3d30883a8fdc0 (patch)
tree928aef776f1f7b4686b8b201e26fdce3136af8ed /youtube_dl/YoutubeDL.py
parentaba77bbfc275440af00ab4bfe8de2733009f4bd8 (diff)
downloadyoutube-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.py12
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: