]>
Commit | Line | Data |
---|---|---|
c92e4e62 | 1 | import functools |
d0de6a28 | 2 | |
c92e4e62 | 3 | from .dplay import DiscoveryPlusBaseIE |
4 | from ..utils import join_nonempty | |
5 | from ..utils.traversal import traverse_obj | |
d0de6a28 | 6 | |
c92e4e62 | 7 | |
8 | class Tele5IE(DiscoveryPlusBaseIE): | |
9 | _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?P<parent_slug>[\w-]+)/(?P<slug_a>[\w-]+)(?:/(?P<slug_b>[\w-]+))?' | |
d0de6a28 | 10 | _TESTS = [{ |
c92e4e62 | 11 | # slug_a and slug_b |
12 | 'url': 'https://tele5.de/mediathek/stargate-atlantis/quarantane', | |
d0de6a28 | 13 | 'info_dict': { |
c92e4e62 | 14 | 'id': '6852024', |
d0de6a28 | 15 | 'ext': 'mp4', |
c92e4e62 | 16 | 'title': 'Quarantäne', |
17 | 'description': 'md5:6af0373bd0fcc4f13e5d47701903d675', | |
18 | 'episode': 'Episode 73', | |
19 | 'episode_number': 73, | |
20 | 'season': 'Season 4', | |
21 | 'season_number': 4, | |
22 | 'series': 'Stargate Atlantis', | |
23 | 'upload_date': '20240525', | |
24 | 'timestamp': 1716643200, | |
25 | 'duration': 2503.2, | |
26 | 'thumbnail': 'https://eu1-prod-images.disco-api.com/2024/05/21/c81fcb45-8902-309b-badb-4e6d546b575d.jpeg', | |
27 | 'creators': ['Tele5'], | |
28 | 'tags': [], | |
ae2384ff | 29 | }, |
0b1eaec3 | 30 | }, { |
c92e4e62 | 31 | # only slug_a |
32 | 'url': 'https://tele5.de/mediathek/inside-out', | |
0b1eaec3 | 33 | 'info_dict': { |
c92e4e62 | 34 | 'id': '6819502', |
0b1eaec3 | 35 | 'ext': 'mp4', |
c92e4e62 | 36 | 'title': 'Inside out', |
37 | 'description': 'md5:7e5f32ed0be5ddbd27713a34b9293bfd', | |
38 | 'series': 'Inside out', | |
39 | 'upload_date': '20240523', | |
40 | 'timestamp': 1716494400, | |
41 | 'duration': 5343.4, | |
42 | 'thumbnail': 'https://eu1-prod-images.disco-api.com/2024/05/15/181eba3c-f9f0-3faf-b14d-0097050a3aa4.jpeg', | |
43 | 'creators': ['Tele5'], | |
44 | 'tags': [], | |
0b1eaec3 | 45 | }, |
50e93e03 | 46 | }, { |
c92e4e62 | 47 | # playlist |
48 | 'url': 'https://tele5.de/mediathek/schlefaz', | |
50e93e03 | 49 | 'info_dict': { |
c92e4e62 | 50 | 'id': 'mediathek-schlefaz', |
50e93e03 | 51 | }, |
c92e4e62 | 52 | 'playlist_mincount': 3, |
d0de6a28 JR |
53 | }] |
54 | ||
55 | def _real_extract(self, url): | |
c92e4e62 | 56 | parent_slug, slug_a, slug_b = self._match_valid_url(url).group('parent_slug', 'slug_a', 'slug_b') |
57 | playlist_id = join_nonempty(parent_slug, slug_a, slug_b, delim='-') | |
58 | ||
59 | query = {'environment': 'tele5', 'v': '2'} | |
60 | if not slug_b: | |
61 | endpoint = f'page/{slug_a}' | |
62 | query['parent_slug'] = parent_slug | |
63 | else: | |
64 | endpoint = f'videos/{slug_b}' | |
65 | query['filter[show.slug]'] = slug_a | |
66 | cms_data = self._download_json(f'https://de-api.loma-cms.com/feloma/{endpoint}/', playlist_id, query=query) | |
67 | ||
68 | return self.playlist_result(map( | |
69 | functools.partial(self._get_disco_api_info, url, disco_host='eu1-prod.disco-api.com', realm='dmaxde', country='DE'), | |
70 | traverse_obj(cms_data, ('blocks', ..., 'videoId', {str}))), playlist_id) | |
71 | ||
72 | def _update_disco_api_headers(self, headers, disco_base, display_id, realm): | |
73 | headers.update({ | |
74 | 'x-disco-params': f'realm={realm}', | |
75 | 'x-disco-client': 'Alps:HyogaPlayer:0.0.0', | |
76 | 'Authorization': self._get_auth(disco_base, display_id, realm), | |
77 | }) |