[extractor/common] Require closing quote in _og_regexes (Closes #7174)
authorSergey M․ <dstftw@gmail.com>
Wed, 14 Oct 2015 14:49:39 +0000 (20:49 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 14 Oct 2015 14:49:39 +0000 (20:49 +0600)
E.g. do not match `property='og:video:type'` when `og:video` is requested.

youtube_dl/extractor/common.py

index 0082a4c84606f4f368d6d2075f34a021fb8da72e..a0c4af92f2aa284801fcb59b459285dce6933336 100644 (file)
@@ -646,7 +646,8 @@ class InfoExtractor(object):
     @staticmethod
     def _og_regexes(prop):
         content_re = r'content=(?:"([^>]+?)"|\'([^>]+?)\'|\s*([^\s"\'=<>`]+?))'
-        property_re = r'(?:name|property)=[\'"]?og:%s[\'"]?' % re.escape(prop)
+        property_re = (r'(?:name|property)=(?:\'og:%(prop)s\'|"og:%(prop)s"|\s*og:%(prop)s\b)'
+                       % {'prop': re.escape(prop)})
         template = r'<meta[^>]+?%s[^>]+?%s'
         return [
             template % (property_re, content_re),