3 from .common import InfoExtractor
5 class InstagramIE(InfoExtractor):
6 _VALID_URL = r'(?:http://)?instagram.com/p/(.*?)/'
8 u'url': u'http://instagram.com/p/aye83DjauH/?foo=bar#abc',
9 u'file': u'aye83DjauH.mp4',
10 u'md5': u'0d2da106a9d2631273e192b372806516',
12 u"uploader_id": u"naomipq",
13 u"title": u"Video by naomipq"
17 def _real_extract(self, url):
18 mobj = re.match(self._VALID_URL, url)
19 video_id = mobj.group(1)
20 webpage = self._download_webpage(url, video_id)
21 html_title = self._html_search_regex(
22 r'<title>(.+?)</title>',
23 webpage, u'title', flags=re.DOTALL)
24 title = re.sub(u'(?: *\(Videos?\))? \u2022 Instagram$', '', html_title).strip()
25 uploader_id = self._html_search_regex(
26 r'<div class="media-user" id="media_user">.*?<h2><a href="[^"]*">([^<]*)</a></h2>',
27 webpage, u'uploader id', fatal=False, flags=re.DOTALL)
32 'url': self._og_search_video_url(webpage),
35 'thumbnail': self._og_search_thumbnail(webpage),
36 'uploader_id' : uploader_id