Browse Source

[instagram] Extract embed videos (#8817)

master
Yen Chi Hsuan 8 years ago
parent
commit
c4096e8aea
1 changed files with 13 additions and 0 deletions
  1. 13
      youtube_dl/extractor/instagram.py

13
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)

Loading…
Cancel
Save