2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
6 compat_urllib_parse_unquote
,
17 class NozIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?noz\.de/video/(?P<id>[0-9]+)/'
20 'url': 'http://www.noz.de/video/25151/32-Deutschland-gewinnt-Badminton-Lnderspiel-in-Melle',
25 'title': '3:2 - Deutschland gewinnt Badminton-Länderspiel in Melle',
26 'description': 'Vor rund 370 Zuschauern gewinnt die deutsche Badminton-Nationalmannschaft am Donnerstag ein EM-Vorbereitungsspiel gegen Frankreich in Melle. Video Moritz Frankenberg.',
27 'thumbnail': r
're:^http://.*\.jpg',
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
34 description
= self
._og
_search
_description
(webpage
)
36 edge_url
= self
._html
_search
_regex
(
37 r
'<script\s+(?:type="text/javascript"\s+)?src="(.*?/videojs_.*?)"',
39 edge_content
= self
._download
_webpage
(edge_url
, 'meta configuration')
41 config_url_encoded
= self
._search
_regex
(
42 r
'so\.addVariable\("config_url","[^,]*,(.*?)"',
43 edge_content
, 'config URL'
45 config_url
= compat_urllib_parse_unquote(config_url_encoded
)
47 doc
= self
._download
_xml
(config_url
, 'video configuration')
48 title
= xpath_text(doc
, './/title')
49 thumbnail
= xpath_text(doc
, './/article/thumbnail/url')
50 duration
= int_or_none(xpath_text(
51 doc
, './/article/movie/file/duration'))
53 for qnode
in doc
.findall(compat_xpath('.//article/movie/file/qualities/qual')):
54 http_url_ele
= find_xpath_attr(
55 qnode
, './html_urls/video_url', 'format', 'video/mp4')
56 http_url
= http_url_ele
.text
if http_url_ele
is not None else None
60 'format_name': xpath_text(qnode
, './name'),
61 'format_id': '%s-%s' % ('http', xpath_text(qnode
, './id')),
62 'height': int_or_none(xpath_text(qnode
, './height')),
63 'width': int_or_none(xpath_text(qnode
, './width')),
64 'tbr': int_or_none(xpath_text(qnode
, './bitrate'), scale
=1000),
67 f4m_url
= xpath_text(qnode
, 'url_hd2')
69 formats
.extend(self
._extract
_f
4m
_formats
(
70 update_url_query(f4m_url
, {'hdcore': '3.4.0'}),
71 video_id
, f4m_id
='hds', fatal
=False))
72 m3u8_url_ele
= find_xpath_attr(
73 qnode
, './html_urls/video_url',
74 'format', 'application/vnd.apple.mpegurl')
75 m3u8_url
= m3u8_url_ele
.text
if m3u8_url_ele
is not None else None
77 formats
.extend(self
._extract
_m
3u8_formats
(
78 m3u8_url
, video_id
, 'mp4', 'm3u8_native',
79 m3u8_id
='hls', fatal
=False))
80 self
._sort
_formats
(formats
)
87 'description': description
,
88 'thumbnail': thumbnail
,