浏览代码

[instagram] Add support for iframe embeds

Sergey M․ 9 年之前
父节点
当前提交
c23533a100
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      youtube_dl/extractor/instagram.py

+ 6 - 0
youtube_dl/extractor/instagram.py

@@ -45,6 +45,12 @@ class InstagramIE(InfoExtractor):
 
     @staticmethod
     def _extract_embed_url(webpage):
+        mobj = re.search(
+            r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?instagram\.com/p/[^/]+/embed.*?)\1',
+            webpage)
+        if mobj:
+            return mobj.group('url')
+
         blockquote_el = get_element_by_attribute(
             'class', 'instagram-media', webpage)
         if blockquote_el is None: