1 from .common
import InfoExtractor
4 get_element_by_attribute
,
12 class NobelPrizeIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?nobelprize\.org/mediaplayer.*?\bid=(?P<id>\d+)'
16 'url': 'http://www.nobelprize.org/mediaplayer/?id=2636',
17 'md5': '04c81e5714bb36cc4e2232fee1d8157f',
21 'title': 'Announcement of the 2016 Nobel Prize in Physics',
22 'description': 'md5:05beba57f4f5a4bbd4cf2ef28fcff739',
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
28 webpage
= self
._download
_webpage
(url
, video_id
)
29 media
= self
._parse
_json
(self
._search
_regex
(
30 r
'(?s)var\s*config\s*=\s*({.+?});', webpage
,
31 'config'), video_id
, js_to_json
)['media']
32 title
= media
['title']
35 for source
in media
.get('source', []):
36 source_src
= source
.get('src')
39 ext
= mimetype2ext(source
.get('type')) or determine_ext(source_src
)
41 formats
.extend(self
._extract
_m
3u8_formats
(
42 source_src
, video_id
, 'mp4', 'm3u8_native',
43 m3u8_id
='hls', fatal
=False))
45 formats
.extend(self
._extract
_f
4m
_formats
(
46 update_url_query(source_src
, {'hdcore': '3.7.0'}),
47 video_id
, f4m_id
='hds', fatal
=False))
56 'description': get_element_by_attribute('itemprop', 'description', webpage
),
57 'duration': int_or_none(media
.get('duration')),