瀏覽代碼

[YoutubeDL] Tweak select_format for video only media

Sergey M․ 10 年之前
父節點
當前提交
df15ef8dab
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      youtube_dl/YoutubeDL.py

+ 3 - 2
youtube_dl/YoutubeDL.py

@@ -924,8 +924,9 @@ class YoutubeDL(object):
                 if f.get('vcodec') != 'none' and f.get('acodec') != 'none']
             if audiovideo_formats:
                 return audiovideo_formats[format_idx]
-            # for audio only urls, select the best/worst audio format
-            elif all(f.get('acodec') != 'none' for f in available_formats):
+            # for audio only (soundcloud) or video only (imgur) urls, select the best/worst audio format
+            elif (all(f.get('acodec') != 'none' for f in available_formats) or
+                  all(f.get('vcodec') != 'none' for f in available_formats)):
                 return available_formats[format_idx]
         elif format_spec == 'bestaudio':
             audio_formats = [