[ie/dplay] Fix extractors (#10471)
[yt-dlp3.git] / yt_dlp / extractor / dplay.py
blobe9f9357ad61df0b93c7325e3b692a7f800c8bbcc
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 HGTVDeIE(DPlayBaseIE):
323 _VALID_URL = r'https?://de\.hgtv\.com/sendungen' + DPlayBaseIE._PATH_REGEX
324 _TESTS = [{
325 'url': 'https://de.hgtv.com/sendungen/tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette/',
326 'info_dict': {
327 'id': '151205',
328 'display_id': 'tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette',
329 'ext': 'mp4',
330 'title': 'Wer braucht schon eine Toilette',
331 'description': 'md5:05b40a27e7aed2c9172de34d459134e2',
332 'duration': 1177.024,
333 'timestamp': 1595705400,
334 'upload_date': '20200725',
335 'creator': 'HGTV',
336 'series': 'Tiny House - klein, aber oho',
337 'season_number': 3,
338 'episode_number': 3,
342 def _real_extract(self, url):
343 display_id = self._match_id(url)
344 return self._get_disco_api_info(
345 url, display_id, 'eu1-prod.disco-api.com', 'hgtv', 'de')
348 class DiscoveryPlusBaseIE(DPlayBaseIE):
349 """Subclasses must set _PRODUCT, _DISCO_API_PARAMS"""
351 _DISCO_CLIENT_VER = '27.43.0'
353 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
354 headers.update({
355 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
356 'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:{self._DISCO_CLIENT_VER}',
357 'Authorization': self._get_auth(disco_base, display_id, realm),
360 def _download_video_playback_info(self, disco_base, video_id, headers):
361 return self._download_json(
362 disco_base + 'playback/v3/videoPlaybackInfo',
363 video_id, headers=headers, data=json.dumps({
364 'deviceInfo': {
365 'adBlocker': False,
366 'drmSupported': False,
368 'videoId': video_id,
369 'wisteriaProperties': {},
370 }).encode())['data']['attributes']['streaming']
372 def _real_extract(self, url):
373 return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PARAMS)
376 class GoDiscoveryIE(DiscoveryPlusBaseIE):
377 _VALID_URL = r'https?://(?:go\.)?discovery\.com/video' + DPlayBaseIE._PATH_REGEX
378 _TESTS = [{
379 'url': 'https://go.discovery.com/video/in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
380 'info_dict': {
381 'id': '5352642',
382 'display_id': 'in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
383 'ext': 'mp4',
384 'title': 'Trapped in a Twister',
385 'description': 'Twisters destroy Midwest towns, trapping spotters in the eye of the storm.',
386 'episode_number': 1,
387 'episode': 'Episode 1',
388 'season_number': 1,
389 'season': 'Season 1',
390 'series': 'In The Eye Of The Storm',
391 'duration': 2490.237,
392 'upload_date': '20240715',
393 'timestamp': 1721008800,
394 'tags': [],
395 'creators': ['Discovery'],
396 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/10/5e39637d-cabf-3ab3-8e9a-f4e9d37bc036.jpeg',
398 }, {
399 'url': 'https://go.discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
400 'info_dict': {
401 'id': '4164906',
402 'display_id': 'dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
403 'ext': 'mp4',
404 'title': 'Rodbuster / Galvanizer',
405 'description': 'Mike installs rebar with a team of rodbusters, then he galvanizes steel.',
406 'season_number': 9,
407 'episode_number': 1,
409 'skip': 'Available for Premium users',
410 }, {
411 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
412 'only_matching': True,
415 _PRODUCT = 'dsc'
416 _DISCO_API_PARAMS = {
417 'disco_host': 'us1-prod-direct.go.discovery.com',
418 'realm': 'go',
419 'country': 'us',
423 class TravelChannelIE(DiscoveryPlusBaseIE):
424 _VALID_URL = r'https?://(?:watch\.)?travelchannel\.com/video' + DPlayBaseIE._PATH_REGEX
425 _TESTS = [{
426 'url': 'https://watch.travelchannel.com/video/the-dead-files-travel-channel/protect-the-children',
427 'info_dict': {
428 'id': '4710177',
429 'display_id': 'the-dead-files-travel-channel/protect-the-children',
430 'ext': 'mp4',
431 'title': 'Protect the Children',
432 'description': 'An evil presence threatens an Ohio woman\'s children and marriage.',
433 'season_number': 14,
434 'season': 'Season 14',
435 'episode_number': 10,
436 'episode': 'Episode 10',
437 'series': 'The Dead Files',
438 'duration': 2550.481,
439 'timestamp': 1664510400,
440 'upload_date': '20220930',
441 'tags': [],
442 'creators': ['Travel Channel'],
443 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/17/5e45eace-de5d-343a-9293-f400a2aa77d5.jpeg',
445 }, {
446 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
447 'info_dict': {
448 'id': '2220256',
449 'display_id': 'ghost-adventures-travel-channel/ghost-train-of-ely',
450 'ext': 'mp4',
451 'title': 'Ghost Train of Ely',
452 'description': 'The crew investigates the dark history of the Nevada Northern Railway.',
453 'season_number': 24,
454 'episode_number': 1,
456 'skip': 'Available for Premium users',
457 }, {
458 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
459 'only_matching': True,
462 _PRODUCT = 'trav'
463 _DISCO_API_PARAMS = {
464 'disco_host': 'us1-prod-direct.watch.travelchannel.com',
465 'realm': 'go',
466 'country': 'us',
470 class CookingChannelIE(DiscoveryPlusBaseIE):
471 _VALID_URL = r'https?://(?:watch\.)?cookingchanneltv\.com/video' + DPlayBaseIE._PATH_REGEX
472 _TESTS = [{
473 'url': 'https://watch.cookingchanneltv.com/video/bobbys-triple-threat-food-network-atve-us/titans-vs-marcus-samuelsson',
474 'info_dict': {
475 'id': '5350005',
476 'ext': 'mp4',
477 'display_id': 'bobbys-triple-threat-food-network-atve-us/titans-vs-marcus-samuelsson',
478 'title': 'Titans vs Marcus Samuelsson',
479 'description': 'Marcus Samuelsson throws his legendary global tricks at the Titans.',
480 'episode_number': 1,
481 'episode': 'Episode 1',
482 'season_number': 3,
483 'season': 'Season 3',
484 'series': 'Bobby\'s Triple Threat',
485 'duration': 2520.851,
486 'upload_date': '20240710',
487 'timestamp': 1720573200,
488 'tags': [],
489 'creators': ['Food Network'],
490 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/04/529cd095-27ec-35c5-84e9-90ebd3e5d2da.jpeg',
492 }, {
493 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
494 'info_dict': {
495 'id': '2348634',
496 'display_id': 'carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
497 'ext': 'mp4',
498 'title': 'The Postman Always Brings Rice',
499 'description': 'Noah visits the Maui Fair and the Aurora Winter Festival in Vancouver.',
500 'season_number': 9,
501 'episode_number': 1,
503 'skip': 'Available for Premium users',
504 }, {
505 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
506 'only_matching': True,
509 _PRODUCT = 'cook'
510 _DISCO_API_PARAMS = {
511 'disco_host': 'us1-prod-direct.watch.cookingchanneltv.com',
512 'realm': 'go',
513 'country': 'us',
517 class HGTVUsaIE(DiscoveryPlusBaseIE):
518 _VALID_URL = r'https?://(?:watch\.)?hgtv\.com/video' + DPlayBaseIE._PATH_REGEX
519 _TESTS = [{
520 'url': 'https://watch.hgtv.com/video/flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
521 'info_dict': {
522 'id': '5025585',
523 'display_id': 'flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
524 'ext': 'mp4',
525 'title': 'Flip or Flop: The Final Flip',
526 'description': 'Tarek and Christina are going their separate ways after one last flip!',
527 'series': 'Flip or Flop: The Final Flip',
528 'duration': 2580.644,
529 'upload_date': '20231101',
530 'timestamp': 1698811200,
531 'tags': [],
532 'creators': ['HGTV'],
533 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/11/27/455caa6c-1462-3f14-b63d-a026d7a5e6d3.jpeg',
535 }, {
536 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
537 'info_dict': {
538 'id': '4289736',
539 'display_id': 'home-inspector-joe-hgtv-atve-us/this-mold-house',
540 'ext': 'mp4',
541 'title': 'This Mold House',
542 'description': 'Joe and Noel help take a familys dream home from hazardous to fabulous.',
543 'season_number': 1,
544 'episode_number': 1,
546 'skip': 'Available for Premium users',
547 }, {
548 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
549 'only_matching': True,
552 _PRODUCT = 'hgtv'
553 _DISCO_API_PARAMS = {
554 'disco_host': 'us1-prod-direct.watch.hgtv.com',
555 'realm': 'go',
556 'country': 'us',
560 class FoodNetworkIE(DiscoveryPlusBaseIE):
561 _VALID_URL = r'https?://(?:watch\.)?foodnetwork\.com/video' + DPlayBaseIE._PATH_REGEX
562 _TESTS = [{
563 'url': 'https://watch.foodnetwork.com/video/guys-grocery-games-food-network/wild-in-the-aisles',
564 'info_dict': {
565 'id': '2152549',
566 'display_id': 'guys-grocery-games-food-network/wild-in-the-aisles',
567 'ext': 'mp4',
568 'title': 'Wild in the Aisles',
569 'description': 'The chefs make spaghetti and meatballs with "Out of Stock" ingredients.',
570 'season_number': 1,
571 'season': 'Season 1',
572 'episode_number': 1,
573 'episode': 'Episode 1',
574 'series': 'Guy\'s Grocery Games',
575 'tags': [],
576 'creators': ['Food Network'],
577 'duration': 2520.651,
578 'upload_date': '20230623',
579 'timestamp': 1687492800,
580 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/06/15/37fb5333-cad2-3dbb-af7c-c20ec77c89c6.jpeg',
582 }, {
583 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
584 'info_dict': {
585 'id': '4116449',
586 'display_id': 'kids-baking-championship-food-network/float-like-a-butterfly',
587 'ext': 'mp4',
588 'title': 'Float Like a Butterfly',
589 'description': 'The 12 kid bakers create colorful carved butterfly cakes.',
590 'season_number': 10,
591 'episode_number': 1,
593 'skip': 'Available for Premium users',
594 }, {
595 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
596 'only_matching': True,
599 _PRODUCT = 'food'
600 _DISCO_API_PARAMS = {
601 'disco_host': 'us1-prod-direct.watch.foodnetwork.com',
602 'realm': 'go',
603 'country': 'us',
607 class DestinationAmericaIE(DiscoveryPlusBaseIE):
608 _VALID_URL = r'https?://(?:www\.)?destinationamerica\.com/video' + DPlayBaseIE._PATH_REGEX
609 _TESTS = [{
610 'url': 'https://www.destinationamerica.com/video/bbq-pit-wars-destination-america/smoke-on-the-water',
611 'info_dict': {
612 'id': '2218409',
613 'display_id': 'bbq-pit-wars-destination-america/smoke-on-the-water',
614 'ext': 'mp4',
615 'title': 'Smoke on the Water',
616 'description': 'The pitmasters head to Georgia for the Smoke on the Water BBQ Festival.',
617 'season_number': 2,
618 'season': 'Season 2',
619 'episode_number': 1,
620 'episode': 'Episode 1',
621 'series': 'BBQ Pit Wars',
622 'tags': [],
623 'creators': ['Destination America'],
624 'duration': 2614.878,
625 'upload_date': '20230623',
626 'timestamp': 1687492800,
627 'thumbnail': 'https://us1-prod-images.disco-api.com/2020/05/11/c0f8e85d-9a10-3e6f-8e43-f6faafa81ba2.jpeg',
629 }, {
630 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
631 'info_dict': {
632 'id': '4210904',
633 'display_id': 'alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
634 'ext': 'mp4',
635 'title': 'Central Alaskas Bigfoot',
636 'description': 'A team heads to central Alaska to investigate an aggressive Bigfoot.',
637 'season_number': 1,
638 'episode_number': 1,
640 'skip': 'Available for Premium users',
641 }, {
642 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
643 'only_matching': True,
646 _PRODUCT = 'dam'
647 _DISCO_API_PARAMS = {
648 'disco_host': 'us1-prod-direct.destinationamerica.com',
649 'realm': 'go',
650 'country': 'us',
654 class InvestigationDiscoveryIE(DiscoveryPlusBaseIE):
655 _VALID_URL = r'https?://(?:www\.)?investigationdiscovery\.com/video' + DPlayBaseIE._PATH_REGEX
656 _TESTS = [{
657 'url': 'https://www.investigationdiscovery.com/video/deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
658 'info_dict': {
659 'id': '5341132',
660 'display_id': 'deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
661 'ext': 'mp4',
662 'title': 'RIP Bianca',
663 'description': 'A teenage influencer discovers an online world of threat, harm and danger.',
664 'season_number': 1,
665 'season': 'Season 1',
666 'episode_number': 3,
667 'episode': 'Episode 3',
668 'series': 'Deadly Influence: The Social Media Murders',
669 'creators': ['Investigation Discovery'],
670 'tags': [],
671 'duration': 2490.888,
672 'upload_date': '20240618',
673 'timestamp': 1718672400,
674 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/06/15/b567c774-9e44-3c6c-b0ba-db860a73e812.jpeg',
676 }, {
677 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
678 'info_dict': {
679 'id': '2139409',
680 'display_id': 'unmasked-investigation-discovery/the-killer-clown',
681 'ext': 'mp4',
682 'title': 'The Killer Clown',
683 'description': 'A wealthy Florida woman is fatally shot in the face by a clown at her door.',
684 'season_number': 1,
685 'episode_number': 1,
687 'skip': 'Available for Premium users',
688 }, {
689 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
690 'only_matching': True,
693 _PRODUCT = 'ids'
694 _DISCO_API_PARAMS = {
695 'disco_host': 'us1-prod-direct.investigationdiscovery.com',
696 'realm': 'go',
697 'country': 'us',
701 class AmHistoryChannelIE(DiscoveryPlusBaseIE):
702 _VALID_URL = r'https?://(?:www\.)?ahctv\.com/video' + DPlayBaseIE._PATH_REGEX
703 _TESTS = [{
704 'url': 'https://www.ahctv.com/video/blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
705 'info_dict': {
706 'id': '2139199',
707 'display_id': 'blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
708 'ext': 'mp4',
709 'title': 'Battle of Bull Run',
710 'description': 'Two untested armies clash in the first real battle of the Civil War.',
711 'season_number': 1,
712 'season': 'Season 1',
713 'episode_number': 1,
714 'episode': 'Episode 1',
715 'series': 'Blood and Fury: America\'s Civil War',
716 'duration': 2612.509,
717 'upload_date': '20220923',
718 'timestamp': 1663905600,
719 'creators': ['AHC'],
720 'tags': [],
721 'thumbnail': 'https://us1-prod-images.disco-api.com/2020/05/11/4af61bd7-d705-3108-82c4-1a6e541e20fa.jpeg',
723 }, {
724 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
725 'info_dict': {
726 'id': '2309730',
727 'display_id': 'modern-sniper-ahc/army',
728 'ext': 'mp4',
729 'title': 'Army',
730 'description': 'Snipers today face challenges their predecessors couldve only dreamed of.',
731 'season_number': 1,
732 'episode_number': 1,
734 'skip': 'Available for Premium users',
735 }, {
736 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
737 'only_matching': True,
740 _PRODUCT = 'ahc'
741 _DISCO_API_PARAMS = {
742 'disco_host': 'us1-prod-direct.ahctv.com',
743 'realm': 'go',
744 'country': 'us',
748 class ScienceChannelIE(DiscoveryPlusBaseIE):
749 _VALID_URL = r'https?://(?:www\.)?sciencechannel\.com/video' + DPlayBaseIE._PATH_REGEX
750 _TESTS = [{
751 'url': 'https://www.sciencechannel.com/video/spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
752 'info_dict': {
753 'id': '2347335',
754 'display_id': 'spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
755 'ext': 'mp4',
756 'title': 'Mystery of the Dead Planets',
757 'description': 'Astronomers unmask the truly destructive nature of the cosmos.',
758 'season_number': 7,
759 'season': 'Season 7',
760 'episode_number': 1,
761 'episode': 'Episode 1',
762 'series': 'Space\'s Deepest Secrets',
763 'duration': 2524.989,
764 'upload_date': '20230128',
765 'timestamp': 1674882000,
766 'creators': ['Science'],
767 'tags': [],
768 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/30/3796829d-aead-3f9a-bd8d-e49048b3cdca.jpeg',
770 }, {
771 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
772 'info_dict': {
773 'id': '2842849',
774 'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
775 'ext': 'mp4',
776 'title': 'Nazi Mystery Machine',
777 'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
778 'season_number': 1,
779 'episode_number': 1,
781 'skip': 'Available for Premium users',
782 }, {
783 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
784 'only_matching': True,
787 _PRODUCT = 'sci'
788 _DISCO_API_PARAMS = {
789 'disco_host': 'us1-prod-direct.sciencechannel.com',
790 'realm': 'go',
791 'country': 'us',
795 class DiscoveryLifeIE(DiscoveryPlusBaseIE):
796 _VALID_URL = r'https?://(?:www\.)?discoverylife\.com/video' + DPlayBaseIE._PATH_REGEX
797 _TESTS = [{
798 'url': 'https://www.discoverylife.com/video/er-files-discovery-life-atve-us/sweet-charity',
799 'info_dict': {
800 'id': '2347614',
801 'display_id': 'er-files-discovery-life-atve-us/sweet-charity',
802 'ext': 'mp4',
803 'title': 'Sweet Charity',
804 'description': 'The staff at Charity Hospital treat a serious foot infection.',
805 'season_number': 1,
806 'season': 'Season 1',
807 'episode_number': 1,
808 'episode': 'Episode 1',
809 'series': 'ER Files',
810 'duration': 2364.261,
811 'upload_date': '20230721',
812 'timestamp': 1689912000,
813 'creators': ['Discovery Life'],
814 'tags': [],
815 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/16/4b6f0124-360b-3546-b6a4-5552db886b86.jpeg',
817 }, {
818 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
819 'info_dict': {
820 'id': '2218238',
821 'display_id': 'surviving-death-discovery-life-atve-us/bodily-trauma',
822 'ext': 'mp4',
823 'title': 'Bodily Trauma',
824 'description': 'Meet three people who tested the limits of the human body.',
825 'season_number': 1,
826 'episode_number': 2,
828 'skip': 'Available for Premium users',
829 }, {
830 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
831 'only_matching': True,
834 _PRODUCT = 'dlf'
835 _DISCO_API_PARAMS = {
836 'disco_host': 'us1-prod-direct.discoverylife.com',
837 'realm': 'go',
838 'country': 'us',
842 class AnimalPlanetIE(DiscoveryPlusBaseIE):
843 _VALID_URL = r'https?://(?:www\.)?animalplanet\.com/video' + DPlayBaseIE._PATH_REGEX
844 _TESTS = [{
845 'url': 'https://www.animalplanet.com/video/mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
846 'info_dict': {
847 'id': '4650835',
848 'display_id': 'mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
849 'ext': 'mp4',
850 'title': 'The Demon of Peru',
851 'description': 'In Peru, a farming village is being terrorized by a “man-like beast.”',
852 'season_number': 1,
853 'season': 'Season 1',
854 'episode_number': 4,
855 'episode': 'Episode 4',
856 'series': 'Mysterious Creatures with Forrest Galante',
857 'duration': 2490.488,
858 'upload_date': '20230111',
859 'timestamp': 1673413200,
860 'creators': ['Animal Planet'],
861 'tags': [],
862 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/01/6dbaa833-9a2e-3fee-9381-c19eddf67c0c.jpeg',
864 }, {
865 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
866 'info_dict': {
867 'id': '3338923',
868 'display_id': 'north-woods-law-animal-planet/squirrel-showdown',
869 'ext': 'mp4',
870 'title': 'Squirrel Showdown',
871 'description': 'A woman is suspected of being in possession of flying squirrel kits.',
872 'season_number': 16,
873 'episode_number': 11,
875 'skip': 'Available for Premium users',
876 }, {
877 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
878 'only_matching': True,
881 _PRODUCT = 'apl'
882 _DISCO_API_PARAMS = {
883 'disco_host': 'us1-prod-direct.animalplanet.com',
884 'realm': 'go',
885 'country': 'us',
889 class TLCIE(DiscoveryPlusBaseIE):
890 _VALID_URL = r'https?://(?:go\.)?tlc\.com/video' + DPlayBaseIE._PATH_REGEX
891 _TESTS = [{
892 'url': 'https://go.tlc.com/video/90-day-the-last-resort-tlc-atve-us/the-last-chance',
893 'info_dict': {
894 'id': '5186422',
895 'display_id': '90-day-the-last-resort-tlc-atve-us/the-last-chance',
896 'ext': 'mp4',
897 'title': 'The Last Chance',
898 'description': 'Infidelity shakes Kalani and Asuelu\'s world, and Angela threatens divorce.',
899 'season_number': 1,
900 'season': 'Season 1',
901 'episode_number': 1,
902 'episode': 'Episode 1',
903 'series': '90 Day: The Last Resort',
904 'duration': 5123.91,
905 'upload_date': '20230815',
906 'timestamp': 1692061200,
907 'creators': ['TLC'],
908 'tags': [],
909 'thumbnail': 'https://us1-prod-images.disco-api.com/2023/08/08/0ee367e2-ac76-334d-bf23-dbf796696a24.jpeg',
911 }, {
912 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
913 'info_dict': {
914 'id': '2206540',
915 'display_id': 'my-600-lb-life-tlc/melissas-story-part-1',
916 'ext': 'mp4',
917 'title': 'Melissas Story (Part 1)',
918 'description': 'At 650 lbs, Melissa is ready to begin her seven-year weight loss journey.',
919 'season_number': 1,
920 'episode_number': 1,
922 'skip': 'Available for Premium users',
923 }, {
924 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
925 'only_matching': True,
928 _PRODUCT = 'tlc'
929 _DISCO_API_PARAMS = {
930 'disco_host': 'us1-prod-direct.tlc.com',
931 'realm': 'go',
932 'country': 'us',
936 class DiscoveryPlusIE(DiscoveryPlusBaseIE):
937 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/(?!it/)(?:(?P<country>[a-z]{2})/)?video(?:/sport)?' + DPlayBaseIE._PATH_REGEX
938 _TESTS = [{
939 'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
940 'info_dict': {
941 'id': '1140794',
942 'display_id': 'property-brothers-forever-home/food-and-family',
943 'ext': 'mp4',
944 'title': 'Food and Family',
945 'description': 'The brothers help a Richmond family expand their single-level home.',
946 'duration': 2583.113,
947 'timestamp': 1609304400,
948 'upload_date': '20201230',
949 'creator': 'HGTV',
950 'series': 'Property Brothers: Forever Home',
951 'season_number': 1,
952 'episode_number': 1,
954 'skip': 'Available for Premium users',
955 }, {
956 'url': 'https://discoveryplus.com/ca/video/bering-sea-gold-discovery-ca/goldslingers',
957 'only_matching': True,
958 }, {
959 'url': 'https://www.discoveryplus.com/gb/video/sport/eurosport-1-british-eurosport-1-british-sport/6-hours-of-spa-review',
960 'only_matching': True,
963 _PRODUCT = None
964 _DISCO_API_PARAMS = None
966 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
967 headers.update({
968 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
969 'x-disco-client': f'WEB:UNKNOWN:dplus_us:{self._DISCO_CLIENT_VER}',
970 'Authorization': self._get_auth(disco_base, display_id, realm),
973 def _real_extract(self, url):
974 video_id, country = self._match_valid_url(url).group('id', 'country')
975 if not country:
976 country = 'us'
978 self._PRODUCT = f'dplus_{country}'
980 if country in ('br', 'ca', 'us'):
981 self._DISCO_API_PARAMS = {
982 'disco_host': 'us1-prod-direct.discoveryplus.com',
983 'realm': 'go',
984 'country': country,
986 else:
987 self._DISCO_API_PARAMS = {
988 'disco_host': 'eu1-prod-direct.discoveryplus.com',
989 'realm': 'dplay',
990 'country': country,
993 return self._get_disco_api_info(url, video_id, **self._DISCO_API_PARAMS)
996 class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
997 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/videos?' + DPlayBaseIE._PATH_REGEX
998 _TESTS = [{
999 'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
1000 'info_dict': {
1001 'id': '27104',
1002 'ext': 'mp4',
1003 'display_id': 'how-do-they-do-it/fugu-and-more',
1004 'title': 'Fugu and More',
1005 'description': 'The Japanese catch, prepare and eat the deadliest fish on the planet.',
1006 'duration': 1319.32,
1007 'timestamp': 1582309800,
1008 'upload_date': '20200221',
1009 'series': 'How Do They Do It?',
1010 'season_number': 8,
1011 'episode_number': 2,
1012 'creator': 'Discovery Channel',
1013 'thumbnail': r're:https://.+\.jpeg',
1014 'episode': 'Episode 2',
1015 'season': 'Season 8',
1016 'tags': [],
1018 'params': {
1019 'skip_download': True,
1023 _PRODUCT = 'dplus-india'
1024 _DISCO_API_PARAMS = {
1025 'disco_host': 'ap2-prod-direct.discoveryplus.in',
1026 'realm': 'dplusindia',
1027 'country': 'in',
1028 'domain': 'https://www.discoveryplus.in/',
1031 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1032 headers.update({
1033 'x-disco-params': f'realm={realm}',
1034 'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
1035 'Authorization': self._get_auth(disco_base, display_id, realm),
1039 class DiscoveryNetworksDeIE(DiscoveryPlusBaseIE):
1040 _VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
1042 _TESTS = [{
1043 'url': 'https://dmax.de/sendungen/goldrausch-in-australien/german-gold',
1044 'info_dict': {
1045 'id': '4756322',
1046 'ext': 'mp4',
1047 'title': 'German Gold',
1048 'description': 'md5:f3073306553a8d9b40e6ac4cdbf09fc6',
1049 'display_id': 'goldrausch-in-australien/german-gold',
1050 'episode': 'Episode 1',
1051 'episode_number': 1,
1052 'season': 'Season 5',
1053 'season_number': 5,
1054 'series': 'Goldrausch in Australien',
1055 'duration': 2648.0,
1056 'upload_date': '20230517',
1057 'timestamp': 1684357500,
1058 'creators': ['DMAX'],
1059 'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/05/09/f72fb510-7992-3b12-af7f-f16a2c22d1e3.jpeg',
1060 'tags': ['schatzsucher', 'schatz', 'nugget', 'bodenschätze', 'down under', 'australien', 'goldrausch'],
1062 'params': {'skip_download': 'm3u8'},
1063 }, {
1064 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
1065 'info_dict': {
1066 'id': '78867',
1067 'ext': 'mp4',
1068 'title': 'Die Welt da draußen',
1069 'description': 'md5:61033c12b73286e409d99a41742ef608',
1070 'timestamp': 1554069600,
1071 'upload_date': '20190331',
1072 'creator': 'TLC',
1073 'season': 'Season 1',
1074 'series': 'Breaking Amish',
1075 'episode_number': 1,
1076 'tags': ['new york', 'großstadt', 'amische', 'landleben', 'modern', 'infos', 'tradition', 'herausforderung'],
1077 'display_id': 'breaking-amish/die-welt-da-drauen',
1078 'episode': 'Episode 1',
1079 'duration': 2625.024,
1080 'season_number': 1,
1081 'thumbnail': r're:https://.+\.jpg',
1083 'skip': '404 Not Found',
1084 }, {
1085 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
1086 'only_matching': True,
1087 }, {
1088 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
1089 'only_matching': True,
1090 }, {
1091 'url': 'https://tlc.de/sendungen/breaking-amish/die-welt-da-drauen/',
1092 'only_matching': True,
1095 def _real_extract(self, url):
1096 domain, programme, alternate_id = self._match_valid_url(url).groups()
1097 country = 'GB' if domain == 'dplay.co.uk' else 'DE'
1098 realm = 'questuk' if country == 'GB' else domain.replace('.', '')
1099 return self._get_disco_api_info(
1100 url, f'{programme}/{alternate_id}', 'eu1-prod.disco-api.com', realm, country)
1102 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1103 headers.update({
1104 'x-disco-params': f'realm={realm}',
1105 'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
1106 'Authorization': self._get_auth(disco_base, display_id, realm),
1110 class DiscoveryPlusShowBaseIE(DPlayBaseIE):
1112 def _entries(self, show_name):
1113 headers = {
1114 'x-disco-client': self._X_CLIENT,
1115 'x-disco-params': f'realm={self._REALM}',
1116 'referer': self._DOMAIN,
1117 'Authentication': self._get_auth(self._BASE_API, None, self._REALM),
1119 show_json = self._download_json(
1120 f'{self._BASE_API}cms/routes/{self._SHOW_STR}/{show_name}?include=default',
1121 video_id=show_name, headers=headers)['included'][self._INDEX]['attributes']['component']
1122 show_id = show_json['mandatoryParams'].split('=')[-1]
1123 season_url = self._BASE_API + 'content/videos?sort=episodeNumber&filter[seasonNumber]={}&filter[show.id]={}&page[size]=100&page[number]={}'
1124 for season in show_json['filters'][0]['options']:
1125 season_id = season['id']
1126 total_pages, page_num = 1, 0
1127 while page_num < total_pages:
1128 season_json = self._download_json(
1129 season_url.format(season_id, show_id, str(page_num + 1)), show_name, headers=headers,
1130 note='Downloading season {} JSON metadata{}'.format(season_id, f' page {page_num}' if page_num else ''))
1131 if page_num == 0:
1132 total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
1133 episodes_json = season_json['data']
1134 for episode in episodes_json:
1135 video_path = episode['attributes']['path']
1136 yield self.url_result(
1137 f'{self._DOMAIN}videos/{video_path}',
1138 ie=self._VIDEO_IE.ie_key(), video_id=episode.get('id') or video_path)
1139 page_num += 1
1141 def _real_extract(self, url):
1142 show_name = self._match_valid_url(url).group('show_name')
1143 return self.playlist_result(self._entries(show_name), playlist_id=show_name)
1146 class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE):
1147 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/it/video' + DPlayBaseIE._PATH_REGEX
1148 _TESTS = [{
1149 'url': 'https://www.discoveryplus.com/it/video/i-signori-della-neve/stagione-2-episodio-1-i-preparativi',
1150 'only_matching': True,
1151 }, {
1152 'url': 'https://www.discoveryplus.com/it/video/super-benny/trailer',
1153 'only_matching': True,
1156 _PRODUCT = 'dplus_it'
1157 _DISCO_API_PARAMS = {
1158 'disco_host': 'eu1-prod-direct.discoveryplus.com',
1159 'realm': 'dplay',
1160 'country': 'it',
1163 def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
1164 headers.update({
1165 'x-disco-params': f'realm={realm},siteLookupKey={self._PRODUCT}',
1166 'x-disco-client': f'WEB:UNKNOWN:dplus_us:{self._DISCO_CLIENT_VER}',
1167 'Authorization': self._get_auth(disco_base, display_id, realm),
1171 class DiscoveryPlusItalyShowIE(DiscoveryPlusShowBaseIE):
1172 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.it/programmi/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1173 _TESTS = [{
1174 'url': 'https://www.discoveryplus.it/programmi/deal-with-it-stai-al-gioco',
1175 'playlist_mincount': 168,
1176 'info_dict': {
1177 'id': 'deal-with-it-stai-al-gioco',
1181 _BASE_API = 'https://disco-api.discoveryplus.it/'
1182 _DOMAIN = 'https://www.discoveryplus.it/'
1183 _X_CLIENT = 'WEB:UNKNOWN:dplay-client:2.6.0'
1184 _REALM = 'dplayit'
1185 _SHOW_STR = 'programmi'
1186 _INDEX = 1
1187 _VIDEO_IE = DPlayIE
1190 class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE):
1191 _VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1192 _TESTS = [{
1193 'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
1194 'playlist_mincount': 140,
1195 'info_dict': {
1196 'id': 'how-do-they-do-it',
1200 _BASE_API = 'https://ap2-prod-direct.discoveryplus.in/'
1201 _DOMAIN = 'https://www.discoveryplus.in/'
1202 _X_CLIENT = 'WEB:UNKNOWN:dplus-india:prod'
1203 _REALM = 'dplusindia'
1204 _SHOW_STR = 'show'
1205 _INDEX = 4
1206 _VIDEO_IE = DiscoveryPlusIndiaIE