aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-03-25 13:32:54 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-03-25 13:33:46 +0530
commitb1a7cd056a4613b49f93aa249f6c7ecf5a828185 (patch)
treee40a84824765a8e87bbf94e4a2ee77c36e5121c4 /yt_dlp/utils.py
parent28787f16c6811cc4f2cc067d5739caf257b3ea75 (diff)
downloadhypervideo-pre-b1a7cd056a4613b49f93aa249f6c7ecf5a828185.tar.lz
hypervideo-pre-b1a7cd056a4613b49f93aa249f6c7ecf5a828185.tar.xz
hypervideo-pre-b1a7cd056a4613b49f93aa249f6c7ecf5a828185.zip
Treat multiple `--match-filters` as OR
Closes #3144
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 4961ba14d..4de5f9626 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -3614,16 +3614,18 @@ def match_str(filter_str, dct, incomplete=False):
for filter_part in re.split(r'(?<!\\)&', filter_str))
-def match_filter_func(filter_str):
- if filter_str is None:
+def match_filter_func(filters):
+ if not filters:
return None
+ filters = variadic(filters)
def _match_func(info_dict, *args, **kwargs):
- if match_str(filter_str, info_dict, *args, **kwargs):
+ if any(match_str(f, info_dict, *args, **kwargs) for f in filters):
return None
else:
- video_title = info_dict.get('title', info_dict.get('id', 'video'))
- return '%s does not pass filter %s, skipping ..' % (video_title, filter_str)
+ video_title = info_dict.get('title') or info_dict.get('id') or 'video'
+ filter_str = ') | ('.join(map(str.strip, filters))
+ return f'{video_title} does not pass filter ({filter_str}), skipping ..'
return _match_func