]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/playwire.py
0bc7431189a0eed819fb85a6fbbdc1558a4b84ed
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class PlaywireIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:config|cdn)\.playwire\.com(?:/v2)?/(?P<publisher_id>\d+)/(?:videos/v2|embed|config)/(?P<id>\d+)'
15 'url': 'http://config.playwire.com/14907/videos/v2/3353705/player.json',
16 'md5': 'e6398701e3595888125729eaa2329ed9',
20 'title': 'S04_RM_UCL_Rus',
21 'thumbnail': 're:^https?://.*\.png$',
26 'url': 'http://config.playwire.com/21772/videos/v2/4840492/zeus.json',
30 'title': 'ITV EL SHOW FULL',
34 'skip_download': True,
37 # Multiple resolutions while bitrates missing
38 'url': 'http://cdn.playwire.com/11625/embed/85228.html',
39 'only_matching': True,
41 'url': 'http://config.playwire.com/12421/videos/v2/3389892/zeus.json',
42 'only_matching': True,
44 'url': 'http://cdn.playwire.com/v2/12342/config/1532636.json',
45 'only_matching': True,
48 def _real_extract(self
, url
):
49 mobj
= re
.match(self
._VALID
_URL
, url
)
50 publisher_id
, video_id
= mobj
.group('publisher_id'), mobj
.group('id')
52 player
= self
._download
_json
(
53 'http://config.playwire.com/%s/videos/v2/%s/zeus.json' % (publisher_id
, video_id
),
56 title
= player
['settings']['title']
57 duration
= float_or_none(player
.get('duration'), 1000)
59 content
= player
['content']
60 thumbnail
= content
.get('poster')
61 src
= content
['media']['f4m']
63 formats
= self
._extract
_f
4m
_formats
(src
, video_id
, m3u8_id
='hls')
64 for a_format
in formats
:
65 if not dict_get(a_format
, ['tbr', 'width', 'height']):
66 a_format
['quality'] = 1 if '-hd.' in a_format
['url'] else 0
67 self
._sort
_formats
(formats
)
72 'thumbnail': thumbnail
,