]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ketnet.py
1 from __future__
import unicode_literals
3 from .canvas
import CanvasIE
4 from .common
import InfoExtractor
7 class KetnetIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?ketnet\.be/(?:[^/]+/)*(?P<id>[^/?#&]+)'
10 'url': 'https://www.ketnet.be/kijken/zomerse-filmpjes',
11 'md5': '6bdeb65998930251bbd1c510750edba9',
13 'id': 'zomerse-filmpjes',
15 'title': 'Gluur mee op de filmset en op Pennenzakkenrock',
16 'description': 'Gluur mee met Ghost Rockers op de filmset',
17 'thumbnail': r
're:^https?://.*\.jpg$',
20 # mzid in playerConfig instead of sources
21 'url': 'https://www.ketnet.be/kijken/nachtwacht/de-greystook',
22 'md5': '90139b746a0a9bd7bb631283f6e2a64e',
24 'id': 'md-ast-4ac54990-ce66-4d00-a8ca-9eac86f4c475',
25 'display_id': 'md-ast-4ac54990-ce66-4d00-a8ca-9eac86f4c475',
27 'title': 'Nachtwacht: De Greystook',
28 'description': 'md5:1db3f5dc4c7109c821261e7512975be7',
29 'thumbnail': r
're:^https?://.*\.jpg$',
32 'expected_warnings': ['is not a supported codec', 'Unknown MIME type'],
34 'url': 'https://www.ketnet.be/kijken/karrewiet/uitzending-8-september-2016',
35 'only_matching': True,
37 'url': 'https://www.ketnet.be/achter-de-schermen/sien-repeteert-voor-stars-for-life',
38 'only_matching': True,
40 # mzsource, geo restricted to Belgium
41 'url': 'https://www.ketnet.be/kijken/nachtwacht/de-bermadoe',
42 'only_matching': True,
45 def _real_extract(self
, url
):
46 video_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, video_id
)
50 config
= self
._parse
_json
(
52 r
'(?s)playerConfig\s*=\s*({.+?})\s*;', webpage
,
56 mzid
= config
.get('mzid')
58 return self
.url_result(
59 'https://mediazone.vrt.be/api/v1/ketnet/assets/%s' % mzid
,
60 CanvasIE
.ie_key(), video_id
=mzid
)
62 title
= config
['title']
65 for source_key
in ('', 'mz'):
66 source
= config
.get('%ssource' % source_key
)
67 if not isinstance(source
, dict):
69 for format_id
, format_url
in source
.items():
70 if format_id
== 'hls':
71 formats
.extend(self
._extract
_m
3u8_formats
(
72 format_url
, video_id
, 'mp4',
73 entry_protocol
='m3u8_native', m3u8_id
=format_id
,
75 elif format_id
== 'hds':
76 formats
.extend(self
._extract
_f
4m
_formats
(
77 format_url
, video_id
, f4m_id
=format_id
, fatal
=False))
81 'format_id': format_id
,
83 self
._sort
_formats
(formats
)
88 'description': config
.get('description'),
89 'thumbnail': config
.get('image'),
90 'series': config
.get('program'),
91 'episode': config
.get('episode'),