]> jfr.im git - yt-dlp.git/commitdiff
Relaxed validation for format filters so that any arbitrary field can be used
authorpukkandan <redacted>
Mon, 26 Oct 2020 15:44:00 +0000 (21:14 +0530)
committerpukkandan <redacted>
Sun, 13 Dec 2020 14:35:03 +0000 (20:05 +0530)
README.md
youtube_dlc/YoutubeDL.py

index d9470eb18d28ee787a5669fe4c7394506ca79614..7fded6a33624d8ab23e34ee24f629c2dd164cc00 100644 (file)
--- a/README.md
+++ b/README.md
@@ -767,7 +767,7 @@ ## Filtering Formats
 
 Any string comparison may be prefixed with negation `!` in order to produce an opposite comparison, e.g. `!*=` (does not contain).
 
-Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the video hoster.
+Note that none of the aforementioned meta fields are guaranteed to be present since this solely depends on the metadata obtained by particular extractor, i.e. the metadata offered by the video hoster. Any other field made available by the extractor can also be used for filtering.
 
 Formats for which the value is not known are excluded unless you put a question mark (`?`) after the operator. You can combine format filters, so `-f "[height <=? 720][tbr>500]"` selects up to 720p videos (or videos where the height is not known) with a bitrate of at least 500 KBit/s.
 
index 41a1ec7243217f2e8b9019232c8d64fbb01575c7..ee6d749107581230019277149d5fe5b7d9e5bee3 100644 (file)
@@ -1142,7 +1142,7 @@ def _build_format_filter(self, filter_spec):
                 '*=': lambda attr, value: value in attr,
             }
             str_operator_rex = re.compile(r'''(?x)
-                \s*(?P<key>ext|acodec|vcodec|container|protocol|format_id)
+                \s*(?P<key>[a-zA-Z0-9._-]+)
                 \s*(?P<negation>!\s*)?(?P<op>%s)(?P<none_inclusive>\s*\?)?
                 \s*(?P<value>[a-zA-Z0-9._-]+)
                 \s*$