]>
Commit | Line | Data |
---|---|---|
4a733545 | 1 | import re |
67ca1a8e | 2 | from uuid import uuid4 |
4a733545 AS |
3 | |
4 | from .common import InfoExtractor | |
1e4fca9a | 5 | from ..compat import compat_HTTPError, compat_str |
67ca1a8e | 6 | from ..utils import ( |
4a733545 | 7 | ExtractorError, |
67ca1a8e | 8 | int_or_none, |
34921b43 | 9 | join_nonempty, |
67ca1a8e | 10 | try_get, |
3052a30d | 11 | url_or_none, |
4a733545 AS |
12 | urlencode_postdata, |
13 | ) | |
14 | ||
15 | ||
f6d7f7b4 | 16 | class ZattooPlatformBaseIE(InfoExtractor): |
4a733545 AS |
17 | _power_guide_hash = None |
18 | ||
f6d7f7b4 | 19 | def _host_url(self): |
16d896b2 | 20 | return 'https://%s' % (self._API_HOST if hasattr(self, '_API_HOST') else self._HOST) |
f6d7f7b4 | 21 | |
52efa4b3 | 22 | def _real_initialize(self): |
23 | if not self._power_guide_hash: | |
24 | self.raise_login_required('An account is needed to access this media', method='password') | |
67ca1a8e | 25 | |
52efa4b3 | 26 | def _perform_login(self, username, password): |
67ca1a8e S |
27 | try: |
28 | data = self._download_json( | |
f6d7f7b4 | 29 | '%s/zapi/v2/account/login' % self._host_url(), None, 'Logging in', |
67ca1a8e S |
30 | data=urlencode_postdata({ |
31 | 'login': username, | |
32 | 'password': password, | |
33 | 'remember': 'true', | |
34 | }), headers={ | |
f6d7f7b4 | 35 | 'Referer': '%s/login' % self._host_url(), |
67ca1a8e S |
36 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', |
37 | }) | |
38 | except ExtractorError as e: | |
39 | if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400: | |
40 | raise ExtractorError( | |
41 | 'Unable to login: incorrect username and/or password', | |
42 | expected=True) | |
43 | raise | |
44 | ||
45 | self._power_guide_hash = data['session']['power_guide_hash'] | |
46 | ||
52efa4b3 | 47 | def _initialize_pre_login(self): |
9b8b7a7b AS |
48 | session_token = self._download_json( |
49 | f'{self._host_url()}/token.json', None, 'Downloading session token')['session_token'] | |
67ca1a8e S |
50 | |
51 | # Will setup appropriate cookies | |
52 | self._request_webpage( | |
9b8b7a7b | 53 | '%s/zapi/v3/session/hello' % self._host_url(), None, |
67ca1a8e | 54 | 'Opening session', data=urlencode_postdata({ |
67ca1a8e S |
55 | 'uuid': compat_str(uuid4()), |
56 | 'lang': 'en', | |
9b8b7a7b | 57 | 'app_version': '1.8.2', |
67ca1a8e | 58 | 'format': 'json', |
9b8b7a7b | 59 | 'client_app_token': session_token, |
67ca1a8e | 60 | })) |
4a733545 | 61 | |
9b8b7a7b AS |
62 | def _extract_video_id_from_recording(self, recid): |
63 | playlist = self._download_json( | |
64 | f'{self._host_url()}/zapi/v2/playlist', recid, 'Downloading playlist') | |
65 | try: | |
66 | return next( | |
67 | str(item['program_id']) for item in playlist['recordings'] | |
68 | if item.get('program_id') and str(item.get('id')) == recid) | |
69 | except (StopIteration, KeyError): | |
70 | raise ExtractorError('Could not extract video id from recording') | |
71 | ||
4a733545 AS |
72 | def _extract_cid(self, video_id, channel_name): |
73 | channel_groups = self._download_json( | |
f6d7f7b4 | 74 | '%s/zapi/v2/cached/channels/%s' % (self._host_url(), |
4a733545 | 75 | self._power_guide_hash), |
67ca1a8e | 76 | video_id, 'Downloading channel list', |
4a733545 AS |
77 | query={'details': False})['channel_groups'] |
78 | channel_list = [] | |
79 | for chgrp in channel_groups: | |
80 | channel_list.extend(chgrp['channels']) | |
81 | try: | |
82 | return next( | |
83 | chan['cid'] for chan in channel_list | |
67ca1a8e | 84 | if chan.get('cid') and ( |
3089bc74 S |
85 | chan.get('display_alias') == channel_name |
86 | or chan.get('cid') == channel_name)) | |
4a733545 AS |
87 | except StopIteration: |
88 | raise ExtractorError('Could not extract channel id') | |
89 | ||
90 | def _extract_cid_and_video_info(self, video_id): | |
91 | data = self._download_json( | |
21160a17 | 92 | '%s/zapi/v2/cached/program/power_details/%s' % ( |
f6d7f7b4 | 93 | self._host_url(), self._power_guide_hash), |
4a733545 AS |
94 | video_id, |
95 | 'Downloading video information', | |
96 | query={ | |
21160a17 AS |
97 | 'program_ids': video_id, |
98 | 'complete': True, | |
4a733545 AS |
99 | }) |
100 | ||
21160a17 | 101 | p = data['programs'][0] |
67ca1a8e S |
102 | cid = p['cid'] |
103 | ||
4a733545 AS |
104 | info_dict = { |
105 | 'id': video_id, | |
21160a17 AS |
106 | 'title': p.get('t') or p['et'], |
107 | 'description': p.get('d'), | |
108 | 'thumbnail': p.get('i_url'), | |
67ca1a8e | 109 | 'creator': p.get('channel_name'), |
21160a17 AS |
110 | 'episode': p.get('et'), |
111 | 'episode_number': int_or_none(p.get('e_no')), | |
112 | 'season_number': int_or_none(p.get('s_no')), | |
67ca1a8e | 113 | 'release_year': int_or_none(p.get('year')), |
21160a17 AS |
114 | 'categories': try_get(p, lambda x: x['c'], list), |
115 | 'tags': try_get(p, lambda x: x['g'], list) | |
4a733545 | 116 | } |
67ca1a8e | 117 | |
4a733545 AS |
118 | return cid, info_dict |
119 | ||
9b8b7a7b AS |
120 | def _extract_ondemand_info(self, ondemand_id): |
121 | """ | |
122 | @returns (ondemand_token, ondemand_type, info_dict) | |
123 | """ | |
124 | data = self._download_json( | |
125 | '%s/zapi/vod/movies/%s' % (self._host_url(), ondemand_id), | |
126 | ondemand_id, 'Downloading ondemand information') | |
127 | info_dict = { | |
128 | 'id': ondemand_id, | |
129 | 'title': data.get('title'), | |
130 | 'description': data.get('description'), | |
131 | 'duration': int_or_none(data.get('duration')), | |
132 | 'release_year': int_or_none(data.get('year')), | |
133 | 'episode_number': int_or_none(data.get('episode_number')), | |
134 | 'season_number': int_or_none(data.get('season_number')), | |
135 | 'categories': try_get(data, lambda x: x['categories'], list), | |
136 | } | |
137 | return data['terms_catalog'][0]['terms'][0]['token'], data['type'], info_dict | |
138 | ||
139 | def _extract_formats(self, cid, video_id, record_id=None, ondemand_id=None, ondemand_termtoken=None, ondemand_type=None, is_live=False): | |
67ca1a8e | 140 | postdata_common = { |
4a733545 AS |
141 | 'https_watch_urls': True, |
142 | } | |
4a733545 AS |
143 | |
144 | if is_live: | |
67ca1a8e | 145 | postdata_common.update({'timeshift': 10800}) |
f6d7f7b4 | 146 | url = '%s/zapi/watch/live/%s' % (self._host_url(), cid) |
67ca1a8e | 147 | elif record_id: |
f6d7f7b4 | 148 | url = '%s/zapi/watch/recording/%s' % (self._host_url(), record_id) |
9b8b7a7b AS |
149 | elif ondemand_id: |
150 | postdata_common.update({ | |
151 | 'teasable_id': ondemand_id, | |
152 | 'term_token': ondemand_termtoken, | |
153 | 'teasable_type': ondemand_type | |
154 | }) | |
155 | url = '%s/zapi/watch/vod/video' % self._host_url() | |
67ca1a8e | 156 | else: |
9b8b7a7b | 157 | url = '%s/zapi/v3/watch/replay/%s/%s' % (self._host_url(), cid, video_id) |
4a733545 | 158 | formats = [] |
9b8b7a7b AS |
159 | subtitles = {} |
160 | for stream_type in ('dash', 'hls7'): | |
67ca1a8e S |
161 | postdata = postdata_common.copy() |
162 | postdata['stream_type'] = stream_type | |
163 | ||
164 | data = self._download_json( | |
165 | url, video_id, 'Downloading %s formats' % stream_type.upper(), | |
166 | data=urlencode_postdata(postdata), fatal=False) | |
167 | if not data: | |
168 | continue | |
169 | ||
170 | watch_urls = try_get( | |
171 | data, lambda x: x['stream']['watch_urls'], list) | |
172 | if not watch_urls: | |
173 | continue | |
174 | ||
175 | for watch in watch_urls: | |
176 | if not isinstance(watch, dict): | |
177 | continue | |
3052a30d S |
178 | watch_url = url_or_none(watch.get('url')) |
179 | if not watch_url: | |
67ca1a8e | 180 | continue |
67ca1a8e | 181 | audio_channel = watch.get('audio_channel') |
67ca1a8e | 182 | preference = 1 if audio_channel == 'A' else None |
34921b43 | 183 | format_id = join_nonempty(stream_type, watch.get('maxrate'), audio_channel) |
9b8b7a7b AS |
184 | if stream_type.startswith('dash'): |
185 | this_formats, subs = self._extract_mpd_formats_and_subtitles( | |
67ca1a8e | 186 | watch_url, video_id, mpd_id=format_id, fatal=False) |
9b8b7a7b AS |
187 | self._merge_subtitles(subs, target=subtitles) |
188 | elif stream_type.startswith('hls'): | |
189 | this_formats, subs = self._extract_m3u8_formats_and_subtitles( | |
67ca1a8e S |
190 | watch_url, video_id, 'mp4', |
191 | entry_protocol='m3u8_native', m3u8_id=format_id, | |
192 | fatal=False) | |
9b8b7a7b | 193 | self._merge_subtitles(subs, target=subtitles) |
67ca1a8e S |
194 | elif stream_type == 'hds': |
195 | this_formats = self._extract_f4m_formats( | |
196 | watch_url, video_id, f4m_id=format_id, fatal=False) | |
197 | elif stream_type == 'smooth_playready': | |
198 | this_formats = self._extract_ism_formats( | |
199 | watch_url, video_id, ism_id=format_id, fatal=False) | |
200 | else: | |
201 | assert False | |
202 | for this_format in this_formats: | |
f983b875 | 203 | this_format['quality'] = preference |
67ca1a8e | 204 | formats.extend(this_formats) |
4a733545 | 205 | self._sort_formats(formats) |
9b8b7a7b | 206 | return formats, subtitles |
4a733545 | 207 | |
9b8b7a7b AS |
208 | def _extract_video(self, video_id, record_id=None): |
209 | cid, info_dict = self._extract_cid_and_video_info(video_id) | |
210 | info_dict['formats'], info_dict['subtitles'] = self._extract_formats(cid, video_id, record_id=record_id) | |
4a733545 AS |
211 | return info_dict |
212 | ||
9b8b7a7b AS |
213 | def _extract_live(self, channel_name): |
214 | cid = self._extract_cid(channel_name, channel_name) | |
215 | formats, subtitles = self._extract_formats(cid, cid, is_live=True) | |
216 | return { | |
217 | 'id': channel_name, | |
218 | 'title': channel_name, | |
219 | 'is_live': True, | |
520876fa | 220 | 'formats': formats, |
9b8b7a7b AS |
221 | 'subtitles': subtitles |
222 | } | |
4a733545 | 223 | |
9b8b7a7b AS |
224 | def _extract_record(self, record_id): |
225 | video_id = self._extract_video_id_from_recording(record_id) | |
226 | cid, info_dict = self._extract_cid_and_video_info(video_id) | |
227 | info_dict['formats'], info_dict['subtitles'] = self._extract_formats(cid, video_id, record_id=record_id) | |
228 | return info_dict | |
67ca1a8e | 229 | |
9b8b7a7b AS |
230 | def _extract_ondemand(self, ondemand_id): |
231 | ondemand_termtoken, ondemand_type, info_dict = self._extract_ondemand_info(ondemand_id) | |
232 | info_dict['formats'], info_dict['subtitles'] = self._extract_formats( | |
233 | None, ondemand_id, ondemand_id=ondemand_id, | |
234 | ondemand_termtoken=ondemand_termtoken, ondemand_type=ondemand_type) | |
235 | return info_dict | |
67ca1a8e | 236 | |
1155ecef | 237 | def _real_extract(self, url): |
48732bec | 238 | video_id, record_id = self._match_valid_url(url).groups() |
f60ef663 | 239 | return getattr(self, f'_extract_{self._TYPE}')(video_id or record_id) |
1155ecef | 240 | |
4a733545 | 241 | |
f60ef663 AS |
242 | def _create_valid_url(host, match, qs, base_re=None): |
243 | match_base = fr'|{base_re}/(?P<vid1>{match})' if base_re else '(?P<vid1>)' | |
244 | return rf'''(?x)https?://(?:www\.)?{re.escape(host)}/(?: | |
245 | [^?#]+\?(?:[^#]+&)?{qs}=(?P<vid2>{match}) | |
246 | {match_base} | |
247 | )''' | |
4a733545 AS |
248 | |
249 | ||
f6d7f7b4 S |
250 | class ZattooBaseIE(ZattooPlatformBaseIE): |
251 | _NETRC_MACHINE = 'zattoo' | |
252 | _HOST = 'zattoo.com' | |
253 | ||
f6d7f7b4 | 254 | |
4a733545 | 255 | class ZattooIE(ZattooBaseIE): |
f60ef663 | 256 | _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') |
9b8b7a7b | 257 | _TYPE = 'video' |
4a733545 | 258 | _TESTS = [{ |
9b8b7a7b AS |
259 | 'url': 'https://zattoo.com/program/zdf/250170418', |
260 | 'info_dict': { | |
261 | 'id': '250170418', | |
262 | 'ext': 'mp4', | |
263 | 'title': 'Markus Lanz', | |
264 | 'description': 'md5:e41cb1257de008ca62a73bb876ffa7fc', | |
265 | 'thumbnail': 're:http://images.zattic.com/cms/.+/format_480x360.jpg', | |
266 | 'creator': 'ZDF HD', | |
267 | 'release_year': 2022, | |
268 | 'episode': 'Folge 1655', | |
269 | 'categories': 'count:1', | |
270 | 'tags': 'count:2' | |
271 | }, | |
272 | 'params': {'skip_download': 'm3u8'} | |
273 | }, { | |
274 | 'url': 'https://zattoo.com/program/daserste/210177916', | |
4a733545 AS |
275 | 'only_matching': True, |
276 | }, { | |
9b8b7a7b | 277 | 'url': 'https://zattoo.com/guide/german?channel=srf1&program=169860555', |
4a733545 AS |
278 | 'only_matching': True, |
279 | }] | |
280 | ||
4a733545 AS |
281 | |
282 | class ZattooLiveIE(ZattooBaseIE): | |
f60ef663 | 283 | _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') |
9b8b7a7b AS |
284 | _TYPE = 'live' |
285 | _TESTS = [{ | |
286 | 'url': 'https://zattoo.com/channels/german?channel=srf_zwei', | |
4a733545 | 287 | 'only_matching': True, |
9b8b7a7b AS |
288 | }, { |
289 | 'url': 'https://zattoo.com/live/srf1', | |
290 | 'only_matching': True, | |
291 | }] | |
4a733545 | 292 | |
67ca1a8e S |
293 | @classmethod |
294 | def suitable(cls, url): | |
9b8b7a7b | 295 | return False if ZattooIE.suitable(url) else super().suitable(url) |
67ca1a8e | 296 | |
9b8b7a7b AS |
297 | |
298 | class ZattooMoviesIE(ZattooBaseIE): | |
f60ef663 | 299 | _VALID_URL = _create_valid_url(ZattooBaseIE._HOST, r'\w+', 'movie_id', 'vod/movies') |
9b8b7a7b AS |
300 | _TYPE = 'ondemand' |
301 | _TESTS = [{ | |
302 | 'url': 'https://zattoo.com/vod/movies/7521', | |
303 | 'only_matching': True, | |
304 | }, { | |
305 | 'url': 'https://zattoo.com/ondemand?movie_id=7521&term_token=9f00f43183269484edde', | |
306 | 'only_matching': True, | |
307 | }] | |
f6d7f7b4 S |
308 | |
309 | ||
9b8b7a7b | 310 | class ZattooRecordingsIE(ZattooBaseIE): |
f60ef663 | 311 | _VALID_URL = _create_valid_url('zattoo.com', r'\d+', 'recording') |
9b8b7a7b AS |
312 | _TYPE = 'record' |
313 | _TESTS = [{ | |
314 | 'url': 'https://zattoo.com/recordings?recording=193615508', | |
315 | 'only_matching': True, | |
316 | }, { | |
317 | 'url': 'https://zattoo.com/tc/ptc_recordings_all_recordings?recording=193615420', | |
318 | 'only_matching': True, | |
319 | }] | |
320 | ||
321 | ||
f60ef663 | 322 | class NetPlusTVBaseIE(ZattooPlatformBaseIE): |
a831c2ea | 323 | _NETRC_MACHINE = 'netplus' |
f6d7f7b4 | 324 | _HOST = 'netplus.tv' |
16d896b2 | 325 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 326 | |
f60ef663 AS |
327 | |
328 | class NetPlusTVIE(NetPlusTVBaseIE): | |
329 | _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
330 | _TYPE = 'video' | |
331 | _TESTS = [{ | |
332 | 'url': 'https://netplus.tv/program/daserste/210177916', | |
333 | 'only_matching': True, | |
334 | }, { | |
335 | 'url': 'https://netplus.tv/guide/german?channel=srf1&program=169860555', | |
336 | 'only_matching': True, | |
337 | }] | |
338 | ||
339 | ||
340 | class NetPlusTVLiveIE(NetPlusTVBaseIE): | |
341 | _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
342 | _TYPE = 'live' | |
f6d7f7b4 | 343 | _TESTS = [{ |
f60ef663 AS |
344 | 'url': 'https://netplus.tv/channels/german?channel=srf_zwei', |
345 | 'only_matching': True, | |
346 | }, { | |
347 | 'url': 'https://netplus.tv/live/srf1', | |
f6d7f7b4 S |
348 | 'only_matching': True, |
349 | }] | |
350 | ||
f60ef663 AS |
351 | @classmethod |
352 | def suitable(cls, url): | |
353 | return False if NetPlusTVIE.suitable(url) else super().suitable(url) | |
354 | ||
f6d7f7b4 | 355 | |
f60ef663 AS |
356 | class NetPlusTVRecordingsIE(NetPlusTVBaseIE): |
357 | _VALID_URL = _create_valid_url(NetPlusTVBaseIE._HOST, r'\d+', 'recording') | |
358 | _TYPE = 'record' | |
359 | _TESTS = [{ | |
360 | 'url': 'https://netplus.tv/recordings?recording=193615508', | |
361 | 'only_matching': True, | |
362 | }, { | |
363 | 'url': 'https://netplus.tv/tc/ptc_recordings_all_recordings?recording=193615420', | |
364 | 'only_matching': True, | |
365 | }] | |
366 | ||
367 | ||
368 | class MNetTVBaseIE(ZattooPlatformBaseIE): | |
f6d7f7b4 S |
369 | _NETRC_MACHINE = 'mnettv' |
370 | _HOST = 'tvplus.m-net.de' | |
f6d7f7b4 | 371 | |
f60ef663 AS |
372 | |
373 | class MNetTVIE(MNetTVBaseIE): | |
374 | _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
375 | _TYPE = 'video' | |
376 | _TESTS = [{ | |
377 | 'url': 'https://tvplus.m-net.de/program/daserste/210177916', | |
378 | 'only_matching': True, | |
379 | }, { | |
380 | 'url': 'https://tvplus.m-net.de/guide/german?channel=srf1&program=169860555', | |
381 | 'only_matching': True, | |
382 | }] | |
383 | ||
384 | ||
385 | class MNetTVLiveIE(MNetTVBaseIE): | |
386 | _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
387 | _TYPE = 'live' | |
388 | _TESTS = [{ | |
389 | 'url': 'https://tvplus.m-net.de/channels/german?channel=srf_zwei', | |
390 | 'only_matching': True, | |
391 | }, { | |
392 | 'url': 'https://tvplus.m-net.de/live/srf1', | |
393 | 'only_matching': True, | |
394 | }] | |
395 | ||
396 | @classmethod | |
397 | def suitable(cls, url): | |
398 | return False if MNetTVIE.suitable(url) else super().suitable(url) | |
399 | ||
400 | ||
401 | class MNetTVRecordingsIE(MNetTVBaseIE): | |
402 | _VALID_URL = _create_valid_url(MNetTVBaseIE._HOST, r'\d+', 'recording') | |
403 | _TYPE = 'record' | |
f6d7f7b4 | 404 | _TESTS = [{ |
f60ef663 AS |
405 | 'url': 'https://tvplus.m-net.de/recordings?recording=193615508', |
406 | 'only_matching': True, | |
407 | }, { | |
408 | 'url': 'https://tvplus.m-net.de/tc/ptc_recordings_all_recordings?recording=193615420', | |
f6d7f7b4 S |
409 | 'only_matching': True, |
410 | }] | |
411 | ||
412 | ||
f60ef663 | 413 | class WalyTVBaseIE(ZattooPlatformBaseIE): |
f6d7f7b4 S |
414 | _NETRC_MACHINE = 'walytv' |
415 | _HOST = 'player.waly.tv' | |
f6d7f7b4 | 416 | |
f60ef663 AS |
417 | |
418 | class WalyTVIE(WalyTVBaseIE): | |
419 | _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
420 | _TYPE = 'video' | |
421 | _TESTS = [{ | |
422 | 'url': 'https://player.waly.tv/program/daserste/210177916', | |
423 | 'only_matching': True, | |
424 | }, { | |
425 | 'url': 'https://player.waly.tv/guide/german?channel=srf1&program=169860555', | |
426 | 'only_matching': True, | |
427 | }] | |
428 | ||
429 | ||
430 | class WalyTVLiveIE(WalyTVBaseIE): | |
431 | _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
432 | _TYPE = 'live' | |
433 | _TESTS = [{ | |
434 | 'url': 'https://player.waly.tv/channels/german?channel=srf_zwei', | |
435 | 'only_matching': True, | |
436 | }, { | |
437 | 'url': 'https://player.waly.tv/live/srf1', | |
438 | 'only_matching': True, | |
439 | }] | |
440 | ||
441 | @classmethod | |
442 | def suitable(cls, url): | |
443 | return False if WalyTVIE.suitable(url) else super().suitable(url) | |
444 | ||
445 | ||
446 | class WalyTVRecordingsIE(WalyTVBaseIE): | |
447 | _VALID_URL = _create_valid_url(WalyTVBaseIE._HOST, r'\d+', 'recording') | |
448 | _TYPE = 'record' | |
f6d7f7b4 | 449 | _TESTS = [{ |
f60ef663 AS |
450 | 'url': 'https://player.waly.tv/recordings?recording=193615508', |
451 | 'only_matching': True, | |
452 | }, { | |
453 | 'url': 'https://player.waly.tv/tc/ptc_recordings_all_recordings?recording=193615420', | |
f6d7f7b4 S |
454 | 'only_matching': True, |
455 | }] | |
456 | ||
457 | ||
f60ef663 | 458 | class BBVTVBaseIE(ZattooPlatformBaseIE): |
f6d7f7b4 S |
459 | _NETRC_MACHINE = 'bbvtv' |
460 | _HOST = 'bbv-tv.net' | |
16d896b2 | 461 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 462 | |
f60ef663 AS |
463 | |
464 | class BBVTVIE(BBVTVBaseIE): | |
465 | _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
466 | _TYPE = 'video' | |
467 | _TESTS = [{ | |
468 | 'url': 'https://bbv-tv.net/program/daserste/210177916', | |
469 | 'only_matching': True, | |
470 | }, { | |
471 | 'url': 'https://bbv-tv.net/guide/german?channel=srf1&program=169860555', | |
472 | 'only_matching': True, | |
473 | }] | |
474 | ||
475 | ||
476 | class BBVTVLiveIE(BBVTVBaseIE): | |
477 | _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
478 | _TYPE = 'live' | |
f6d7f7b4 | 479 | _TESTS = [{ |
f60ef663 AS |
480 | 'url': 'https://bbv-tv.net/channels/german?channel=srf_zwei', |
481 | 'only_matching': True, | |
482 | }, { | |
483 | 'url': 'https://bbv-tv.net/live/srf1', | |
f6d7f7b4 S |
484 | 'only_matching': True, |
485 | }] | |
486 | ||
f60ef663 AS |
487 | @classmethod |
488 | def suitable(cls, url): | |
489 | return False if BBVTVIE.suitable(url) else super().suitable(url) | |
f6d7f7b4 | 490 | |
f60ef663 AS |
491 | |
492 | class BBVTVRecordingsIE(BBVTVBaseIE): | |
493 | _VALID_URL = _create_valid_url(BBVTVBaseIE._HOST, r'\d+', 'recording') | |
494 | _TYPE = 'record' | |
495 | _TESTS = [{ | |
496 | 'url': 'https://bbv-tv.net/recordings?recording=193615508', | |
497 | 'only_matching': True, | |
498 | }, { | |
499 | 'url': 'https://bbv-tv.net/tc/ptc_recordings_all_recordings?recording=193615420', | |
500 | 'only_matching': True, | |
501 | }] | |
502 | ||
503 | ||
504 | class VTXTVBaseIE(ZattooPlatformBaseIE): | |
f6d7f7b4 S |
505 | _NETRC_MACHINE = 'vtxtv' |
506 | _HOST = 'vtxtv.ch' | |
16d896b2 | 507 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 508 | |
f60ef663 AS |
509 | |
510 | class VTXTVIE(VTXTVBaseIE): | |
511 | _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
512 | _TYPE = 'video' | |
513 | _TESTS = [{ | |
514 | 'url': 'https://vtxtv.ch/program/daserste/210177916', | |
515 | 'only_matching': True, | |
516 | }, { | |
517 | 'url': 'https://vtxtv.ch/guide/german?channel=srf1&program=169860555', | |
518 | 'only_matching': True, | |
519 | }] | |
520 | ||
521 | ||
522 | class VTXTVLiveIE(VTXTVBaseIE): | |
523 | _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
524 | _TYPE = 'live' | |
525 | _TESTS = [{ | |
526 | 'url': 'https://vtxtv.ch/channels/german?channel=srf_zwei', | |
527 | 'only_matching': True, | |
528 | }, { | |
529 | 'url': 'https://vtxtv.ch/live/srf1', | |
530 | 'only_matching': True, | |
531 | }] | |
532 | ||
533 | @classmethod | |
534 | def suitable(cls, url): | |
535 | return False if VTXTVIE.suitable(url) else super().suitable(url) | |
536 | ||
537 | ||
538 | class VTXTVRecordingsIE(VTXTVBaseIE): | |
539 | _VALID_URL = _create_valid_url(VTXTVBaseIE._HOST, r'\d+', 'recording') | |
540 | _TYPE = 'record' | |
f6d7f7b4 | 541 | _TESTS = [{ |
f60ef663 AS |
542 | 'url': 'https://vtxtv.ch/recordings?recording=193615508', |
543 | 'only_matching': True, | |
544 | }, { | |
545 | 'url': 'https://vtxtv.ch/tc/ptc_recordings_all_recordings?recording=193615420', | |
f6d7f7b4 S |
546 | 'only_matching': True, |
547 | }] | |
548 | ||
549 | ||
f60ef663 | 550 | class GlattvisionTVBaseIE(ZattooPlatformBaseIE): |
f6d7f7b4 S |
551 | _NETRC_MACHINE = 'glattvisiontv' |
552 | _HOST = 'iptv.glattvision.ch' | |
f6d7f7b4 | 553 | |
f60ef663 AS |
554 | |
555 | class GlattvisionTVIE(GlattvisionTVBaseIE): | |
556 | _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
557 | _TYPE = 'video' | |
f6d7f7b4 | 558 | _TESTS = [{ |
f60ef663 AS |
559 | 'url': 'https://iptv.glattvision.ch/program/daserste/210177916', |
560 | 'only_matching': True, | |
561 | }, { | |
562 | 'url': 'https://iptv.glattvision.ch/guide/german?channel=srf1&program=169860555', | |
f6d7f7b4 S |
563 | 'only_matching': True, |
564 | }] | |
565 | ||
566 | ||
f60ef663 AS |
567 | class GlattvisionTVLiveIE(GlattvisionTVBaseIE): |
568 | _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
569 | _TYPE = 'live' | |
570 | _TESTS = [{ | |
571 | 'url': 'https://iptv.glattvision.ch/channels/german?channel=srf_zwei', | |
572 | 'only_matching': True, | |
573 | }, { | |
574 | 'url': 'https://iptv.glattvision.ch/live/srf1', | |
575 | 'only_matching': True, | |
576 | }] | |
577 | ||
578 | @classmethod | |
579 | def suitable(cls, url): | |
580 | return False if GlattvisionTVIE.suitable(url) else super().suitable(url) | |
581 | ||
582 | ||
583 | class GlattvisionTVRecordingsIE(GlattvisionTVBaseIE): | |
584 | _VALID_URL = _create_valid_url(GlattvisionTVBaseIE._HOST, r'\d+', 'recording') | |
585 | _TYPE = 'record' | |
586 | _TESTS = [{ | |
587 | 'url': 'https://iptv.glattvision.ch/recordings?recording=193615508', | |
588 | 'only_matching': True, | |
589 | }, { | |
590 | 'url': 'https://iptv.glattvision.ch/tc/ptc_recordings_all_recordings?recording=193615420', | |
591 | 'only_matching': True, | |
592 | }] | |
593 | ||
594 | ||
595 | class SAKTVBaseIE(ZattooPlatformBaseIE): | |
f6d7f7b4 S |
596 | _NETRC_MACHINE = 'saktv' |
597 | _HOST = 'saktv.ch' | |
16d896b2 | 598 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 599 | |
f60ef663 AS |
600 | |
601 | class SAKTVIE(SAKTVBaseIE): | |
602 | _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
603 | _TYPE = 'video' | |
604 | _TESTS = [{ | |
605 | 'url': 'https://saktv.ch/program/daserste/210177916', | |
606 | 'only_matching': True, | |
607 | }, { | |
608 | 'url': 'https://saktv.ch/guide/german?channel=srf1&program=169860555', | |
609 | 'only_matching': True, | |
610 | }] | |
611 | ||
612 | ||
613 | class SAKTVLiveIE(SAKTVBaseIE): | |
614 | _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
615 | _TYPE = 'live' | |
f6d7f7b4 | 616 | _TESTS = [{ |
f60ef663 AS |
617 | 'url': 'https://saktv.ch/channels/german?channel=srf_zwei', |
618 | 'only_matching': True, | |
619 | }, { | |
620 | 'url': 'https://saktv.ch/live/srf1', | |
f6d7f7b4 S |
621 | 'only_matching': True, |
622 | }] | |
623 | ||
f60ef663 AS |
624 | @classmethod |
625 | def suitable(cls, url): | |
626 | return False if SAKTVIE.suitable(url) else super().suitable(url) | |
627 | ||
f6d7f7b4 | 628 | |
f60ef663 AS |
629 | class SAKTVRecordingsIE(SAKTVBaseIE): |
630 | _VALID_URL = _create_valid_url(SAKTVBaseIE._HOST, r'\d+', 'recording') | |
631 | _TYPE = 'record' | |
632 | _TESTS = [{ | |
633 | 'url': 'https://saktv.ch/recordings?recording=193615508', | |
634 | 'only_matching': True, | |
635 | }, { | |
636 | 'url': 'https://saktv.ch/tc/ptc_recordings_all_recordings?recording=193615420', | |
637 | 'only_matching': True, | |
638 | }] | |
639 | ||
640 | ||
641 | class EWETVBaseIE(ZattooPlatformBaseIE): | |
f6d7f7b4 S |
642 | _NETRC_MACHINE = 'ewetv' |
643 | _HOST = 'tvonline.ewe.de' | |
f6d7f7b4 | 644 | |
f60ef663 AS |
645 | |
646 | class EWETVIE(EWETVBaseIE): | |
647 | _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
648 | _TYPE = 'video' | |
649 | _TESTS = [{ | |
650 | 'url': 'https://tvonline.ewe.de/program/daserste/210177916', | |
651 | 'only_matching': True, | |
652 | }, { | |
653 | 'url': 'https://tvonline.ewe.de/guide/german?channel=srf1&program=169860555', | |
654 | 'only_matching': True, | |
655 | }] | |
656 | ||
657 | ||
658 | class EWETVLiveIE(EWETVBaseIE): | |
659 | _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
660 | _TYPE = 'live' | |
661 | _TESTS = [{ | |
662 | 'url': 'https://tvonline.ewe.de/channels/german?channel=srf_zwei', | |
663 | 'only_matching': True, | |
664 | }, { | |
665 | 'url': 'https://tvonline.ewe.de/live/srf1', | |
666 | 'only_matching': True, | |
667 | }] | |
668 | ||
669 | @classmethod | |
670 | def suitable(cls, url): | |
671 | return False if EWETVIE.suitable(url) else super().suitable(url) | |
672 | ||
673 | ||
674 | class EWETVRecordingsIE(EWETVBaseIE): | |
675 | _VALID_URL = _create_valid_url(EWETVBaseIE._HOST, r'\d+', 'recording') | |
676 | _TYPE = 'record' | |
f6d7f7b4 | 677 | _TESTS = [{ |
f60ef663 AS |
678 | 'url': 'https://tvonline.ewe.de/recordings?recording=193615508', |
679 | 'only_matching': True, | |
680 | }, { | |
681 | 'url': 'https://tvonline.ewe.de/tc/ptc_recordings_all_recordings?recording=193615420', | |
f6d7f7b4 S |
682 | 'only_matching': True, |
683 | }] | |
684 | ||
685 | ||
f60ef663 | 686 | class QuantumTVBaseIE(ZattooPlatformBaseIE): |
f6d7f7b4 S |
687 | _NETRC_MACHINE = 'quantumtv' |
688 | _HOST = 'quantum-tv.com' | |
16d896b2 | 689 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 690 | |
f60ef663 AS |
691 | |
692 | class QuantumTVIE(QuantumTVBaseIE): | |
693 | _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
694 | _TYPE = 'video' | |
f6d7f7b4 | 695 | _TESTS = [{ |
f60ef663 AS |
696 | 'url': 'https://quantum-tv.com/program/daserste/210177916', |
697 | 'only_matching': True, | |
698 | }, { | |
699 | 'url': 'https://quantum-tv.com/guide/german?channel=srf1&program=169860555', | |
700 | 'only_matching': True, | |
701 | }] | |
702 | ||
703 | ||
704 | class QuantumTVLiveIE(QuantumTVBaseIE): | |
705 | _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
706 | _TYPE = 'live' | |
707 | _TESTS = [{ | |
708 | 'url': 'https://quantum-tv.com/channels/german?channel=srf_zwei', | |
709 | 'only_matching': True, | |
710 | }, { | |
711 | 'url': 'https://quantum-tv.com/live/srf1', | |
712 | 'only_matching': True, | |
713 | }] | |
714 | ||
715 | @classmethod | |
716 | def suitable(cls, url): | |
717 | return False if QuantumTVIE.suitable(url) else super().suitable(url) | |
718 | ||
719 | ||
720 | class QuantumTVRecordingsIE(QuantumTVBaseIE): | |
721 | _VALID_URL = _create_valid_url(QuantumTVBaseIE._HOST, r'\d+', 'recording') | |
722 | _TYPE = 'record' | |
723 | _TESTS = [{ | |
724 | 'url': 'https://quantum-tv.com/recordings?recording=193615508', | |
725 | 'only_matching': True, | |
726 | }, { | |
727 | 'url': 'https://quantum-tv.com/tc/ptc_recordings_all_recordings?recording=193615420', | |
f6d7f7b4 S |
728 | 'only_matching': True, |
729 | }] | |
730 | ||
731 | ||
f60ef663 | 732 | class OsnatelTVBaseIE(ZattooPlatformBaseIE): |
f6d7f7b4 | 733 | _NETRC_MACHINE = 'osnateltv' |
2004e221 | 734 | _HOST = 'tvonline.osnatel.de' |
f6d7f7b4 | 735 | |
f60ef663 AS |
736 | |
737 | class OsnatelTVIE(OsnatelTVBaseIE): | |
738 | _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
739 | _TYPE = 'video' | |
740 | _TESTS = [{ | |
741 | 'url': 'https://tvonline.osnatel.de/program/daserste/210177916', | |
742 | 'only_matching': True, | |
743 | }, { | |
744 | 'url': 'https://tvonline.osnatel.de/guide/german?channel=srf1&program=169860555', | |
745 | 'only_matching': True, | |
746 | }] | |
747 | ||
748 | ||
749 | class OsnatelTVLiveIE(OsnatelTVBaseIE): | |
750 | _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
751 | _TYPE = 'live' | |
f6d7f7b4 | 752 | _TESTS = [{ |
f60ef663 AS |
753 | 'url': 'https://tvonline.osnatel.de/channels/german?channel=srf_zwei', |
754 | 'only_matching': True, | |
755 | }, { | |
756 | 'url': 'https://tvonline.osnatel.de/live/srf1', | |
f6d7f7b4 S |
757 | 'only_matching': True, |
758 | }] | |
759 | ||
f60ef663 AS |
760 | @classmethod |
761 | def suitable(cls, url): | |
762 | return False if OsnatelTVIE.suitable(url) else super().suitable(url) | |
f6d7f7b4 | 763 | |
f60ef663 AS |
764 | |
765 | class OsnatelTVRecordingsIE(OsnatelTVBaseIE): | |
766 | _VALID_URL = _create_valid_url(OsnatelTVBaseIE._HOST, r'\d+', 'recording') | |
767 | _TYPE = 'record' | |
768 | _TESTS = [{ | |
769 | 'url': 'https://tvonline.osnatel.de/recordings?recording=193615508', | |
770 | 'only_matching': True, | |
771 | }, { | |
772 | 'url': 'https://tvonline.osnatel.de/tc/ptc_recordings_all_recordings?recording=193615420', | |
773 | 'only_matching': True, | |
774 | }] | |
775 | ||
776 | ||
777 | class EinsUndEinsTVBaseIE(ZattooPlatformBaseIE): | |
f6d7f7b4 S |
778 | _NETRC_MACHINE = '1und1tv' |
779 | _HOST = '1und1.tv' | |
16d896b2 | 780 | _API_HOST = 'www.%s' % _HOST |
f6d7f7b4 | 781 | |
f60ef663 AS |
782 | |
783 | class EinsUndEinsTVIE(EinsUndEinsTVBaseIE): | |
784 | _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
785 | _TYPE = 'video' | |
f6d7f7b4 | 786 | _TESTS = [{ |
f60ef663 AS |
787 | 'url': 'https://1und1.tv/program/daserste/210177916', |
788 | 'only_matching': True, | |
789 | }, { | |
790 | 'url': 'https://1und1.tv/guide/german?channel=srf1&program=169860555', | |
f6d7f7b4 S |
791 | 'only_matching': True, |
792 | }] | |
a81daba2 AS |
793 | |
794 | ||
f60ef663 AS |
795 | class EinsUndEinsTVLiveIE(EinsUndEinsTVBaseIE): |
796 | _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
797 | _TYPE = 'live' | |
798 | _TESTS = [{ | |
799 | 'url': 'https://1und1.tv/channels/german?channel=srf_zwei', | |
800 | 'only_matching': True, | |
801 | }, { | |
802 | 'url': 'https://1und1.tv/live/srf1', | |
803 | 'only_matching': True, | |
804 | }] | |
805 | ||
806 | @classmethod | |
807 | def suitable(cls, url): | |
808 | return False if EinsUndEinsTVIE.suitable(url) else super().suitable(url) | |
809 | ||
810 | ||
811 | class EinsUndEinsTVRecordingsIE(EinsUndEinsTVBaseIE): | |
812 | _VALID_URL = _create_valid_url(EinsUndEinsTVBaseIE._HOST, r'\d+', 'recording') | |
813 | _TYPE = 'record' | |
814 | _TESTS = [{ | |
815 | 'url': 'https://1und1.tv/recordings?recording=193615508', | |
816 | 'only_matching': True, | |
817 | }, { | |
818 | 'url': 'https://1und1.tv/tc/ptc_recordings_all_recordings?recording=193615420', | |
819 | 'only_matching': True, | |
820 | }] | |
821 | ||
822 | ||
823 | class SaltTVBaseIE(ZattooPlatformBaseIE): | |
a81daba2 AS |
824 | _NETRC_MACHINE = 'salttv' |
825 | _HOST = 'tv.salt.ch' | |
a81daba2 | 826 | |
f60ef663 AS |
827 | |
828 | class SaltTVIE(SaltTVBaseIE): | |
829 | _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'\d+', 'program', '(?:program|watch)/[^/]+') | |
830 | _TYPE = 'video' | |
831 | _TESTS = [{ | |
832 | 'url': 'https://tv.salt.ch/program/daserste/210177916', | |
833 | 'only_matching': True, | |
834 | }, { | |
835 | 'url': 'https://tv.salt.ch/guide/german?channel=srf1&program=169860555', | |
836 | 'only_matching': True, | |
837 | }] | |
838 | ||
839 | ||
840 | class SaltTVLiveIE(SaltTVBaseIE): | |
841 | _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'[^/?&#]+', 'channel', 'live') | |
842 | _TYPE = 'live' | |
a81daba2 | 843 | _TESTS = [{ |
f60ef663 AS |
844 | 'url': 'https://tv.salt.ch/channels/german?channel=srf_zwei', |
845 | 'only_matching': True, | |
846 | }, { | |
847 | 'url': 'https://tv.salt.ch/live/srf1', | |
848 | 'only_matching': True, | |
849 | }] | |
850 | ||
851 | @classmethod | |
852 | def suitable(cls, url): | |
853 | return False if SaltTVIE.suitable(url) else super().suitable(url) | |
854 | ||
855 | ||
856 | class SaltTVRecordingsIE(SaltTVBaseIE): | |
857 | _VALID_URL = _create_valid_url(SaltTVBaseIE._HOST, r'\d+', 'recording') | |
858 | _TYPE = 'record' | |
859 | _TESTS = [{ | |
860 | 'url': 'https://tv.salt.ch/recordings?recording=193615508', | |
861 | 'only_matching': True, | |
862 | }, { | |
863 | 'url': 'https://tv.salt.ch/tc/ptc_recordings_all_recordings?recording=193615420', | |
a81daba2 AS |
864 | 'only_matching': True, |
865 | }] |