diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-03-24 16:29:33 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-03-24 16:29:33 +0800 |
commit | c4096e8aeaa373159e350a3674b0ce18b6c519e2 (patch) | |
tree | 7beeb9173d38cedd92cd4bb106415e5ed6f5110f | |
parent | fc27ea94642a8e2e9b0fcfdcc0c370ec7484c971 (diff) |
[instagram] Extract embed videos (#8817)
-rw-r--r-- | youtube_dl/extractor/instagram.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/youtube_dl/extractor/instagram.py b/youtube_dl/extractor/instagram.py index ed3e07118..e8b27b379 100644 --- a/youtube_dl/extractor/instagram.py +++ b/youtube_dl/extractor/instagram.py @@ -4,6 +4,7 @@ import re from .common import InfoExtractor from ..utils import ( + get_element_by_attribute, int_or_none, limit_length, ) @@ -38,6 +39,18 @@ class InstagramIE(InfoExtractor): 'only_matching': True, }] + @staticmethod + def _extract_embed_url(webpage): + blockquote_el = get_element_by_attribute( + 'class', 'instagram-media', webpage) + if blockquote_el is None: + return + + mobj = re.search( + r'<a[^>]+href=([\'"])(?P<link>[^\'"]+)\1', blockquote_el) + if mobj: + return mobj.group('link') + def _real_extract(self, url): video_id = self._match_id(url) |