]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/blinkx.py
3 from .common
import InfoExtractor
10 class BlinkxIE(InfoExtractor
):
11 _VALID_URL
= r
'(?:https?://(?:www\.)blinkx\.com/#?ce/|blinkx:)(?P<id>[^?]+)'
15 'url': 'http://www.blinkx.com/ce/Da0Gw3xc5ucpNduzLuDDlv4WC9PuI4fDi1-t6Y3LyfdY2SZS5Urbvn-UPJvrvbo8LTKTc67Wu2rPKSQDJyZeeORCR8bYkhs8lI7eqddznH2ofh5WEEdjYXnoRtj7ByQwt7atMErmXIeYKPsSDuMAAqJDlQZ-3Ff4HJVeH_s3Gh8oQ',
16 'md5': '337cf7a344663ec79bf93a526a2e06c7',
20 'title': 'No Daily Show for John Oliver; HBO Show Renewed - IGN News',
21 'uploader': 'IGN News',
22 'upload_date': '20150217',
23 'timestamp': 1424215740,
24 'description': 'HBO has renewed Last Week Tonight With John Oliver for two more seasons.',
25 'duration': 47.743333,
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
31 display_id
= video_id
[:8]
33 api_url
= ('https://apib4.blinkx.com/api.php?action=play_video&'
34 + 'video=%s' % video_id
)
35 data_json
= self
._download
_webpage
(api_url
, display_id
)
36 data
= json
.loads(data_json
)['api']['results'][0]
40 for m
in data
['media']:
41 if m
['type'] == 'jpg':
45 'height': int(m
['h']),
47 elif m
['type'] == 'original':
48 duration
= float(m
['d'])
49 elif m
['type'] == 'youtube':
51 self
.to_screen('Youtube video detected: %s' % yt_id
)
52 return self
.url_result(yt_id
, 'Youtube', video_id
=yt_id
)
53 elif m
['type'] in ('flv', 'mp4'):
54 vcodec
= remove_start(m
['vcodec'], 'ff')
55 acodec
= remove_start(m
['acodec'], 'ff')
56 vbr
= int_or_none(m
.get('vbr') or m
.get('vbitrate'), 1000)
57 abr
= int_or_none(m
.get('abr') or m
.get('abitrate'), 1000)
58 tbr
= vbr
+ abr
if vbr
and abr
else None
59 format_id
= '%s-%sk-%s' % (vcodec
, tbr
, m
['w'])
61 'format_id': format_id
,
68 'width': int_or_none(m
.get('w')),
69 'height': int_or_none(m
.get('h')),
72 self
._sort
_formats
(formats
)
77 'title': data
['title'],
79 'uploader': data
.get('channel_name'),
80 'timestamp': data
.get('pubdate_epoch'),
81 'description': data
.get('description'),
82 'thumbnails': thumbnails
,