[utils] Allow empty attribute values in get_element_by_attribute (Closes #9415)
authorSergey M․ <dstftw@gmail.com>
Fri, 6 May 2016 16:07:30 +0000 (22:07 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 6 May 2016 16:07:30 +0000 (22:07 +0600)
youtube_dl/utils.py

index a5922b2b53306bda0cf4afccda7c17eeea85632c..6e45737843fbc2594227ac4699a3fce549b81e32 100644 (file)
@@ -256,9 +256,9 @@ def get_element_by_attribute(attribute, value, html):
 
     m = re.search(r'''(?xs)
         <([a-zA-Z0-9:._-]+)
-         (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|='[^']+'))*?
+         (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]*|="[^"]*"|='[^']*'))*?
          \s+%s=['"]?%s['"]?
-         (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]+|="[^"]+"|='[^']+'))*?
+         (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]*|="[^"]*"|='[^']*'))*?
         \s*>
         (?P<content>.*?)
         </\1>