[ie/dplay] Fix extractors (#10471)
[yt-dlp3.git] / yt_dlp / extractor / vtm.py
blob41b41ec1712c41ca3b989a047df029d23055f147
1 from .common import InfoExtractor
2 from ..utils import (
3 int_or_none,
4 parse_iso8601,
5 try_get,
9 class VTMIE(InfoExtractor):
10 _WORKING = False
11 _VALID_URL = r'https?://(?:www\.)?vtm\.be/([^/?&#]+)~v(?P<id>[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})'
12 _TEST = {
13 'url': 'https://vtm.be/gast-vernielt-genkse-hotelkamer~ve7534523-279f-4b4d-a5c9-a33ffdbe23e1',
14 'md5': '37dca85fbc3a33f2de28ceb834b071f8',
15 'info_dict': {
16 'id': '192445',
17 'ext': 'mp4',
18 'title': 'Gast vernielt Genkse hotelkamer',
19 'timestamp': 1611060180,
20 'upload_date': '20210119',
21 'duration': 74,
22 # TODO: fix url _type result processing
23 # 'series': 'Op Interventie',
27 def _real_extract(self, url):
28 uuid = self._match_id(url)
29 video = self._download_json(
30 'https://omc4vm23offuhaxx6hekxtzspi.appsync-api.eu-west-1.amazonaws.com/graphql',
31 uuid, query={
32 'query': '''{
33 getComponent(type: Video, uuid: "%s") {
34 ... on Video {
35 description
36 duration
37 myChannelsVideo
38 program {
39 title
41 publishedAt
42 title
45 }''' % uuid, # noqa: UP031
46 }, headers={
47 'x-api-key': 'da2-lz2cab4tfnah3mve6wiye4n77e',
48 })['data']['getComponent']
50 return {
51 '_type': 'url',
52 'id': uuid,
53 'title': video.get('title'),
54 'url': 'http://mychannels.video/embed/%d' % video['myChannelsVideo'],
55 'description': video.get('description'),
56 'timestamp': parse_iso8601(video.get('publishedAt')),
57 'duration': int_or_none(video.get('duration')),
58 'series': try_get(video, lambda x: x['program']['title']),
59 'ie_key': 'Medialaan',