diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-05 03:01:23 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-05 04:10:26 +0530 |
commit | a047eeb6d2cbbee944e5088f7cba111746f4bb0b (patch) | |
tree | c8237d8866e3474a03ae5e0191fbf4b487f3a1ea /yt_dlp/options.py | |
parent | 77b87f0519719c4264f400f5627da86c12f48bca (diff) | |
download | hypervideo-pre-a047eeb6d2cbbee944e5088f7cba111746f4bb0b.tar.lz hypervideo-pre-a047eeb6d2cbbee944e5088f7cba111746f4bb0b.tar.xz hypervideo-pre-a047eeb6d2cbbee944e5088f7cba111746f4bb0b.zip |
Add regex to `--match-filter`
This does not fully deprecate `--match-title`/`--reject-title`
since `--match-filter` is only checked after the extraction is complete,
while `--match-title` can often be checked from the flat playlist.
Fixes: https://github.com/ytdl-org/youtube-dl/issues/9092, https://github.com/ytdl-org/youtube-dl/issues/23035
Diffstat (limited to 'yt_dlp/options.py')
-rw-r--r-- | yt_dlp/options.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/yt_dlp/options.py b/yt_dlp/options.py index fba231382..b5ddbeaff 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -378,13 +378,14 @@ def parseOpts(overrideArguments=None): '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. ' - 'Multiple filters can be checked using "&". ' - 'For example, to only match videos that are not live, ' - 'has a like count more than 100, a dislike count less than 50 ' - '(or the dislike field is not available), and also has a description ' - 'that contains "python", use --match-filter "!is_live & ' - 'like_count>100 & dislike_count<?50 & description*=\'python\'"')) + '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 ' + r'"!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 ' + 'that contains the phrase "cats & dogs" (ignoring case)')) selection.add_option( '--no-match-filter', metavar='FILTER', dest='match_filter', action='store_const', const=None, |