From 16bb69dd3ec2b24776bd0394ded25193a3cfbaac Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Wed, 13 Jan 2016 16:24:48 +0800 Subject: [PATCH] [YoutubeDL] Introduce CSS3 like string operators --- youtube_dl/YoutubeDL.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index d50b7cfed..378e33155 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*(?Pext|acodec|vcodec|container|protocol)