4 from .common
import InfoExtractor
5 from ..networking
.exceptions
import HTTPError
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
)
28 query
= {'realm': realm
}
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'):
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']
60 for format_id
, format_dict
in streaming
.items():
61 streaming_list
.append({
63 'url': format_dict
.get('url'),
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}/'
77 self
._update
_disco
_api
_headers
(headers
, disco_base
, display_id
, realm
)
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
)
93 video_id
= video
['data']['id']
94 info
= video
['data']['attributes']
95 title
= info
['name'].strip()
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
)
105 for format_dict
in streaming
:
106 if not isinstance(format_dict
, dict):
108 format_url
= format_dict
.get('url')
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
_m
3u8_formats
_and
_subtitles
(
120 format_url
, display_id
, 'mp4',
121 entry_protocol
='m3u8_native', m3u8_id
='hls',
123 formats
.extend(m3u8_fmts
)
124 subtitles
= self
._merge
_subtitles
(subtitles
, m3u8_subs
)
128 'format_id': format_id
,
131 creator
= series
= None
134 included
= video
.get('included') or []
135 if isinstance(included
, list):
137 attributes
= e
.get('attributes')
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')
148 'width': int_or_none(attributes
.get('width')),
149 'height': int_or_none(attributes
.get('height')),
152 series
= attributes
.get('name')
153 elif e_type
== 'tag':
154 name
= attributes
.get('name')
159 'display_id': display_id
,
161 'description': strip_or_none(info
.get('description')),
162 'duration': float_or_none(info
.get('videoDuration'), 1000),
163 'timestamp': unified_timestamp(info
.get('publishStart')),
165 'season_number': int_or_none(info
.get('seasonNumber')),
166 'episode_number': int_or_none(info
.get('episodeNumber')),
169 'thumbnails': thumbnails
,
171 'subtitles': subtitles
,
178 class DPlayIE(DPlayBaseIE
):
179 _VALID_URL
= r
'''(?x)https?://
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
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',
195 'display_id': 'nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
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',
208 'skip_download': True,
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',
215 'display_id': 'ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
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',
228 'skip_download': True,
232 'url': 'https://www.dplay.no/videoer/i-kongens-klr/sesong-1-episode-7',
235 'display_id': 'i-kongens-klr/sesong-1-episode-7',
237 'title': 'Episode 7',
238 'description': 'md5:e3e1411b2b9aebeea36a6ec5d50c60cf',
240 'timestamp': 1516726800,
241 'upload_date': '20180123',
242 'series': 'I kongens klær',
247 'skip_download': True,
249 'skip': 'Available for Premium users',
251 'url': 'http://it.dplay.com/nove/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij/',
252 'md5': '2b808ffb00fc47b884a172ca5d13053c',
255 'display_id': 'biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
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',
264 'episode': 'Episode 1',
268 'url': 'https://es.dplay.com/dmax/la-fiebre-del-oro/temporada-8-episodio-1/',
271 'display_id': 'la-fiebre-del-oro/temporada-8-episodio-1',
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',
280 'episode': 'Episode 1',
284 'skip_download': True,
287 'url': 'https://www.dplay.fi/videot/shifting-gears-with-aaron-kaufman/episode-16',
288 'only_matching': True,
290 'url': 'https://www.dplay.jp/video/gold-rush/24086',
291 'only_matching': True,
293 'url': 'https://www.discoveryplus.se/videos/nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
294 'only_matching': True,
296 'url': 'https://www.discoveryplus.dk/videoer/ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
297 'only_matching': True,
299 'url': 'https://www.discoveryplus.no/videoer/i-kongens-klr/sesong-1-episode-7',
300 'only_matching': True,
302 'url': 'https://www.discoveryplus.it/videos/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
303 'only_matching': True,
305 'url': 'https://www.discoveryplus.es/videos/la-fiebre-del-oro/temporada-8-episodio-1',
306 'only_matching': True,
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
):
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({
340 'drmSupported': False,
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
353 'url': 'https://de.hgtv.com/sendungen/mein-kleinstadt-traumhaus/vom-landleben-ins-loft',
357 'display_id': 'mein-kleinstadt-traumhaus/vom-landleben-ins-loft',
358 'title': 'Vom Landleben ins Loft',
359 'description': 'md5:e5f72c02c853970796dd3818f2e25745',
360 'episode': 'Episode 7',
362 'season': 'Season 7',
364 'series': 'Mein Kleinstadt-Traumhaus',
366 'timestamp': 1725998100,
367 'upload_date': '20240910',
368 'creators': ['HGTV'],
370 'thumbnail': 'https://eu1-prod-images.disco-api.com/2024/08/09/82a386b9-c688-32c7-b9ff-0b13865f0bae.jpeg',
375 _DISCO_API_PARAMS
= {
376 'disco_host': 'eu1-prod.disco-api.com',
381 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
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
392 'url': 'https://go.discovery.com/video/in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
395 'display_id': 'in-the-eye-of-the-storm-discovery-atve-us/trapped-in-a-twister',
397 'title': 'Trapped in a Twister',
398 'description': 'Twisters destroy Midwest towns, trapping spotters in the eye of the storm.',
400 'episode': 'Episode 1',
402 'season': 'Season 1',
403 'series': 'In The Eye Of The Storm',
404 'duration': 2490.237,
405 'upload_date': '20240715',
406 'timestamp': 1721008800,
408 'creators': ['Discovery'],
409 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/10/5e39637d-cabf-3ab3-8e9a-f4e9d37bc036.jpeg',
412 'url': 'https://go.discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
415 'display_id': 'dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
417 'title': 'Rodbuster / Galvanizer',
418 'description': 'Mike installs rebar with a team of rodbusters, then he galvanizes steel.',
422 'skip': 'Available for Premium users',
424 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
425 'only_matching': True,
429 _DISCO_API_PARAMS
= {
430 'disco_host': 'us1-prod-direct.go.discovery.com',
436 class TravelChannelIE(DiscoveryPlusBaseIE
):
437 _VALID_URL
= r
'https?://(?:watch\.)?travelchannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
439 'url': 'https://watch.travelchannel.com/video/the-dead-files-travel-channel/protect-the-children',
442 'display_id': 'the-dead-files-travel-channel/protect-the-children',
444 'title': 'Protect the Children',
445 'description': 'An evil presence threatens an Ohio woman\'s children and marriage.',
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',
455 'creators': ['Travel Channel'],
456 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/17/5e45eace-de5d-343a-9293-f400a2aa77d5.jpeg',
459 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
462 'display_id': 'ghost-adventures-travel-channel/ghost-train-of-ely',
464 'title': 'Ghost Train of Ely',
465 'description': 'The crew investigates the dark history of the Nevada Northern Railway.',
469 'skip': 'Available for Premium users',
471 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
472 'only_matching': True,
476 _DISCO_API_PARAMS
= {
477 'disco_host': 'us1-prod-direct.watch.travelchannel.com',
483 class CookingChannelIE(DiscoveryPlusBaseIE
):
484 _VALID_URL
= r
'https?://(?:watch\.)?cookingchanneltv\.com/video' + DPlayBaseIE
._PATH
_REGEX
486 'url': 'https://watch.cookingchanneltv.com/video/bobbys-triple-threat-food-network-atve-us/titans-vs-marcus-samuelsson',
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.',
494 'episode': 'Episode 1',
496 'season': 'Season 3',
497 'series': 'Bobby\'s Triple Threat',
498 'duration': 2520.851,
499 'upload_date': '20240710',
500 'timestamp': 1720573200,
502 'creators': ['Food Network'],
503 'thumbnail': 'https://us1-prod-images.disco-api.com/2024/07/04/529cd095-27ec-35c5-84e9-90ebd3e5d2da.jpeg',
506 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
509 'display_id': 'carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
511 'title': 'The Postman Always Brings Rice',
512 'description': 'Noah visits the Maui Fair and the Aurora Winter Festival in Vancouver.',
516 'skip': 'Available for Premium users',
518 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
519 'only_matching': True,
523 _DISCO_API_PARAMS
= {
524 'disco_host': 'us1-prod-direct.watch.cookingchanneltv.com',
530 class HGTVUsaIE(DiscoveryPlusBaseIE
):
531 _VALID_URL
= r
'https?://(?:watch\.)?hgtv\.com/video' + DPlayBaseIE
._PATH
_REGEX
533 'url': 'https://watch.hgtv.com/video/flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
536 'display_id': 'flip-or-flop-the-final-flip-hgtv-atve-us/flip-or-flop-the-final-flip',
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,
545 'creators': ['HGTV'],
546 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/11/27/455caa6c-1462-3f14-b63d-a026d7a5e6d3.jpeg',
549 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
552 'display_id': 'home-inspector-joe-hgtv-atve-us/this-mold-house',
554 'title': 'This Mold House',
555 'description': 'Joe and Noel help take a familys dream home from hazardous to fabulous.',
559 'skip': 'Available for Premium users',
561 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
562 'only_matching': True,
566 _DISCO_API_PARAMS
= {
567 'disco_host': 'us1-prod-direct.watch.hgtv.com',
573 class FoodNetworkIE(DiscoveryPlusBaseIE
):
574 _VALID_URL
= r
'https?://(?:watch\.)?foodnetwork\.com/video' + DPlayBaseIE
._PATH
_REGEX
576 'url': 'https://watch.foodnetwork.com/video/guys-grocery-games-food-network/wild-in-the-aisles',
579 'display_id': 'guys-grocery-games-food-network/wild-in-the-aisles',
581 'title': 'Wild in the Aisles',
582 'description': 'The chefs make spaghetti and meatballs with "Out of Stock" ingredients.',
584 'season': 'Season 1',
586 'episode': 'Episode 1',
587 'series': 'Guy\'s Grocery Games',
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',
596 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
599 'display_id': 'kids-baking-championship-food-network/float-like-a-butterfly',
601 'title': 'Float Like a Butterfly',
602 'description': 'The 12 kid bakers create colorful carved butterfly cakes.',
606 'skip': 'Available for Premium users',
608 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
609 'only_matching': True,
613 _DISCO_API_PARAMS
= {
614 'disco_host': 'us1-prod-direct.watch.foodnetwork.com',
620 class DestinationAmericaIE(DiscoveryPlusBaseIE
):
621 _VALID_URL
= r
'https?://(?:www\.)?destinationamerica\.com/video' + DPlayBaseIE
._PATH
_REGEX
623 'url': 'https://www.destinationamerica.com/video/bbq-pit-wars-destination-america/smoke-on-the-water',
626 'display_id': 'bbq-pit-wars-destination-america/smoke-on-the-water',
628 'title': 'Smoke on the Water',
629 'description': 'The pitmasters head to Georgia for the Smoke on the Water BBQ Festival.',
631 'season': 'Season 2',
633 'episode': 'Episode 1',
634 'series': 'BBQ Pit Wars',
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',
643 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
646 'display_id': 'alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
648 'title': 'Central Alaskas Bigfoot',
649 'description': 'A team heads to central Alaska to investigate an aggressive Bigfoot.',
653 'skip': 'Available for Premium users',
655 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
656 'only_matching': True,
660 _DISCO_API_PARAMS
= {
661 'disco_host': 'us1-prod-direct.destinationamerica.com',
667 class InvestigationDiscoveryIE(DiscoveryPlusBaseIE
):
668 _VALID_URL
= r
'https?://(?:www\.)?investigationdiscovery\.com/video' + DPlayBaseIE
._PATH
_REGEX
670 'url': 'https://www.investigationdiscovery.com/video/deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
673 'display_id': 'deadly-influence-the-social-media-murders-investigation-discovery-atve-us/rip-bianca',
675 'title': 'RIP Bianca',
676 'description': 'A teenage influencer discovers an online world of threat, harm and danger.',
678 'season': 'Season 1',
680 'episode': 'Episode 3',
681 'series': 'Deadly Influence: The Social Media Murders',
682 'creators': ['Investigation Discovery'],
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',
690 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
693 'display_id': 'unmasked-investigation-discovery/the-killer-clown',
695 'title': 'The Killer Clown',
696 'description': 'A wealthy Florida woman is fatally shot in the face by a clown at her door.',
700 'skip': 'Available for Premium users',
702 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
703 'only_matching': True,
707 _DISCO_API_PARAMS
= {
708 'disco_host': 'us1-prod-direct.investigationdiscovery.com',
714 class AmHistoryChannelIE(DiscoveryPlusBaseIE
):
715 _VALID_URL
= r
'https?://(?:www\.)?ahctv\.com/video' + DPlayBaseIE
._PATH
_REGEX
717 'url': 'https://www.ahctv.com/video/blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
720 'display_id': 'blood-and-fury-americas-civil-war-ahc/battle-of-bull-run',
722 'title': 'Battle of Bull Run',
723 'description': 'Two untested armies clash in the first real battle of the Civil War.',
725 'season': 'Season 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,
734 'thumbnail': 'https://us1-prod-images.disco-api.com/2020/05/11/4af61bd7-d705-3108-82c4-1a6e541e20fa.jpeg',
737 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
740 'display_id': 'modern-sniper-ahc/army',
743 'description': 'Snipers today face challenges their predecessors couldve only dreamed of.',
747 'skip': 'Available for Premium users',
749 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
750 'only_matching': True,
754 _DISCO_API_PARAMS
= {
755 'disco_host': 'us1-prod-direct.ahctv.com',
761 class ScienceChannelIE(DiscoveryPlusBaseIE
):
762 _VALID_URL
= r
'https?://(?:www\.)?sciencechannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
764 'url': 'https://www.sciencechannel.com/video/spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
767 'display_id': 'spaces-deepest-secrets-science-atve-us/mystery-of-the-dead-planets',
769 'title': 'Mystery of the Dead Planets',
770 'description': 'Astronomers unmask the truly destructive nature of the cosmos.',
772 'season': 'Season 7',
774 'episode': 'Episode 1',
775 'series': 'Space\'s Deepest Secrets',
776 'duration': 2524.989,
777 'upload_date': '20230128',
778 'timestamp': 1674882000,
779 'creators': ['Science'],
781 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/30/3796829d-aead-3f9a-bd8d-e49048b3cdca.jpeg',
784 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
787 'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
789 'title': 'Nazi Mystery Machine',
790 'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
794 'skip': 'Available for Premium users',
796 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
797 'only_matching': True,
801 _DISCO_API_PARAMS
= {
802 'disco_host': 'us1-prod-direct.sciencechannel.com',
808 class DiscoveryLifeIE(DiscoveryPlusBaseIE
):
809 _VALID_URL
= r
'https?://(?:www\.)?discoverylife\.com/video' + DPlayBaseIE
._PATH
_REGEX
811 'url': 'https://www.discoverylife.com/video/er-files-discovery-life-atve-us/sweet-charity',
814 'display_id': 'er-files-discovery-life-atve-us/sweet-charity',
816 'title': 'Sweet Charity',
817 'description': 'The staff at Charity Hospital treat a serious foot infection.',
819 'season': 'Season 1',
821 'episode': 'Episode 1',
822 'series': 'ER Files',
823 'duration': 2364.261,
824 'upload_date': '20230721',
825 'timestamp': 1689912000,
826 'creators': ['Discovery Life'],
828 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/16/4b6f0124-360b-3546-b6a4-5552db886b86.jpeg',
831 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
834 'display_id': 'surviving-death-discovery-life-atve-us/bodily-trauma',
836 'title': 'Bodily Trauma',
837 'description': 'Meet three people who tested the limits of the human body.',
841 'skip': 'Available for Premium users',
843 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
844 'only_matching': True,
848 _DISCO_API_PARAMS
= {
849 'disco_host': 'us1-prod-direct.discoverylife.com',
855 class AnimalPlanetIE(DiscoveryPlusBaseIE
):
856 _VALID_URL
= r
'https?://(?:www\.)?animalplanet\.com/video' + DPlayBaseIE
._PATH
_REGEX
858 'url': 'https://www.animalplanet.com/video/mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
861 'display_id': 'mysterious-creatures-with-forrest-galante-animal-planet-atve-us/the-demon-of-peru',
863 'title': 'The Demon of Peru',
864 'description': 'In Peru, a farming village is being terrorized by a “man-like beast.”',
866 'season': 'Season 1',
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'],
875 'thumbnail': 'https://us1-prod-images.disco-api.com/2022/03/01/6dbaa833-9a2e-3fee-9381-c19eddf67c0c.jpeg',
878 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
881 'display_id': 'north-woods-law-animal-planet/squirrel-showdown',
883 'title': 'Squirrel Showdown',
884 'description': 'A woman is suspected of being in possession of flying squirrel kits.',
886 'episode_number': 11,
888 'skip': 'Available for Premium users',
890 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
891 'only_matching': True,
895 _DISCO_API_PARAMS
= {
896 'disco_host': 'us1-prod-direct.animalplanet.com',
902 class TLCIE(DiscoveryPlusBaseIE
):
903 _VALID_URL
= r
'https?://(?:go\.)?tlc\.com/video' + DPlayBaseIE
._PATH
_REGEX
905 'url': 'https://go.tlc.com/video/90-day-the-last-resort-tlc-atve-us/the-last-chance',
908 'display_id': '90-day-the-last-resort-tlc-atve-us/the-last-chance',
910 'title': 'The Last Chance',
911 'description': 'Infidelity shakes Kalani and Asuelu\'s world, and Angela threatens divorce.',
913 'season': 'Season 1',
915 'episode': 'Episode 1',
916 'series': '90 Day: The Last Resort',
918 'upload_date': '20230815',
919 'timestamp': 1692061200,
922 'thumbnail': 'https://us1-prod-images.disco-api.com/2023/08/08/0ee367e2-ac76-334d-bf23-dbf796696a24.jpeg',
925 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
928 'display_id': 'my-600-lb-life-tlc/melissas-story-part-1',
930 'title': 'Melissas Story (Part 1)',
931 'description': 'At 650 lbs, Melissa is ready to begin her seven-year weight loss journey.',
935 'skip': 'Available for Premium users',
937 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
938 'only_matching': True,
942 _DISCO_API_PARAMS
= {
943 'disco_host': 'us1-prod-direct.tlc.com',
949 class DiscoveryPlusIE(DiscoveryPlusBaseIE
):
950 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.com/(?!it/)(?:(?P<country>[a-z]{2})/)?video(?:/sport|/olympics)?' + DPlayBaseIE
._PATH
_REGEX
952 'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
955 'display_id': 'property-brothers-forever-home/food-and-family',
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',
963 'series': 'Property Brothers: Forever Home',
967 'skip': 'Available for Premium users',
969 'url': 'https://discoveryplus.com/ca/video/bering-sea-gold-discovery-ca/goldslingers',
970 'only_matching': True,
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,
975 'url': 'https://www.discoveryplus.com/gb/video/olympics/dplus-sport-dplus-sport-sport/rugby-sevens-australia-samoa',
976 'only_matching': True,
980 _DISCO_API_PARAMS
= None
982 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
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')
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',
1003 self
._DISCO
_API
_PARAMS
= {
1004 'disco_host': 'eu1-prod-direct.discoveryplus.com',
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
1015 'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
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?',
1027 'episode_number': 2,
1028 'creator': 'Discovery Channel',
1029 'thumbnail': r
're:https://.+\.jpeg',
1030 'episode': 'Episode 2',
1031 'season': 'Season 8',
1035 'skip_download': True,
1039 _PRODUCT
= 'dplus-india'
1040 _DISCO_API_PARAMS
= {
1041 'disco_host': 'ap2-prod-direct.discoveryplus.in',
1042 'realm': 'dplusindia',
1044 'domain': 'https://www.discoveryplus.in/',
1047 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
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>[^/]+)'
1059 'url': 'https://dmax.de/sendungen/goldrausch-in-australien/german-gold',
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',
1070 'series': 'Goldrausch in Australien',
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'},
1080 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
1084 'title': 'Die Welt da draußen',
1085 'description': 'md5:61033c12b73286e409d99a41742ef608',
1086 'timestamp': 1554069600,
1087 'upload_date': '20190331',
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,
1097 'thumbnail': r
're:https://.+\.jpg',
1099 'skip': '404 Not Found',
1101 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
1102 'only_matching': True,
1104 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
1105 'only_matching': True,
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
):
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
):
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 ''))
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
)
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
1165 'url': 'https://www.discoveryplus.com/it/video/i-signori-della-neve/stagione-2-episodio-1-i-preparativi',
1166 'only_matching': True,
1168 'url': 'https://www.discoveryplus.com/it/video/super-benny/trailer',
1169 'only_matching': True,
1171 'url': 'https://www.discoveryplus.com/it/video/olympics/dplus-sport-dplus-sport-sport/water-polo-greece-italy',
1172 'only_matching': True,
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',
1185 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
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>[^/]+)/?(?:[?#]|$)'
1196 'url': 'https://www.discoveryplus.it/programmi/deal-with-it-stai-al-gioco',
1197 'playlist_mincount': 168,
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'
1207 _SHOW_STR
= 'programmi'
1212 class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE
):
1213 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1215 'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
1216 'playlist_mincount': 140,
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'
1228 _VIDEO_IE
= DiscoveryPlusIndiaIE