]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/iconosquare.py
370e86e5ac7ce497c8b3c658805374246fb9690a
[youtubedl] / youtube_dl / extractor / iconosquare.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class IconosquareIE(InfoExtractor):
7 _VALID_URL = r'https?://(www\.)?(?:iconosquare\.com|statigr\.am)/p/(?P<id>[^/]+)'
8 _TEST = {
9 'url': 'http://statigr.am/p/522207370455279102_24101272',
10 'md5': '6eb93b882a3ded7c378ee1d6884b1814',
11 'info_dict': {
12 'id': '522207370455279102_24101272',
13 'ext': 'mp4',
14 'uploader_id': 'aguynamedpatrick',
15 'title': 'Instagram photo by @aguynamedpatrick (Patrick Janelle)',
16 'description': 'md5:644406a9ec27457ed7aa7a9ebcd4ce3d',
17 },
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
23 title = self._html_search_regex(
24 r'<title>(.+?)(?: *\(Videos?\))? \| (?:Iconosquare|Statigram)</title>',
25 webpage, 'title')
26 uploader_id = self._html_search_regex(
27 r'@([^ ]+)', title, 'uploader name', fatal=False)
28
29 return {
30 'id': video_id,
31 'url': self._og_search_video_url(webpage),
32 'title': title,
33 'description': self._og_search_description(webpage),
34 'thumbnail': self._og_search_thumbnail(webpage),
35 'uploader_id': uploader_id
36 }