[ie/chaturbate] Fix support for non-public streams (#11624)
[yt-dlp3.git] / yt_dlp / extractor / dplay.py
blob86950b244539c0edc06d8a86756531f77feca216
1 import json
2 import uuid
4 from .common import InfoExtractor
5 from ..networking.exceptions import HTTPError
6 from ..utils import (
7 ExtractorError,
8 determine_ext,
9 float_or_none,
10 int_or_none,
11 remove_start,
12 strip_or_none,
13 try_get,
14 unified_timestamp,
18 class DPlayBaseIE(InfoExtractor):
19 _PATH_REGEX = r'/(?P<id>[^/]+/[^/?#]+)'
20 _auth_token_cache = {}
22 def _get_auth(self, disco_base, display_id, realm, needs_device_id=True):
23 key = (disco_base, realm)
24 st = self._get_cookies(disco_base).get('st')
25 token = (st and st.value) or self._auth_token_cache.get(key)
27 if not token:
28 query = {'realm': realm}
29 if needs_device_id:
30 query['deviceId'] = uuid.uuid4().hex
31 token = self._download_json(
32 disco_base + 'token', display_id, 'Downloading token',
33 query=query)['data']['attributes']['token']
35 # Save cache only if cookies are not being set
36 if not self._get_cookies(disco_base).get('st'):
37 self._auth_token_cache[key] = token
39 return f'Bearer {token}'
41 def _process_errors(self, e, geo_countries):
42 info = self._parse_json(e.cause.response.read().decode('utf-8'), None)
43 error = info['errors'][0]
44 error_code = error.get('code')
45 if error_code == 'access.denied.geoblocked':
46 self.raise_geo_restricted(countries=geo_countries)
47 elif error_code in ('access.denied.missingpackage', 'invalid.token'):
48 raise ExtractorError(
49 'This video is only available for registered users. You may want to use --cookies.', expected=True)
50 raise ExtractorError(info['errors'][0]['detail'], expected=True)
52 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
53 headers['Authorization'] = self._get_auth(disco_base, display_id, realm, False)
55 def _download_video_playback_info(self, disco_base, video_id, headers):
56 streaming = self._download_json(
57 disco_base + 'playback/videoPlaybackInfo/' + video_id,
58 video_id, headers=headers)['data']['attributes']['streaming']
59 streaming_list = []
60 for format_id, format_dict in streaming.items():
61 streaming_list.append({
62 'type': format_id,
63 'url': format_dict.get('url'),
65 return streaming_list
67 def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domain=''):
68 country = self.get_param('geo_bypass_country') or country
69 geo_countries = [country.upper()]
70 self._initialize_geo_bypass({
71 'countries': geo_countries,
73 disco_base = f'https://{disco_host}/'
74 headers = {
75 'Referer': url,
77 self._update_disco_api_headers(headers, disco_base, display_id, realm)
78 try:
79 video = self._download_json(
80 disco_base + 'content/videos/' + display_id, display_id,
81 headers=headers, query={
82 'fields[channel]': 'name',
83 'fields[image]': 'height,src,width',
84 'fields[show]': 'name',
85 'fields[tag]': 'name',
86 'fields[video]': 'description,episodeNumber,name,publishStart,seasonNumber,videoDuration',
87 'include': 'images,primaryChannel,show,tags',
89 except ExtractorError as e:
90 if isinstance(e.cause, HTTPError) and e.cause.status == 400:
91 self._process_errors(e, geo_countries)
92 raise
93 video_id = video['data']['id']
94 info = video['data']['attributes']
95 title = info['name'].strip()
96 formats = []
97 subtitles = {}
98 try:
99 streaming = self._download_video_playback_info(
100 disco_base, video_id, headers)
101 except ExtractorError as e:
102 if isinstance(e.cause, HTTPError) and e.cause.status == 403:
103 self._process_errors(e, geo_countries)
104 raise
105 for format_dict in streaming:
106 if not isinstance(format_dict, dict):
107 continue
108 format_url = format_dict.get('url')
109 if not format_url:
110 continue
111 format_id = format_dict.get('type')
112 ext = determine_ext(format_url)
113 if format_id == 'dash' or ext == 'mpd':
114 dash_fmts, dash_subs = self._extract_mpd_formats_and_subtitles(
115 format_url, display_id, mpd_id='dash', fatal=False)
116 formats.extend(dash_fmts)
117 subtitles = self._merge_subtitles(subtitles, dash_subs)
118 elif format_id == 'hls' or ext == 'm3u8':
119 m3u8_fmts, m3u8_subs = self._extract_m3u8_formats_and_subtitles(
120 format_url, display_id, 'mp4',
121 entry_protocol='m3u8_native', m3u8_id='hls',
122 fatal=False)
123 formats.extend(m3u8_fmts)
124 subtitles = self._merge_subtitles(subtitles, m3u8_subs)
125 else:
126 formats.append({
127 'url': format_url,
128 'format_id': format_id,
131 creator = series = None
132 tags = []
133 thumbnails = []
134 included = video.get('included') or []
135 if isinstance(included, list):
136 for e in included:
137 attributes = e.get('attributes')
138 if not attributes:
139 continue
140 e_type = e.get('type')
141 if e_type == 'channel':
142 creator = attributes.get('name')
143 elif e_type == 'image':
144 src = attributes.get('src')
145 if src:
146 thumbnails.append({
147 'url': src,
148 'width': int_or_none(attributes.get('width')),
149 'height': int_or_none(attributes.get('height')),
151 if e_type == 'show':
152 series = attributes.get('name')
153 elif e_type == 'tag':
154 name = attributes.get('name')
155 if name:
156 tags.append(name)
157 return {
158 'id': video_id,
159 'display_id': display_id,
160 'title': title,
161 'description': strip_or_none(info.get('description')),
162 'duration': float_or_none(info.get('videoDuration'), 1000),
163 'timestamp': unified_timestamp(info.get('publishStart')),
164 'series': series,
165 'season_number': int_or_none(info.get('seasonNumber')),
166 'episode_number': int_or_none(info.get('episodeNumber')),
167 'creator': creator,
168 'tags': tags,
169 'thumbnails': thumbnails,
170 'formats': formats,
171 'subtitles': subtitles,
172 'http_headers': {
173 'referer': domain,
178 class DPlayIE(DPlayBaseIE):
179 _VALID_URL = r'''(?x)https?://
180 (?P<domain>
181 (?:www\.)?(?P<host>d
183 play\.(?P<country>dk|fi|jp|se|no)|
184 iscoveryplus\.(?P<plus_country>dk|es|fi|it|se|no)
187 (?P<subdomain_country>es|it)\.dplay\.com
188 )/[^/]+''' + DPlayBaseIE._PATH_REGEX
190 _TESTS = [{
191 # non geo restricted, via secure api, unsigned download hls URL
192 'url': 'https://www.dplay.se/videos/nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
193 'info_dict': {
194 'id': '13628',
195 'display_id': 'nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
196 'ext': 'mp4',
197 'title': 'Svensken lär sig njuta av livet',
198 'description': 'md5:d3819c9bccffd0fe458ca42451dd50d8',
199 'duration': 2649.856,
200 'timestamp': 1365453720,
201 'upload_date': '20130408',
202 'creator': 'Kanal 5',
203 'series': 'Nugammalt - 77 händelser som format Sverige',
204 'season_number': 1,
205 'episode_number': 1,
207 'params': {
208 'skip_download': True,
210 }, {
211 # geo restricted, via secure api, unsigned download hls URL
212 'url': 'http://www.dplay.dk/videoer/ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
213 'info_dict': {
214 'id': '104465',
215 'display_id': 'ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
216 'ext': 'mp4',
217 'title': 'Ted Bundy: Mind Of A Monster',
218 'description': 'md5:8b780f6f18de4dae631668b8a9637995',
219 'duration': 5290.027,
220 'timestamp': 1570694400,
221 'upload_date': '20191010',
222 'creator': 'ID - Investigation Discovery',
223 'series': 'Ted Bundy: Mind Of A Monster',
224 'season_number': 1,
225 'episode_number': 1,
227 'params': {
228 'skip_download': True,
230 }, {
231 # disco-api
232 'url': 'https://www.dplay.no/videoer/i-kongens-klr/sesong-1-episode-7',
233 'info_dict': {
234 'id': '40206',
235 'display_id': 'i-kongens-klr/sesong-1-episode-7',
236 'ext': 'mp4',
237 'title': 'Episode 7',
238 'description': 'md5:e3e1411b2b9aebeea36a6ec5d50c60cf',
239 'duration': 2611.16,
240 'timestamp': 1516726800,
241 'upload_date': '20180123',
242 'series': 'I kongens klær',
243 'season_number': 1,
244 'episode_number': 7,
246 'params': {
247 'skip_download': True,
249 'skip': 'Available for Premium users',
250 }, {
251 'url': 'http://it.dplay.com/nove/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij/',
252 'md5': '2b808ffb00fc47b884a172ca5d13053c',
253 'info_dict': {
254 'id': '6918',
255 'display_id': 'biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
256 'ext': 'mp4',
257 'title': 'Luigi Di Maio: la psicosi di Stanislawskij',
258 'description': 'md5:3c7a4303aef85868f867a26f5cc14813',
259 'thumbnail': r're:^https?://.*\.jpe?g',
260 'upload_date': '20160524',
261 'timestamp': 1464076800,
262 'series': 'Biografie imbarazzanti',
263 'season_number': 1,
264 'episode': 'Episode 1',
265 'episode_number': 1,
267 }, {
268 'url': 'https://es.dplay.com/dmax/la-fiebre-del-oro/temporada-8-episodio-1/',
269 'info_dict': {
270 'id': '21652',
271 'display_id': 'la-fiebre-del-oro/temporada-8-episodio-1',
272 'ext': 'mp4',
273 'title': 'Episodio 1',
274 'description': 'md5:b9dcff2071086e003737485210675f69',
275 'thumbnail': r're:^https?://.*\.png',
276 'upload_date': '20180709',
277 'timestamp': 1531173540,
278 'series': 'La fiebre del oro',
279 'season_number': 8,
280 'episode': 'Episode 1',
281 'episode_number': 1,
283 'params': {
284 'skip_download': True,
286 }, {
287 'url': 'https://www.dplay.fi/videot/shifting-gears-with-aaron-kaufman/episode-16',
288 'only_matching': True,
289 }, {
290 'url': 'https://www.dplay.jp/video/gold-rush/24086',
291 'only_matching': True,
292 }, {
293 'url': 'https://www.discoveryplus.se/videos/nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
294 'only_matching': True,
295 }, {
296 'url': 'https://www.discoveryplus.dk/videoer/ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
297 'only_matching': True,
298 }, {
299 'url': 'https://www.discoveryplus.no/videoer/i-kongens-klr/sesong-1-episode-7',
300 'only_matching': True,
301 }, {
302 'url': 'https://www.discoveryplus.it/videos/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
303 'only_matching': True,
304 }, {
305 'url': 'https://www.discoveryplus.es/videos/la-fiebre-del-oro/temporada-8-episodio-1',
306 'only_matching': True,
307 }, {
308 'url': 'https://www.discoveryplus.fi/videot/shifting-gears-with-aaron-kaufman/episode-16',
309 'only_matching': True,
312 def _real_extract(self, url):
313 mobj = self._match_valid_url(url)
314 display_id = mobj.group('id')
315 domain = remove_start(mobj.group('domain'), 'www.')
316 country = mobj.group('country') or mobj.group('subdomain_country') or mobj.group('plus_country')
317 host = 'disco-api.' + domain if domain[0] == 'd' else 'eu2-prod.disco-api.com'
318 return self._get_disco_api_info(
319 url, display_id, host, 'dplay' + country, country, domain)
322 class DiscoveryPlusBaseIE(DPlayBaseIE):
323 """Subclasses must set _PRODUCT, _DISCO_API_PARAMS"""
325 _DISCO_CLIENT_VER = '27.43.0'
327 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
328 headers.update({
329 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
330 'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:{self._DISCO_CLIENT_VER}',
331 'Authorization': self._get_auth(disco_base, display_id, realm),
334 def _download_video_playback_info(self, disco_base, video_id, headers):
335 return self._download_json(
336 disco_base + 'playback/v3/videoPlaybackInfo',
337 video_id, headers=headers, data=json.dumps({
338 'deviceInfo': {
339 'adBlocker': False,
340 'drmSupported': False,
342 'videoId': video_id,
343 'wisteriaProperties': {},
344 }).encode())['data']['attributes']['streaming']
346 def _real_extract(self, url):
347 return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PARAMS)
350 class HGTVDeIE(DiscoveryPlusBaseIE):
351 _VALID_URL = r'https?://de\.hgtv\.com/sendungen' + DPlayBaseIE._PATH_REGEX
352 _TESTS = [{
353 'url': 'https://de.hgtv.com/sendungen/mein-kleinstadt-traumhaus/vom-landleben-ins-loft',
354 'info_dict': {
355 'id': '7332936',
356 'ext': 'mp4',
357 'display_id': 'mein-kleinstadt-traumhaus/vom-landleben-ins-loft',
358 'title': 'Vom Landleben ins Loft',
359 'description': 'md5:e5f72c02c853970796dd3818f2e25745',
360 'episode': 'Episode 7',
361 'episode_number': 7,
362 'season': 'Season 7',
363 'season_number': 7,
364 'series': 'Mein Kleinstadt-Traumhaus',
365 'duration': 2645.0,
366 'timestamp': 1725998100,
367 'upload_date': '20240910',
368 'creators': ['HGTV'],
369 'tags': [],
370 'thumbnail': 'https://eu1-prod-images.disco-api.com/2024/08/09/82a386b9-c688-32c7-b9ff-0b13865f0bae.jpeg',
374 _PRODUCT = 'hgtv'
375 _DISCO_API_PARAMS = {
376 'disco_host': 'eu1-prod.disco-api.com',
377 'realm': 'hgtv',
378 'country': 'de',
381 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
382 headers.update({
383 'x-disco-params': f'realm={realm}',
384 'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
385 'Authorization': self._get_auth(disco_base, display_id, realm),
389 class GoDiscoveryIE(DiscoveryPlusBaseIE):
390 _VALID_URL = r'https?://(?:go\.)?discovery\.com/video' + DPlayBaseIE._PATH_REGEX
391 _TESTS = [{
392 'url': 'https://go.discovery.com/video/in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
393 'info_dict': {
394 'id': '5352642',
395 'display_id': 'in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
396 'ext': 'mp4',
397 'title': 'Trapped in a Twister',
398 'description': 'Twisters destroy Midwest towns, trapping spotters in the eye of the storm.',
399 'episode_number': 1,
400 'episode': 'Episode 1',
401 'season_number': 1,
402 'season': 'Season 1',
403 'series': 'In The Eye Of The Storm',
404 'duration': 2490.237,
405 'upload_date': '20240715',
406 'timestamp': 1721008800,
407 'tags': [],
408 'creators': ['Discovery'],
409 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/10/5e39637d-cabf-3ab3-8e9a-f4e9d37bc036.jpeg',
411 }, {
412 'url': 'https://go.discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
413 'info_dict': {
414 'id': '4164906',
415 'display_id': 'dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
416 'ext': 'mp4',
417 'title': 'Rodbuster / Galvanizer',
418 'description': 'Mike installs rebar with a team of rodbusters, then he galvanizes steel.',
419 'season_number': 9,
420 'episode_number': 1,
422 'skip': 'Available for Premium users',
423 }, {
424 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
425 'only_matching': True,
428 _PRODUCT = 'dsc'
429 _DISCO_API_PARAMS = {
430 'disco_host': 'us1-prod-direct.go.discovery.com',
431 'realm': 'go',
432 'country': 'us',
436 class TravelChannelIE(DiscoveryPlusBaseIE):
437 _VALID_URL = r'https?://(?:watch\.)?travelchannel\.com/video' + DPlayBaseIE._PATH_REGEX
438 _TESTS = [{
439 'url': 'https://watch.travelchannel.com/video/the-dead-files-travel-channel/protect-the-children',
440 'info_dict': {
441 'id': '4710177',
442 'display_id': 'the-dead-files-travel-channel/protect-the-children',
443 'ext': 'mp4',
444 'title': 'Protect the Children',
445 'description': 'An evil presence threatens an Ohio woman\'s children and marriage.',
446 'season_number': 14,
447 'season': 'Season 14',
448 'episode_number': 10,
449 'episode': 'Episode 10',
450 'series': 'The Dead Files',
451 'duration': 2550.481,
452 'timestamp': 1664510400,
453 'upload_date': '20220930',
454 'tags': [],
455 'creators': ['Travel Channel'],
456 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/17/5e45eace-de5d-343a-9293-f400a2aa77d5.jpeg',
458 }, {
459 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
460 'info_dict': {
461 'id': '2220256',
462 'display_id': 'ghost-adventures-travel-channel/ghost-train-of-ely',
463 'ext': 'mp4',
464 'title': 'Ghost Train of Ely',
465 'description': 'The crew investigates the dark history of the Nevada Northern Railway.',
466 'season_number': 24,
467 'episode_number': 1,
469 'skip': 'Available for Premium users',
470 }, {
471 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
472 'only_matching': True,
475 _PRODUCT = 'trav'
476 _DISCO_API_PARAMS = {
477 'disco_host': 'us1-prod-direct.watch.travelchannel.com',
478 'realm': 'go',
479 'country': 'us',
483 class CookingChannelIE(DiscoveryPlusBaseIE):
484 _VALID_URL = r'https?://(?:watch\.)?cookingchanneltv\.com/video' + DPlayBaseIE._PATH_REGEX
485 _TESTS = [{
486 'url': 'https://watch.cookingchanneltv.com/video/bobbys-triple-threat-food-network-atve-us/titans-vs-marcus-samuelsson',
487 'info_dict': {
488 'id': '5350005',
489 'ext': 'mp4',
490 'display_id': 'bobbys-triple-threat-food-network-atve-us/titans-vs-marcus-samuelsson',
491 'title': 'Titans vs Marcus Samuelsson',
492 'description': 'Marcus Samuelsson throws his legendary global tricks at the Titans.',
493 'episode_number': 1,
494 'episode': 'Episode 1',
495 'season_number': 3,
496 'season': 'Season 3',
497 'series': 'Bobby\'s Triple Threat',
498 'duration': 2520.851,
499 'upload_date': '20240710',
500 'timestamp': 1720573200,
501 'tags': [],
502 'creators': ['Food Network'],
503 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/04/529cd095-27ec-35c5-84e9-90ebd3e5d2da.jpeg',
505 }, {
506 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
507 'info_dict': {
508 'id': '2348634',
509 'display_id': 'carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
510 'ext': 'mp4',
511 'title': 'The Postman Always Brings Rice',
512 'description': 'Noah visits the Maui Fair and the Aurora Winter Festival in Vancouver.',
513 'season_number': 9,
514 'episode_number': 1,
516 'skip': 'Available for Premium users',
517 }, {
518 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
519 'only_matching': True,
522 _PRODUCT = 'cook'
523 _DISCO_API_PARAMS = {
524 'disco_host': 'us1-prod-direct.watch.cookingchanneltv.com',
525 'realm': 'go',
526 'country': 'us',
530 class HGTVUsaIE(DiscoveryPlusBaseIE):
531 _VALID_URL = r'https?://(?:watch\.)?hgtv\.com/video' + DPlayBaseIE._PATH_REGEX
532 _TESTS = [{
533 'url': 'https://watch.hgtv.com/video/flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
534 'info_dict': {
535 'id': '5025585',
536 'display_id': 'flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
537 'ext': 'mp4',
538 'title': 'Flip or Flop: The Final Flip',
539 'description': 'Tarek and Christina are going their separate ways after one last flip!',
540 'series': 'Flip or Flop: The Final Flip',
541 'duration': 2580.644,
542 'upload_date': '20231101',
543 'timestamp': 1698811200,
544 'tags': [],
545 'creators': ['HGTV'],
546 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/11/27/455caa6c-1462-3f14-b63d-a026d7a5e6d3.jpeg',
548 }, {
549 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
550 'info_dict': {
551 'id': '4289736',
552 'display_id': 'home-inspector-joe-hgtv-atve-us/this-mold-house',
553 'ext': 'mp4',
554 'title': 'This Mold House',
555 'description': 'Joe and Noel help take a familys dream home from hazardous to fabulous.',
556 'season_number': 1,
557 'episode_number': 1,
559 'skip': 'Available for Premium users',
560 }, {
561 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
562 'only_matching': True,
565 _PRODUCT = 'hgtv'
566 _DISCO_API_PARAMS = {
567 'disco_host': 'us1-prod-direct.watch.hgtv.com',
568 'realm': 'go',
569 'country': 'us',
573 class FoodNetworkIE(DiscoveryPlusBaseIE):
574 _VALID_URL = r'https?://(?:watch\.)?foodnetwork\.com/video' + DPlayBaseIE._PATH_REGEX
575 _TESTS = [{
576 'url': 'https://watch.foodnetwork.com/video/guys-grocery-games-food-network/wild-in-the-aisles',
577 'info_dict': {
578 'id': '2152549',
579 'display_id': 'guys-grocery-games-food-network/wild-in-the-aisles',
580 'ext': 'mp4',
581 'title': 'Wild in the Aisles',
582 'description': 'The chefs make spaghetti and meatballs with "Out of Stock" ingredients.',
583 'season_number': 1,
584 'season': 'Season 1',
585 'episode_number': 1,
586 'episode': 'Episode 1',
587 'series': 'Guy\'s Grocery Games',
588 'tags': [],
589 'creators': ['Food Network'],
590 'duration': 2520.651,
591 'upload_date': '20230623',
592 'timestamp': 1687492800,
593 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/06/15/37fb5333-cad2-3dbb-af7c-c20ec77c89c6.jpeg',
595 }, {
596 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
597 'info_dict': {
598 'id': '4116449',
599 'display_id': 'kids-baking-championship-food-network/float-like-a-butterfly',
600 'ext': 'mp4',
601 'title': 'Float Like a Butterfly',
602 'description': 'The 12 kid bakers create colorful carved butterfly cakes.',
603 'season_number': 10,
604 'episode_number': 1,
606 'skip': 'Available for Premium users',
607 }, {
608 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
609 'only_matching': True,
612 _PRODUCT = 'food'
613 _DISCO_API_PARAMS = {
614 'disco_host': 'us1-prod-direct.watch.foodnetwork.com',
615 'realm': 'go',
616 'country': 'us',
620 class DestinationAmericaIE(DiscoveryPlusBaseIE):
621 _VALID_URL = r'https?://(?:www\.)?destinationamerica\.com/video' + DPlayBaseIE._PATH_REGEX
622 _TESTS = [{
623 'url': 'https://www.destinationamerica.com/video/bbq-pit-wars-destination-america/smoke-on-the-water',
624 'info_dict': {
625 'id': '2218409',
626 'display_id': 'bbq-pit-wars-destination-america/smoke-on-the-water',
627 'ext': 'mp4',
628 'title': 'Smoke on the Water',
629 'description': 'The pitmasters head to Georgia for the Smoke on the Water BBQ Festival.',
630 'season_number': 2,
631 'season': 'Season 2',
632 'episode_number': 1,
633 'episode': 'Episode 1',
634 'series': 'BBQ Pit Wars',
635 'tags': [],
636 'creators': ['Destination America'],
637 'duration': 2614.878,
638 'upload_date': '20230623',
639 'timestamp': 1687492800,
640 'thumbnail': 'https://us1-prod-images.disco-api.com/2020/05/11/c0f8e85d-9a10-3e6f-8e43-f6faafa81ba2.jpeg',
642 }, {
643 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
644 'info_dict': {
645 'id': '4210904',
646 'display_id': 'alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
647 'ext': 'mp4',
648 'title': 'Central Alaskas Bigfoot',
649 'description': 'A team heads to central Alaska to investigate an aggressive Bigfoot.',
650 'season_number': 1,
651 'episode_number': 1,
653 'skip': 'Available for Premium users',
654 }, {
655 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
656 'only_matching': True,
659 _PRODUCT = 'dam'
660 _DISCO_API_PARAMS = {
661 'disco_host': 'us1-prod-direct.destinationamerica.com',
662 'realm': 'go',
663 'country': 'us',
667 class InvestigationDiscoveryIE(DiscoveryPlusBaseIE):
668 _VALID_URL = r'https?://(?:www\.)?investigationdiscovery\.com/video' + DPlayBaseIE._PATH_REGEX
669 _TESTS = [{
670 'url': 'https://www.investigationdiscovery.com/video/deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
671 'info_dict': {
672 'id': '5341132',
673 'display_id': 'deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
674 'ext': 'mp4',
675 'title': 'RIP Bianca',
676 'description': 'A teenage influencer discovers an online world of threat, harm and danger.',
677 'season_number': 1,
678 'season': 'Season 1',
679 'episode_number': 3,
680 'episode': 'Episode 3',
681 'series': 'Deadly Influence: The Social Media Murders',
682 'creators': ['Investigation Discovery'],
683 'tags': [],
684 'duration': 2490.888,
685 'upload_date': '20240618',
686 'timestamp': 1718672400,
687 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/06/15/b567c774-9e44-3c6c-b0ba-db860a73e812.jpeg',
689 }, {
690 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
691 'info_dict': {
692 'id': '2139409',
693 'display_id': 'unmasked-investigation-discovery/the-killer-clown',
694 'ext': 'mp4',
695 'title': 'The Killer Clown',
696 'description': 'A wealthy Florida woman is fatally shot in the face by a clown at her door.',
697 'season_number': 1,
698 'episode_number': 1,
700 'skip': 'Available for Premium users',
701 }, {
702 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
703 'only_matching': True,
706 _PRODUCT = 'ids'
707 _DISCO_API_PARAMS = {
708 'disco_host': 'us1-prod-direct.investigationdiscovery.com',
709 'realm': 'go',
710 'country': 'us',
714 class AmHistoryChannelIE(DiscoveryPlusBaseIE):
715 _VALID_URL = r'https?://(?:www\.)?ahctv\.com/video' + DPlayBaseIE._PATH_REGEX
716 _TESTS = [{
717 'url': 'https://www.ahctv.com/video/blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
718 'info_dict': {
719 'id': '2139199',
720 'display_id': 'blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
721 'ext': 'mp4',
722 'title': 'Battle of Bull Run',
723 'description': 'Two untested armies clash in the first real battle of the Civil War.',
724 'season_number': 1,
725 'season': 'Season 1',
726 'episode_number': 1,
727 'episode': 'Episode 1',
728 'series': 'Blood and Fury: America\'s Civil War',
729 'duration': 2612.509,
730 'upload_date': '20220923',
731 'timestamp': 1663905600,
732 'creators': ['AHC'],
733 'tags': [],
734 'thumbnail': 'https://us1-prod-images.disco-api.com/2020/05/11/4af61bd7-d705-3108-82c4-1a6e541e20fa.jpeg',
736 }, {
737 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
738 'info_dict': {
739 'id': '2309730',
740 'display_id': 'modern-sniper-ahc/army',
741 'ext': 'mp4',
742 'title': 'Army',
743 'description': 'Snipers today face challenges their predecessors couldve only dreamed of.',
744 'season_number': 1,
745 'episode_number': 1,
747 'skip': 'Available for Premium users',
748 }, {
749 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
750 'only_matching': True,
753 _PRODUCT = 'ahc'
754 _DISCO_API_PARAMS = {
755 'disco_host': 'us1-prod-direct.ahctv.com',
756 'realm': 'go',
757 'country': 'us',
761 class ScienceChannelIE(DiscoveryPlusBaseIE):
762 _VALID_URL = r'https?://(?:www\.)?sciencechannel\.com/video' + DPlayBaseIE._PATH_REGEX
763 _TESTS = [{
764 'url': 'https://www.sciencechannel.com/video/spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
765 'info_dict': {
766 'id': '2347335',
767 'display_id': 'spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
768 'ext': 'mp4',
769 'title': 'Mystery of the Dead Planets',
770 'description': 'Astronomers unmask the truly destructive nature of the cosmos.',
771 'season_number': 7,
772 'season': 'Season 7',
773 'episode_number': 1,
774 'episode': 'Episode 1',
775 'series': 'Space\'s Deepest Secrets',
776 'duration': 2524.989,
777 'upload_date': '20230128',
778 'timestamp': 1674882000,
779 'creators': ['Science'],
780 'tags': [],
781 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/30/3796829d-aead-3f9a-bd8d-e49048b3cdca.jpeg',
783 }, {
784 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
785 'info_dict': {
786 'id': '2842849',
787 'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
788 'ext': 'mp4',
789 'title': 'Nazi Mystery Machine',
790 'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
791 'season_number': 1,
792 'episode_number': 1,
794 'skip': 'Available for Premium users',
795 }, {
796 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
797 'only_matching': True,
800 _PRODUCT = 'sci'
801 _DISCO_API_PARAMS = {
802 'disco_host': 'us1-prod-direct.sciencechannel.com',
803 'realm': 'go',
804 'country': 'us',
808 class DiscoveryLifeIE(DiscoveryPlusBaseIE):
809 _VALID_URL = r'https?://(?:www\.)?discoverylife\.com/video' + DPlayBaseIE._PATH_REGEX
810 _TESTS = [{
811 'url': 'https://www.discoverylife.com/video/er-files-discovery-life-atve-us/sweet-charity',
812 'info_dict': {
813 'id': '2347614',
814 'display_id': 'er-files-discovery-life-atve-us/sweet-charity',
815 'ext': 'mp4',
816 'title': 'Sweet Charity',
817 'description': 'The staff at Charity Hospital treat a serious foot infection.',
818 'season_number': 1,
819 'season': 'Season 1',
820 'episode_number': 1,
821 'episode': 'Episode 1',
822 'series': 'ER Files',
823 'duration': 2364.261,
824 'upload_date': '20230721',
825 'timestamp': 1689912000,
826 'creators': ['Discovery Life'],
827 'tags': [],
828 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/16/4b6f0124-360b-3546-b6a4-5552db886b86.jpeg',
830 }, {
831 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
832 'info_dict': {
833 'id': '2218238',
834 'display_id': 'surviving-death-discovery-life-atve-us/bodily-trauma',
835 'ext': 'mp4',
836 'title': 'Bodily Trauma',
837 'description': 'Meet three people who tested the limits of the human body.',
838 'season_number': 1,
839 'episode_number': 2,
841 'skip': 'Available for Premium users',
842 }, {
843 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
844 'only_matching': True,
847 _PRODUCT = 'dlf'
848 _DISCO_API_PARAMS = {
849 'disco_host': 'us1-prod-direct.discoverylife.com',
850 'realm': 'go',
851 'country': 'us',
855 class AnimalPlanetIE(DiscoveryPlusBaseIE):
856 _VALID_URL = r'https?://(?:www\.)?animalplanet\.com/video' + DPlayBaseIE._PATH_REGEX
857 _TESTS = [{
858 'url': 'https://www.animalplanet.com/video/mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
859 'info_dict': {
860 'id': '4650835',
861 'display_id': 'mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
862 'ext': 'mp4',
863 'title': 'The Demon of Peru',
864 'description': 'In Peru, a farming village is being terrorized by a “man-like beast.”',
865 'season_number': 1,
866 'season': 'Season 1',
867 'episode_number': 4,
868 'episode': 'Episode 4',
869 'series': 'Mysterious Creatures with Forrest Galante',
870 'duration': 2490.488,
871 'upload_date': '20230111',
872 'timestamp': 1673413200,
873 'creators': ['Animal Planet'],
874 'tags': [],
875 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/01/6dbaa833-9a2e-3fee-9381-c19eddf67c0c.jpeg',
877 }, {
878 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
879 'info_dict': {
880 'id': '3338923',
881 'display_id': 'north-woods-law-animal-planet/squirrel-showdown',
882 'ext': 'mp4',
883 'title': 'Squirrel Showdown',
884 'description': 'A woman is suspected of being in possession of flying squirrel kits.',
885 'season_number': 16,
886 'episode_number': 11,
888 'skip': 'Available for Premium users',
889 }, {
890 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
891 'only_matching': True,
894 _PRODUCT = 'apl'
895 _DISCO_API_PARAMS = {
896 'disco_host': 'us1-prod-direct.animalplanet.com',
897 'realm': 'go',
898 'country': 'us',
902 class TLCIE(DiscoveryPlusBaseIE):
903 _VALID_URL = r'https?://(?:go\.)?tlc\.com/video' + DPlayBaseIE._PATH_REGEX
904 _TESTS = [{
905 'url': 'https://go.tlc.com/video/90-day-the-last-resort-tlc-atve-us/the-last-chance',
906 'info_dict': {
907 'id': '5186422',
908 'display_id': '90-day-the-last-resort-tlc-atve-us/the-last-chance',
909 'ext': 'mp4',
910 'title': 'The Last Chance',
911 'description': 'Infidelity shakes Kalani and Asuelu\'s world, and Angela threatens divorce.',
912 'season_number': 1,
913 'season': 'Season 1',
914 'episode_number': 1,
915 'episode': 'Episode 1',
916 'series': '90 Day: The Last Resort',
917 'duration': 5123.91,
918 'upload_date': '20230815',
919 'timestamp': 1692061200,
920 'creators': ['TLC'],
921 'tags': [],
922 'thumbnail': 'https://us1-prod-images.disco-api.com/2023/08/08/0ee367e2-ac76-334d-bf23-dbf796696a24.jpeg',
924 }, {
925 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
926 'info_dict': {
927 'id': '2206540',
928 'display_id': 'my-600-lb-life-tlc/melissas-story-part-1',
929 'ext': 'mp4',
930 'title': 'Melissas Story (Part 1)',
931 'description': 'At 650 lbs, Melissa is ready to begin her seven-year weight loss journey.',
932 'season_number': 1,
933 'episode_number': 1,
935 'skip': 'Available for Premium users',
936 }, {
937 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
938 'only_matching': True,
941 _PRODUCT = 'tlc'
942 _DISCO_API_PARAMS = {
943 'disco_host': 'us1-prod-direct.tlc.com',
944 'realm': 'go',
945 'country': 'us',
949 class DiscoveryPlusIE(DiscoveryPlusBaseIE):
950 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/(?!it/)(?:(?P<country>[a-z]{2})/)?video(?:/sport|/olympics)?' + DPlayBaseIE._PATH_REGEX
951 _TESTS = [{
952 'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
953 'info_dict': {
954 'id': '1140794',
955 'display_id': 'property-brothers-forever-home/food-and-family',
956 'ext': 'mp4',
957 'title': 'Food and Family',
958 'description': 'The brothers help a Richmond family expand their single-level home.',
959 'duration': 2583.113,
960 'timestamp': 1609304400,
961 'upload_date': '20201230',
962 'creator': 'HGTV',
963 'series': 'Property Brothers: Forever Home',
964 'season_number': 1,
965 'episode_number': 1,
967 'skip': 'Available for Premium users',
968 }, {
969 'url': 'https://discoveryplus.com/ca/video/bering-sea-gold-discovery-ca/goldslingers',
970 'only_matching': True,
971 }, {
972 'url': 'https://www.discoveryplus.com/gb/video/sport/eurosport-1-british-eurosport-1-british-sport/6-hours-of-spa-review',
973 'only_matching': True,
974 }, {
975 'url': 'https://www.discoveryplus.com/gb/video/olympics/dplus-sport-dplus-sport-sport/rugby-sevens-australia-samoa',
976 'only_matching': True,
979 _PRODUCT = None
980 _DISCO_API_PARAMS = None
982 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
983 headers.update({
984 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
985 'x-disco-client': f'WEB:UNKNOWN:dplus_us:{self._DISCO_CLIENT_VER}',
986 'Authorization': self._get_auth(disco_base, display_id, realm),
989 def _real_extract(self, url):
990 video_id, country = self._match_valid_url(url).group('id', 'country')
991 if not country:
992 country = 'us'
994 self._PRODUCT = f'dplus_{country}'
996 if country in ('br', 'ca', 'us'):
997 self._DISCO_API_PARAMS = {
998 'disco_host': 'us1-prod-direct.discoveryplus.com',
999 'realm': 'go',
1000 'country': country,
1002 else:
1003 self._DISCO_API_PARAMS = {
1004 'disco_host': 'eu1-prod-direct.discoveryplus.com',
1005 'realm': 'dplay',
1006 'country': country,
1009 return self._get_disco_api_info(url, video_id, **self._DISCO_API_PARAMS)
1012 class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
1013 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/videos?' + DPlayBaseIE._PATH_REGEX
1014 _TESTS = [{
1015 'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
1016 'info_dict': {
1017 'id': '27104',
1018 'ext': 'mp4',
1019 'display_id': 'how-do-they-do-it/fugu-and-more',
1020 'title': 'Fugu and More',
1021 'description': 'The Japanese catch, prepare and eat the deadliest fish on the planet.',
1022 'duration': 1319.32,
1023 'timestamp': 1582309800,
1024 'upload_date': '20200221',
1025 'series': 'How Do They Do It?',
1026 'season_number': 8,
1027 'episode_number': 2,
1028 'creator': 'Discovery Channel',
1029 'thumbnail': r're:https://.+\.jpeg',
1030 'episode': 'Episode 2',
1031 'season': 'Season 8',
1032 'tags': [],
1034 'params': {
1035 'skip_download': True,
1039 _PRODUCT = 'dplus-india'
1040 _DISCO_API_PARAMS = {
1041 'disco_host': 'ap2-prod-direct.discoveryplus.in',
1042 'realm': 'dplusindia',
1043 'country': 'in',
1044 'domain': 'https://www.discoveryplus.in/',
1047 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1048 headers.update({
1049 'x-disco-params': f'realm={realm}',
1050 'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
1051 'Authorization': self._get_auth(disco_base, display_id, realm),
1055 class DiscoveryNetworksDeIE(DiscoveryPlusBaseIE):
1056 _VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
1058 _TESTS = [{
1059 'url': 'https://dmax.de/sendungen/goldrausch-in-australien/german-gold',
1060 'info_dict': {
1061 'id': '4756322',
1062 'ext': 'mp4',
1063 'title': 'German Gold',
1064 'description': 'md5:f3073306553a8d9b40e6ac4cdbf09fc6',
1065 'display_id': 'goldrausch-in-australien/german-gold',
1066 'episode': 'Episode 1',
1067 'episode_number': 1,
1068 'season': 'Season 5',
1069 'season_number': 5,
1070 'series': 'Goldrausch in Australien',
1071 'duration': 2648.0,
1072 'upload_date': '20230517',
1073 'timestamp': 1684357500,
1074 'creators': ['DMAX'],
1075 'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/05/09/f72fb510-7992-3b12-af7f-f16a2c22d1e3.jpeg',
1076 'tags': ['schatzsucher', 'schatz', 'nugget', 'bodenschätze', 'down under', 'australien', 'goldrausch'],
1078 'params': {'skip_download': 'm3u8'},
1079 }, {
1080 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
1081 'info_dict': {
1082 'id': '78867',
1083 'ext': 'mp4',
1084 'title': 'Die Welt da draußen',
1085 'description': 'md5:61033c12b73286e409d99a41742ef608',
1086 'timestamp': 1554069600,
1087 'upload_date': '20190331',
1088 'creator': 'TLC',
1089 'season': 'Season 1',
1090 'series': 'Breaking Amish',
1091 'episode_number': 1,
1092 'tags': ['new york', 'großstadt', 'amische', 'landleben', 'modern', 'infos', 'tradition', 'herausforderung'],
1093 'display_id': 'breaking-amish/die-welt-da-drauen',
1094 'episode': 'Episode 1',
1095 'duration': 2625.024,
1096 'season_number': 1,
1097 'thumbnail': r're:https://.+\.jpg',
1099 'skip': '404 Not Found',
1100 }, {
1101 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
1102 'only_matching': True,
1103 }, {
1104 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
1105 'only_matching': True,
1106 }, {
1107 'url': 'https://tlc.de/sendungen/breaking-amish/die-welt-da-drauen/',
1108 'only_matching': True,
1111 def _real_extract(self, url):
1112 domain, programme, alternate_id = self._match_valid_url(url).groups()
1113 country = 'GB' if domain == 'dplay.co.uk' else 'DE'
1114 realm = 'questuk' if country == 'GB' else domain.replace('.', '')
1115 return self._get_disco_api_info(
1116 url, f'{programme}/{alternate_id}', 'eu1-prod.disco-api.com', realm, country)
1118 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1119 headers.update({
1120 'x-disco-params': f'realm={realm}',
1121 'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
1122 'Authorization': self._get_auth(disco_base, display_id, realm),
1126 class DiscoveryPlusShowBaseIE(DPlayBaseIE):
1128 def _entries(self, show_name):
1129 headers = {
1130 'x-disco-client': self._X_CLIENT,
1131 'x-disco-params': f'realm={self._REALM}',
1132 'referer': self._DOMAIN,
1133 'Authentication': self._get_auth(self._BASE_API, None, self._REALM),
1135 show_json = self._download_json(
1136 f'{self._BASE_API}cms/routes/{self._SHOW_STR}/{show_name}?include=default',
1137 video_id=show_name, headers=headers)['included'][self._INDEX]['attributes']['component']
1138 show_id = show_json['mandatoryParams'].split('=')[-1]
1139 season_url = self._BASE_API + 'content/videos?sort=episodeNumber&filter[seasonNumber]={}&filter[show.id]={}&page[size]=100&page[number]={}'
1140 for season in show_json['filters'][0]['options']:
1141 season_id = season['id']
1142 total_pages, page_num = 1, 0
1143 while page_num < total_pages:
1144 season_json = self._download_json(
1145 season_url.format(season_id, show_id, str(page_num + 1)), show_name, headers=headers,
1146 note='Downloading season {} JSON metadata{}'.format(season_id, f' page {page_num}' if page_num else ''))
1147 if page_num == 0:
1148 total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
1149 episodes_json = season_json['data']
1150 for episode in episodes_json:
1151 video_path = episode['attributes']['path']
1152 yield self.url_result(
1153 f'{self._DOMAIN}videos/{video_path}',
1154 ie=self._VIDEO_IE.ie_key(), video_id=episode.get('id') or video_path)
1155 page_num += 1
1157 def _real_extract(self, url):
1158 show_name = self._match_valid_url(url).group('show_name')
1159 return self.playlist_result(self._entries(show_name), playlist_id=show_name)
1162 class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE):
1163 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/it/video(?:/sport|/olympics)?' + DPlayBaseIE._PATH_REGEX
1164 _TESTS = [{
1165 'url': 'https://www.discoveryplus.com/it/video/i-signori-della-neve/stagione-2-episodio-1-i-preparativi',
1166 'only_matching': True,
1167 }, {
1168 'url': 'https://www.discoveryplus.com/it/video/super-benny/trailer',
1169 'only_matching': True,
1170 }, {
1171 'url': 'https://www.discoveryplus.com/it/video/olympics/dplus-sport-dplus-sport-sport/water-polo-greece-italy',
1172 'only_matching': True,
1173 }, {
1174 'url': 'https://www.discoveryplus.com/it/video/sport/dplus-sport-dplus-sport-sport/lisa-vittozzi-allinferno-e-ritorno',
1175 'only_matching': True,
1178 _PRODUCT = 'dplus_it'
1179 _DISCO_API_PARAMS = {
1180 'disco_host': 'eu1-prod-direct.discoveryplus.com',
1181 'realm': 'dplay',
1182 'country': 'it',
1185 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1186 headers.update({
1187 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
1188 'x-disco-client': f'WEB:UNKNOWN:dplus_us:{self._DISCO_CLIENT_VER}',
1189 'Authorization': self._get_auth(disco_base, display_id, realm),
1193 class DiscoveryPlusItalyShowIE(DiscoveryPlusShowBaseIE):
1194 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.it/programmi/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1195 _TESTS = [{
1196 'url': 'https://www.discoveryplus.it/programmi/deal-with-it-stai-al-gioco',
1197 'playlist_mincount': 168,
1198 'info_dict': {
1199 'id': 'deal-with-it-stai-al-gioco',
1203 _BASE_API = 'https://disco-api.discoveryplus.it/'
1204 _DOMAIN = 'https://www.discoveryplus.it/'
1205 _X_CLIENT = 'WEB:UNKNOWN:dplay-client:2.6.0'
1206 _REALM = 'dplayit'
1207 _SHOW_STR = 'programmi'
1208 _INDEX = 1
1209 _VIDEO_IE = DPlayIE
1212 class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE):
1213 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1214 _TESTS = [{
1215 'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
1216 'playlist_mincount': 140,
1217 'info_dict': {
1218 'id': 'how-do-they-do-it',
1222 _BASE_API = 'https://ap2-prod-direct.discoveryplus.in/'
1223 _DOMAIN = 'https://www.discoveryplus.in/'
1224 _X_CLIENT = 'WEB:UNKNOWN:dplus-india:prod'
1225 _REALM = 'dplusindia'
1226 _SHOW_STR = 'show'
1227 _INDEX = 4
1228 _VIDEO_IE = DiscoveryPlusIndiaIE