aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/options.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/options.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/options.py')
-rw-r--r--yt_dlp/options.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index 123a07bfa..34a2e1103 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -465,19 +465,18 @@ def create_parser():
metavar='COUNT', dest='max_views', default=None, type=int,
help=optparse.SUPPRESS_HELP)
selection.add_option(
- '--match-filter',
- metavar='FILTER', dest='match_filter', default=None,
+ '--match-filters',
+ metavar='FILTER', dest='match_filter', action='append',
help=(
'Generic video filter. Any field (see "OUTPUT TEMPLATE") can be compared with a '
'number or a string using the operators defined in "Filtering formats". '
- 'You can also simply specify a field to match if the field is present '
- 'and "!field" to check if the field is not present. In addition, '
- 'Python style regular expression matching can be done using "~=", '
- 'and multiple filters can be checked with "&". '
- 'Use a "\\" to escape "&" or quotes if needed. Eg: --match-filter '
- '"!is_live & like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
- 'matches only videos that are not live, has a like count more than 100 '
- '(or the like field is not available), and also has a description '
+ 'You can also simply specify a field to match if the field is present, '
+ 'use "!field" to check if the field is not present, and "&" to check multiple conditions. '
+ 'Use a "\\" to escape "&" or quotes if needed. If used multiple times, '
+ 'the filter matches if atleast one of the conditions are met. Eg: --match-filter '
+ '!is_live --match-filter "like_count>?100 & description~=\'(?i)\\bcats \\& dogs\\b\'" '
+ 'matches only videos that are not live OR those that have a like count more than 100 '
+ '(or the like field is not available) and also has a description '
'that contains the phrase "cats & dogs" (ignoring case)'))
selection.add_option(
'--no-match-filter',