diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-07-13 20:39:47 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-07-13 20:39:47 +0200 |
commit | 3c4e6d833792c38a28f1dc78ad22fca99edad1fb (patch) | |
tree | 747a01f50cde34d5e3b5c27c92cff33f482f1f55 /youtube_dl | |
parent | 36034aecc287f67a9f93fa00f374f45dcb0e2f77 (diff) |
Improve OpenGraph property matching
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/common.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 05b243871..52ae98be3 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -259,16 +259,16 @@ class InfoExtractor(object): # Helper functions for extracting OpenGraph info @staticmethod - def _og_regex(property): - return r'<meta.+?property=[\'"]og:%s[\'"].+?content=(?:"(.+?)"|\'(.+?)\')' % property + def _og_regex(prop): + return r'<meta.+?property=[\'"]og:%s[\'"].+?content=(?:"(.+?)"|\'(.+?)\')' % re.escape(prop) - def _og_search_property(self, property, html, name=None, **kargs): + def _og_search_property(self, prop, html, name=None, **kargs): if name is None: - name = 'OpenGraph %s' % property - return self._html_search_regex(self._og_regex(property), html, name, flags=re.DOTALL, **kargs) + name = 'OpenGraph %s' % prop + return self._html_search_regex(self._og_regex(prop), html, name, flags=re.DOTALL, **kargs) def _og_search_thumbnail(self, html, **kargs): - return self._og_search_property('image', html, 'thumbnail url', fatal=False, **kargs) + return self._og_search_property('image', html, u'thumbnail url', fatal=False, **kargs) def _og_search_description(self, html, **kargs): return self._og_search_property('description', html, fatal=False, **kargs) |