1
1
mirror of https://github.com/ytdl-org/youtube-dl synced 2024-11-27 23:56:51 +01:00

Don't accept '>' inside the content attribute in OpenGraph regexes

This commit is contained in:
Jaime Marquínez Ferrándiz 2013-11-15 12:54:13 +01:00
parent ab2d524780
commit 78fb87b283

View File

@ -316,10 +316,12 @@ class InfoExtractor(object):
# Helper functions for extracting OpenGraph info
@staticmethod
def _og_regexes(prop):
esc_prop = re.escape(prop)
content_re = r'content=(?:"([^>]+?)"|\'(.+?)\')'
property_re = r'property=[\'"]og:%s[\'"]' % re.escape(prop)
template = r'<meta[^>]+?%s[^>]+?%s'
return [
r'<meta[^>]+?property=[\'"]og:%s[\'"][^>]+?content=(?:"(.+?)"|\'(.+?)\')' % esc_prop,
r'<meta[^>]+?content=(?:"(.+?)"|\'(.+?)\')[^>]+?property=[\'"]og:%s[\'"]' % esc_prop,
template % (property_re, content_re),
template % (content_re, property_re),
]
def _og_search_property(self, prop, html, name=None, **kargs):