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