1 from .common
import InfoExtractor
10 class SportDeutschlandIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://sportdeutschland\.tv/(?P<id>(?:[^/]+/)?[^?#/&]+)'
13 'url': 'https://sportdeutschland.tv/blauweissbuchholztanzsport/buchholzer-formationswochenende-2023-samstag-1-bundesliga-landesliga',
15 'id': '9839a5c7-0dbb-48a8-ab63-3b408adc7b54',
17 'title': 'Buchholzer Formationswochenende 2023 - Samstag - 1. Bundesliga / Landesliga',
18 'display_id': 'blauweissbuchholztanzsport/buchholzer-formationswochenende-2023-samstag-1-bundesliga-landesliga',
19 'description': 'md5:a288c794a5ee69e200d8f12982f81a87',
20 'live_status': 'was_live',
21 'channel': 'Blau-Weiss Buchholz Tanzsport',
22 'channel_url': 'https://sportdeutschland.tv/blauweissbuchholztanzsport',
23 'channel_id': '93ec33c9-48be-43b6-b404-e016b64fdfa3',
25 'upload_date': '20230114',
26 'timestamp': 1673733618,
29 'url': 'https://sportdeutschland.tv/deutscherbadmintonverband/bwf-tour-1-runde-feld-1-yonex-gainward-german-open-2022-0',
31 'id': '95c80c52-6b9a-4ae9-9197-984145adfced',
33 'title': 'BWF Tour: 1. Runde Feld 1 - YONEX GAINWARD German Open 2022',
34 'display_id': 'deutscherbadmintonverband/bwf-tour-1-runde-feld-1-yonex-gainward-german-open-2022-0',
35 'description': 'md5:2afb5996ceb9ac0b2ac81f563d3a883e',
36 'live_status': 'was_live',
37 'channel': 'Deutscher Badminton Verband',
38 'channel_url': 'https://sportdeutschland.tv/deutscherbadmintonverband',
39 'channel_id': '93ca5866-2551-49fc-8424-6db35af58920',
41 'upload_date': '20220309',
42 'timestamp': 1646860727.0,
45 'url': 'https://sportdeutschland.tv/ggcbremen/formationswochenende-latein-2023',
47 'id': '9889785e-55b0-4d97-a72a-ce9a9f157cce',
48 'title': 'Formationswochenende Latein 2023 - Samstag',
49 'display_id': 'ggcbremen/formationswochenende-latein-2023',
50 'description': 'md5:6e4060d40ff6a8f8eeb471b51a8f08b2',
51 'live_status': 'was_live',
52 'channel': 'Grün-Gold-Club Bremen e.V.',
53 'channel_id': '9888f04e-bb46-4c7f-be47-df960a4167bb',
54 'channel_url': 'https://sportdeutschland.tv/ggcbremen',
59 'id': '988e1fea-9d44-4fab-8c72-3085fb667547',
61 'channel_url': 'https://sportdeutschland.tv/ggcbremen',
62 'channel_id': '9888f04e-bb46-4c7f-be47-df960a4167bb',
63 'channel': 'Grün-Gold-Club Bremen e.V.',
65 'title': 'Formationswochenende Latein 2023 - Samstag Part 1',
66 'upload_date': '20230225',
67 'timestamp': 1677349909,
68 'live_status': 'was_live',
72 'url': 'https://sportdeutschland.tv/dtb/gymnastik-international-tag-1',
74 'id': '95d71b8a-370a-4b87-ad16-94680da18528',
76 'title': r
're:Gymnastik International - Tag 1 .+',
77 'display_id': 'dtb/gymnastik-international-tag-1',
78 'channel_id': '936ecef1-2f4a-4e08-be2f-68073cb7ecab',
79 'channel': 'Deutscher Turner-Bund',
80 'channel_url': 'https://sportdeutschland.tv/dtb',
81 'description': 'md5:07a885dde5838a6f0796ee21dc3b0c52',
82 'live_status': 'is_live',
87 def _process_video(self
, asset_id
, video
):
88 is_live
= video
['type'] == 'mux_live'
89 token
= self
._download
_json
(
90 f
'https://api.sportdeutschland.tv/api/frontend/asset-token/{asset_id}',
91 video
['id'], query
={'type': video
['type'], 'playback_id': video
['src']})['token']
92 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(
93 f
'https://stream.mux.com/{video["src"]}.m3u8?token={token}', video
['id'], live
=is_live
)
98 'subtitles': subtitles
,
99 **traverse_obj(video
, {
101 'duration': ('duration', {lambda x
: float(x
) > 0 and float(x
)}),
102 'timestamp': ('created_at', {unified_timestamp}
),
106 def _real_extract(self
, url
):
107 display_id
= self
._match
_id
(url
)
108 meta
= self
._download
_json
(
109 f
'https://api.sportdeutschland.tv/api/stateless/frontend/assets/{display_id}',
110 display_id
, query
={'access_token': 'true'})
113 'display_id': display_id
,
114 **traverse_obj(meta
, {
115 'id': (('id', 'uuid'), ),
116 'title': (('title', 'name'), {strip_or_none}
),
117 'description': 'description',
118 'channel': ('profile', 'name'),
119 'channel_id': ('profile', 'id'),
120 'is_live': 'currently_live',
121 'was_live': 'was_live',
122 'channel_url': ('profile', 'slug', {lambda x
: f
'https://sportdeutschland.tv/{x}'}),
126 parts
= traverse_obj(meta
, (('livestream', ('videos', ...)), ))
128 'title': join_nonempty(info
.get('title'), f
'Part {i}', delim
=' '),
129 **traverse_obj(info
, {'channel': 'channel', 'channel_id': 'channel_id',
130 'channel_url': 'channel_url', 'was_live': 'was_live'}),
131 **self
._process
_video
(info
['id'], video
),
132 } for i
, video
in enumerate(parts
, 1)]
135 '_type': 'multi_video',
138 } if len(entries
) > 1 else {
141 'title': info
.get('title'),