aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2016-01-13 16:24:48 +0800
committerSergey M․ <dstftw@gmail.com>2016-01-16 09:53:12 +0600
commit10d33b347391ed0af453a88d2860a8ad7d8d18c7 (patch)
tree6c423d4095efdf4e996e5083a3c60ddc1001fe93
parentac25992bc74dec638cb33e8da088c325a03036a5 (diff)
[YoutubeDL] Introduce CSS3 like string operators
-rwxr-xr-xyoutube_dl/YoutubeDL.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 0748fbba0..18b1443b8 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -898,6 +898,9 @@ class YoutubeDL(object):
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)