aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-06-13 01:32:19 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-06-13 03:45:53 +0530
commit8326b00aabc332cad3edec246fe5353bea069cb0 (patch)
tree286e543dd7b6b447b797ceae8bd8655999f97970 /yt_dlp/YoutubeDL.py
parentb0249bcaf0f2ac1fafecbf5d44f7403c6f0d5850 (diff)
downloadhypervideo-pre-8326b00aabc332cad3edec246fe5353bea069cb0.tar.lz
hypervideo-pre-8326b00aabc332cad3edec246fe5353bea069cb0.tar.xz
hypervideo-pre-8326b00aabc332cad3edec246fe5353bea069cb0.zip
Allow `images` formats
Necessary for #343. * They are identified by `vcodec=acodec='none'` * These formats show as the worst in `-F` * Any postprocessor that expects audio/video will be skipped * `b*` and all related selectors will skip such formats * This commit also does not add any selector for downloading such formats. They have to be explicitly requested by the `format_id`. Implementation of a selector is left for when #389 is resolved
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index b1bc05a80..2d37530bc 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1822,14 +1822,16 @@ class YoutubeDL(object):
format_modified = mobj.group('mod') is not None
format_fallback = not format_type and not format_modified # for b, w
- filter_f = (
+ _filter_f = (
(lambda f: f.get('%scodec' % format_type) != 'none')
if format_type and format_modified # bv*, ba*, wv*, wa*
else (lambda f: f.get('%scodec' % not_format_type) == 'none')
if format_type # bv, ba, wv, wa
else (lambda f: f.get('vcodec') != 'none' and f.get('acodec') != 'none')
if not format_modified # b, w
- else None) # b*, w*
+ else lambda f: True) # b*, w*
+ filter_f = lambda f: _filter_f(f) and (
+ f.get('vcodec') != 'none' or f.get('acodec') != 'none')
else:
filter_f = ((lambda f: f.get('ext') == format_spec)
if format_spec in ['mp4', 'flv', 'webm', '3gp', 'm4a', 'mp3', 'ogg', 'aac', 'wav'] # extension
@@ -2928,6 +2930,8 @@ class YoutubeDL(object):
@staticmethod
def format_resolution(format, default='unknown'):
if format.get('vcodec') == 'none':
+ if format.get('acodec') == 'none':
+ return 'images'
return 'audio only'
if format.get('resolution') is not None:
return format['resolution']