]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ketnet.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
6 class KetnetIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?ketnet\.be/(?:[^/]+/)*(?P<id>[^/?#&]+)'
9 'url': 'https://www.ketnet.be/kijken/zomerse-filmpjes',
10 'md5': 'd907f7b1814ef0fa285c0475d9994ed7',
12 'id': 'zomerse-filmpjes',
14 'title': 'Gluur mee op de filmset en op Pennenzakkenrock',
15 'description': 'Gluur mee met Ghost Rockers op de filmset',
16 'thumbnail': 're:^https?://.*\.jpg$',
19 'url': 'https://www.ketnet.be/kijken/karrewiet/uitzending-8-september-2016',
20 'only_matching': True,
22 'url': 'https://www.ketnet.be/achter-de-schermen/sien-repeteert-voor-stars-for-life',
23 'only_matching': True,
25 # mzsource, geo restricted to Belgium
26 'url': 'https://www.ketnet.be/kijken/nachtwacht/de-bermadoe',
27 'only_matching': True,
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(url
, video_id
)
35 config
= self
._parse
_json
(
37 r
'(?s)playerConfig\s*=\s*({.+?})\s*;', webpage
,
41 title
= config
['title']
44 for source_key
in ('', 'mz'):
45 source
= config
.get('%ssource' % source_key
)
46 if not isinstance(source
, dict):
48 for format_id
, format_url
in source
.items():
49 if format_id
== 'hls':
50 formats
.extend(self
._extract
_m
3u8_formats
(
51 format_url
, video_id
, 'mp4',
52 entry_protocol
='m3u8_native', m3u8_id
=format_id
,
54 elif format_id
== 'hds':
55 formats
.extend(self
._extract
_f
4m
_formats
(
56 format_url
, video_id
, f4m_id
=format_id
, fatal
=False))
60 'format_id': format_id
,
62 self
._sort
_formats
(formats
)
67 'description': config
.get('description'),
68 'thumbnail': config
.get('image'),
69 'series': config
.get('program'),
70 'episode': config
.get('episode'),