浏览代码

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
Jaime Marquínez Ferrándiz 12 年之前
父节点
当前提交
1037d53988
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      youtube_dl/InfoExtractors.py

+ 7 - 0
youtube_dl/InfoExtractors.py

@@ -1409,6 +1409,13 @@ class GenericIE(InfoExtractor):
         if mobj is None:
         if mobj is None:
             # Try to find twitter cards info
             # Try to find twitter cards info
             mobj = re.search(r'<meta (?:property|name)="twitter:player:stream" (?:content|value)="(.+?)"', webpage)
             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:
         if mobj is None:
             raise ExtractorError(u'Invalid URL: %s' % url)
             raise ExtractorError(u'Invalid URL: %s' % url)