]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/iconosquare.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
4 from ..utils
import int_or_none
7 class IconosquareIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?(?:iconosquare\.com|statigr\.am)/p/(?P<id>[^/]+)'
10 'url': 'http://statigr.am/p/522207370455279102_24101272',
11 'md5': '6eb93b882a3ded7c378ee1d6884b1814',
13 'id': '522207370455279102_24101272',
15 'title': 'Instagram media by @aguynamedpatrick (Patrick Janelle)',
16 'description': 'md5:644406a9ec27457ed7aa7a9ebcd4ce3d',
17 'timestamp': 1376471991,
18 'upload_date': '20130814',
19 'uploader': 'aguynamedpatrick',
20 'uploader_id': '24101272',
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 media
= self
._parse
_json
(
33 r
'window\.media\s*=\s*({.+?});\n', webpage
, 'media'),
38 'format_id': format_id
,
39 'width': int_or_none(f
.get('width')),
40 'height': int_or_none(f
.get('height'))
41 } for format_id
, f
in media
['videos'].items()]
42 self
._sort
_formats
(formats
)
44 title
= self
._html
_search
_regex
(
45 r
'<title>(.+?)(?: *\(Videos?\))? \| (?:Iconosquare|Statigram)</title>',
48 timestamp
= int_or_none(media
.get('created_time') or media
.get('caption', {}).get('created_time'))
49 description
= media
.get('caption', {}).get('text')
51 uploader
= media
.get('user', {}).get('username')
52 uploader_id
= media
.get('user', {}).get('id')
54 comment_count
= int_or_none(media
.get('comments', {}).get('count'))
55 like_count
= int_or_none(media
.get('likes', {}).get('count'))
60 'width': int_or_none(t
.get('width')),
61 'height': int_or_none(t
.get('height'))
62 } for thumbnail_id
, t
in media
.get('images', {}).items()]
67 'description': description
,
68 'thumbnails': thumbnails
,
69 'timestamp': timestamp
,
71 'uploader_id': uploader_id
,
72 'comment_count': comment_count
,
73 'like_count': like_count
,