]>
Commit | Line | Data |
---|---|---|
29f7c58a | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | from .common import InfoExtractor | |
5 | ||
6 | ||
7 | class CTVIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www\.)?ctv\.ca/(?P<id>(?:show|movie)s/[^/]+/[^/?#&]+)' | |
9 | _TESTS = [{ | |
10 | 'url': 'https://www.ctv.ca/shows/your-morning/wednesday-december-23-2020-s5e88', | |
11 | 'info_dict': { | |
12 | 'id': '2102249', | |
13 | 'ext': 'flv', | |
14 | 'title': 'Wednesday, December 23, 2020', | |
15 | 'thumbnail': r're:^https?://.*\.jpg$', | |
16 | 'description': 'Your Morning delivers original perspectives and unique insights into the headlines of the day.', | |
17 | 'timestamp': 1608732000, | |
18 | 'upload_date': '20201223', | |
19 | 'series': 'Your Morning', | |
20 | 'season': '2020-2021', | |
21 | 'season_number': 5, | |
22 | 'episode_number': 88, | |
23 | 'tags': ['Your Morning'], | |
24 | 'categories': ['Talk Show'], | |
25 | 'duration': 7467.126, | |
26 | }, | |
27 | }, { | |
28 | 'url': 'https://www.ctv.ca/movies/adam-sandlers-eight-crazy-nights/adam-sandlers-eight-crazy-nights', | |
29 | 'only_matching': True, | |
30 | }] | |
31 | ||
32 | def _real_extract(self, url): | |
33 | display_id = self._match_id(url) | |
34 | content = self._download_json( | |
35 | 'https://www.ctv.ca/space-graphql/graphql', display_id, query={ | |
36 | 'query': '''{ | |
37 | resolvedPath(path: "/%s") { | |
38 | lastSegment { | |
39 | content { | |
40 | ... on AxisContent { | |
41 | axisId | |
42 | videoPlayerDestCode | |
43 | } | |
44 | } | |
45 | } | |
46 | } | |
47 | }''' % display_id, | |
48 | })['data']['resolvedPath']['lastSegment']['content'] | |
49 | video_id = content['axisId'] | |
50 | return self.url_result( | |
51 | '9c9media:%s:%s' % (content['videoPlayerDestCode'], video_id), | |
52 | 'NineCNineMedia', video_id) |