1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-07-20 04:09:35 +02:00

[YoutubeDL] Introduce CSS3 like string operators

This commit is contained in:
Yen Chi Hsuan 2016-01-13 16:24:48 +08:00 committed by Sergey M․
parent ac25992bc7
commit 10d33b3473

View File

@ -898,6 +898,9 @@ def _build_format_filter(self, filter_spec):
STR_OPERATORS = {
'=': operator.eq,
'!=': operator.ne,
'^=': lambda attr, value: attr.startswith(value),
'$=': lambda attr, value: attr.endswith(value),
'*=': lambda attr, value: value in attr,
}
str_operator_rex = re.compile(r'''(?x)
\s*(?P<key>ext|acodec|vcodec|container|protocol)