diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-06-23 13:26:49 +0200 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-06-23 13:26:49 +0200 |
commit | 1037d53988387db920748861e6af644547be0f20 (patch) | |
tree | 7c52b2255dc6c1dfb5f4cfeb3de15f73aec4284c /youtube_dl | |
parent | c3ab8f866c37c8773b74fa5d0a57235722fe2c61 (diff) | |
download | youtube-dl-1037d53988387db920748861e6af644547be0f20.zip youtube-dl-1037d53988387db920748861e6af644547be0f20.tar.gz youtube-dl-1037d53988387db920748861e6af644547be0f20.tar.bz2 |
GenericIE: look for Open Graph info
Only if there is a direct link to the file, don't try if it points to a Flash player
Diffstat (limited to 'youtube_dl')
-rwxr-xr-x | youtube_dl/InfoExtractors.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 619ddeb..cd91c13 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -1410,6 +1410,13 @@ class GenericIE(InfoExtractor): # Try to find twitter cards info mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage) if mobj is None: + # We look for Open Graph info: + # We have to match any number spaces between elements, some sites try to align them (eg.: statigr.am) + m_video_type = re.search(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage) + # We only look in og:video if the MIME type is a video, don't try if it's a Flash player: + if m_video_type is not None: + mobj = re.search(r'<meta.*?property="og:video".*?content="(.*?)"', webpage) + if mobj is None: raise ExtractorError(u'Invalid URL: %s' % url) # It's possible that one of the regexes |