3 from .common
import InfoExtractor
11 class ReutersIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?reuters\.com/.*?\?.*?videoId=(?P<id>[0-9]+)'
15 'url': 'http://www.reuters.com/video/2016/05/20/san-francisco-police-chief-resigns?videoId=368575562',
16 'md5': '8015113643a0b12838f160b0b81cc2ee',
20 'title': 'San Francisco police chief resigns',
24 def _real_extract(self
, url
):
25 video_id
= self
._match
_id
(url
)
26 webpage
= self
._download
_webpage
(
27 'http://www.reuters.com/assets/iframe/yovideo?videoId=%s' % video_id
, video_id
)
28 video_data
= js_to_json(self
._search
_regex
(
29 r
'(?s)Reuters\.yovideo\.drawPlayer\(({.*?})\);',
30 webpage
, 'video data'))
32 def get_json_value(key
, fatal
=False):
33 return self
._search
_regex
(r
'"%s"\s*:\s*"([^"]+)"' % key
, video_data
, key
, fatal
=fatal
)
35 title
= unescapeHTML(get_json_value('title', fatal
=True))
36 mmid
, fid
= re
.search(r
',/(\d+)\?f=(\d+)', get_json_value('flv', fatal
=True)).groups()
38 mas_data
= self
._download
_json
(
39 'http://mas-e.cds1.yospace.com/mas/%s/%s?trans=json' % (mmid
, fid
),
40 video_id
, transform_source
=js_to_json
)
46 method
= f
.get('method')
48 formats
.extend(self
._extract
_m
3u8_formats
(
49 f_url
, video_id
, 'mp4', 'm3u8_native', m3u8_id
='hls', fatal
=False))
51 container
= f
.get('container')
52 ext
= '3gp' if method
== 'mobile' else container
57 'container': container
if method
!= 'mobile' else None,
63 'thumbnail': get_json_value('thumb'),
64 'duration': int_or_none(get_json_value('seconds')),