Add bestvideo and worstvideo to special format names (#2163)
[youtube-dl] / youtube_dl / YoutubeDL.py
index a4214de789459c6088fe128528c2160a169474d4..5095f87d29b36287543a0dac86dcf4a50efb68ab 100644 (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: