[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / tele5.py
bloba455375415347b4de06ef41e96b1d417ef7c5457
1 import functools
3 from .dplay import DiscoveryPlusBaseIE
4 from ..utils import join_nonempty
5 from ..utils.traversal import traverse_obj
8 class Tele5IE(DiscoveryPlusBaseIE):
9 _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?P<parent_slug>[\w-]+)/(?P<slug_a>[\w-]+)(?:/(?P<slug_b>[\w-]+))?'
10 _TESTS = [{
11 # slug_a and slug_b
12 'url': 'https://tele5.de/mediathek/stargate-atlantis/quarantane',
13 'info_dict': {
14 'id': '6852024',
15 'ext': 'mp4',
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': [],
30 }, {
31 # only slug_a
32 'url': 'https://tele5.de/mediathek/inside-out',
33 'info_dict': {
34 'id': '6819502',
35 'ext': 'mp4',
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': [],
46 }, {
47 # playlist
48 'url': 'https://tele5.de/mediathek/schlefaz',
49 'info_dict': {
50 'id': 'mediathek-schlefaz',
52 'playlist_mincount': 3,
55 def _real_extract(self, url):
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='-')
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)
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)
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),