[YoutubeDL] Introduce CSS3 like string operators
authorYen Chi Hsuan <yan12125@gmail.com>
Wed, 13 Jan 2016 08:24:48 +0000 (16:24 +0800)
committerSergey M․ <dstftw@gmail.com>
Sat, 16 Jan 2016 03:53:12 +0000 (09:53 +0600)
youtube_dl/YoutubeDL.py

index 0748fbba0262cb29b90b73bba749d802f2b3bcc1..18b1443b887ca323e87348636c0febbb878705cc 100755 (executable)
@@ -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)