[instagram] Add support for iframe embeds
authorSergey M․ <dstftw@gmail.com>
Sat, 16 Apr 2016 16:31:05 +0000 (22:31 +0600)
committerSergey M․ <dstftw@gmail.com>
Sat, 16 Apr 2016 16:31:05 +0000 (22:31 +0600)
youtube_dl/extractor/instagram.py

index 3a5dd14e656eec1276aa145c4826d463953f16ec..3cbe77ad80f2fc9a03c738745524d5dac98c9d37 100644 (file)
@@ -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: