]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cliprs.py
4f9320ea57cb542f69b6b0be1965bb004fa35574
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class ClipRsIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?clip\.rs/(?P<id>[^/]+)/\d+'
16 'url': 'http://www.clip.rs/premijera-frajle-predstavljaju-novi-spot-za-pesmu-moli-me-moli/3732',
17 'md5': 'c412d57815ba07b56f9edc7b5d6a14e5',
19 'id': '1488842.1399140381',
21 'title': 'PREMIJERA Frajle predstavljaju novi spot za pesmu Moli me, moli',
22 'description': 'md5:56ce2c3b4ab31c5a2e0b17cb9a453026',
24 'timestamp': 1459850243,
25 'upload_date': '20160405',
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, video_id
)
34 video_id
= self
._search
_regex
(
35 r
'id=(["\'])mvp
:(?P
<id>.+?
)\
1', webpage, 'mvp
id', group='id')
37 response = self._download_json(
38 'http
://qi
.ckm
.onetapi
.pl
/', video_id,
41 'body
[jsonrpc
]': '2.0',
42 'body
[method
]': 'get_asset_detail
',
43 'body
[params
][ID_Publikacji
]': video_id,
44 'body
[params
][Service
]': 'www
.onet
.pl
',
45 'content
-type': 'application
/jsonp
',
46 'x
-onet
-app
': 'player
.front
.onetapi
.pl
',
49 error = response.get('error
')
52 '%s said
: %s' % (self.IE_NAME, error['message
']), expected=True)
54 video = response['result
'].get('0')
57 for _, formats_dict in video['formats
'].items():
58 if not isinstance(formats_dict, dict):
60 for format_id, format_list in formats_dict.items():
61 if not isinstance(format_list, list):
68 'format_id
': format_id,
69 'height
': int_or_none(f.get('vertical_resolution
')),
70 'width
': int_or_none(f.get('horizontal_resolution
')),
71 'abr
': float_or_none(f.get('audio_bitrate
')),
72 'vbr
': float_or_none(f.get('video_bitrate
')),
74 self._sort_formats(formats)
76 meta = video.get('meta
', {})
78 title = self._og_search_title(webpage, default=None) or meta['title
']
79 description = self._og_search_description(webpage, default=None) or meta.get('description
')
80 duration = meta.get('length
') or meta.get('lenght
')
81 timestamp = parse_iso8601(meta.get('addDate
'), ' ')
86 'description
': description,
88 'timestamp
': timestamp,