1 from __future__ import unicode_literals
3 from .canvas import CanvasIE
4 from .common import InfoExtractor
5 from ..compat import compat_urllib_parse_unquote
12 class KetnetIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?ketnet\.be/(?P<id>(?:[^/]+/)*[^/?#&]+)'
15 'url': 'https://www.ketnet.be/kijken/n/nachtwacht/3/nachtwacht-s3a1-de-greystook',
16 'md5': '37b2b7bb9b3dcaa05b67058dc3a714a9',
18 'id': 'pbs-pub-aef8b526-115e-4006-aa24-e59ff6c6ef6f$vid-ddb815bf-c8e7-467b-8879-6bad7a32cebd',
20 'title': 'Nachtwacht - Reeks 3: Aflevering 1',
21 'description': 'De Nachtwacht krijgt te maken met een parasiet',
22 'thumbnail': r're:^https?://.*\.jpg$',
24 'timestamp': 1609225200,
25 'upload_date': '20201229',
26 'series': 'Nachtwacht',
28 'episode': 'De Greystook',
31 'expected_warnings': ['is not a supported codec', 'Unknown MIME type'],
33 'url': 'https://www.ketnet.be/themas/karrewiet/jaaroverzicht-20200/karrewiet-het-jaar-van-black-mamba',
34 'only_matching': True,
37 def _real_extract(self, url):
38 display_id = self._match_id(url)
40 video = self._download_json(
41 'https://senior-bff.ketnet.be/graphql', display_id, query={
43 video(id: "content/ketnet/nl/%s.model.json") {
57 mz_id = compat_urllib_parse_unquote(video['mediaReference'])
60 '_type': 'url_transparent',
62 'title': video['titleVideodetail'],
63 'url': 'https://mediazone.vrt.be/api/v1/ketnet/assets/' + mz_id,
64 'thumbnail': video.get('imageUrl'),
65 'description': video.get('description'),
66 'timestamp': parse_iso8601(video.get('publicationDate')),
67 'series': video.get('programTitle'),
68 'season': video.get('seasonTitle'),
69 'episode': video.get('subtitleVideodetail'),
70 'episode_number': int_or_none(video.get('episodeNr')),
71 'ie_key': CanvasIE.ie_key(),