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
= 'https://%s/' % 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 HGTVDeIE(DPlayBaseIE
):
323 _VALID_URL
= r
'https?://de\.hgtv\.com/sendungen' + DPlayBaseIE
._PATH
_REGEX
325 'url': 'https://de.hgtv.com/sendungen/tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette/',
328 'display_id': 'tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette',
330 'title': 'Wer braucht schon eine Toilette',
331 'description': 'md5:05b40a27e7aed2c9172de34d459134e2',
332 'duration': 1177.024,
333 'timestamp': 1595705400,
334 'upload_date': '20200725',
336 'series': 'Tiny House - klein, aber oho',
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 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
350 headers
['x-disco-client'] = f
'WEB:UNKNOWN:{self._PRODUCT}:25.2.6'
352 def _download_video_playback_info(self
, disco_base
, video_id
, headers
):
353 return self
._download
_json
(
354 disco_base
+ 'playback/v3/videoPlaybackInfo',
355 video_id
, headers
=headers
, data
=json
.dumps({
358 'drmSupported': False,
361 'wisteriaProperties': {},
362 }).encode('utf-8'))['data']['attributes']['streaming']
364 def _real_extract(self
, url
):
365 return self
._get
_disco
_api
_info
(url
, self
._match
_id
(url
), **self
._DISCO
_API
_PARAMS
)
368 class GoDiscoveryIE(DiscoveryPlusBaseIE
):
369 _VALID_URL
= r
'https?://(?:go\.)?discovery\.com/video' + DPlayBaseIE
._PATH
_REGEX
371 'url': 'https://go.discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
374 'display_id': 'dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
376 'title': 'Rodbuster / Galvanizer',
377 'description': 'Mike installs rebar with a team of rodbusters, then he galvanizes steel.',
381 'skip': 'Available for Premium users',
383 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
384 'only_matching': True,
388 _DISCO_API_PARAMS
= {
389 'disco_host': 'us1-prod-direct.go.discovery.com',
395 class TravelChannelIE(DiscoveryPlusBaseIE
):
396 _VALID_URL
= r
'https?://(?:watch\.)?travelchannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
398 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
401 'display_id': 'ghost-adventures-travel-channel/ghost-train-of-ely',
403 'title': 'Ghost Train of Ely',
404 'description': 'The crew investigates the dark history of the Nevada Northern Railway.',
408 'skip': 'Available for Premium users',
410 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
411 'only_matching': True,
415 _DISCO_API_PARAMS
= {
416 'disco_host': 'us1-prod-direct.watch.travelchannel.com',
422 class CookingChannelIE(DiscoveryPlusBaseIE
):
423 _VALID_URL
= r
'https?://(?:watch\.)?cookingchanneltv\.com/video' + DPlayBaseIE
._PATH
_REGEX
425 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
428 'display_id': 'carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
430 'title': 'The Postman Always Brings Rice',
431 'description': 'Noah visits the Maui Fair and the Aurora Winter Festival in Vancouver.',
435 'skip': 'Available for Premium users',
437 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
438 'only_matching': True,
442 _DISCO_API_PARAMS
= {
443 'disco_host': 'us1-prod-direct.watch.cookingchanneltv.com',
449 class HGTVUsaIE(DiscoveryPlusBaseIE
):
450 _VALID_URL
= r
'https?://(?:watch\.)?hgtv\.com/video' + DPlayBaseIE
._PATH
_REGEX
452 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
455 'display_id': 'home-inspector-joe-hgtv-atve-us/this-mold-house',
457 'title': 'This Mold House',
458 'description': 'Joe and Noel help take a familys dream home from hazardous to fabulous.',
462 'skip': 'Available for Premium users',
464 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
465 'only_matching': True,
469 _DISCO_API_PARAMS
= {
470 'disco_host': 'us1-prod-direct.watch.hgtv.com',
476 class FoodNetworkIE(DiscoveryPlusBaseIE
):
477 _VALID_URL
= r
'https?://(?:watch\.)?foodnetwork\.com/video' + DPlayBaseIE
._PATH
_REGEX
479 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
482 'display_id': 'kids-baking-championship-food-network/float-like-a-butterfly',
484 'title': 'Float Like a Butterfly',
485 'description': 'The 12 kid bakers create colorful carved butterfly cakes.',
489 'skip': 'Available for Premium users',
491 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
492 'only_matching': True,
496 _DISCO_API_PARAMS
= {
497 'disco_host': 'us1-prod-direct.watch.foodnetwork.com',
503 class DestinationAmericaIE(DiscoveryPlusBaseIE
):
504 _VALID_URL
= r
'https?://(?:www\.)?destinationamerica\.com/video' + DPlayBaseIE
._PATH
_REGEX
506 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
509 'display_id': 'alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
511 'title': 'Central Alaskas Bigfoot',
512 'description': 'A team heads to central Alaska to investigate an aggressive Bigfoot.',
516 'skip': 'Available for Premium users',
518 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
519 'only_matching': True,
523 _DISCO_API_PARAMS
= {
524 'disco_host': 'us1-prod-direct.destinationamerica.com',
530 class InvestigationDiscoveryIE(DiscoveryPlusBaseIE
):
531 _VALID_URL
= r
'https?://(?:www\.)?investigationdiscovery\.com/video' + DPlayBaseIE
._PATH
_REGEX
533 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
536 'display_id': 'unmasked-investigation-discovery/the-killer-clown',
538 'title': 'The Killer Clown',
539 'description': 'A wealthy Florida woman is fatally shot in the face by a clown at her door.',
543 'skip': 'Available for Premium users',
545 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
546 'only_matching': True,
550 _DISCO_API_PARAMS
= {
551 'disco_host': 'us1-prod-direct.investigationdiscovery.com',
557 class AmHistoryChannelIE(DiscoveryPlusBaseIE
):
558 _VALID_URL
= r
'https?://(?:www\.)?ahctv\.com/video' + DPlayBaseIE
._PATH
_REGEX
560 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
563 'display_id': 'modern-sniper-ahc/army',
566 'description': 'Snipers today face challenges their predecessors couldve only dreamed of.',
570 'skip': 'Available for Premium users',
572 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
573 'only_matching': True,
577 _DISCO_API_PARAMS
= {
578 'disco_host': 'us1-prod-direct.ahctv.com',
584 class ScienceChannelIE(DiscoveryPlusBaseIE
):
585 _VALID_URL
= r
'https?://(?:www\.)?sciencechannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
587 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
590 'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
592 'title': 'Nazi Mystery Machine',
593 'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
597 'skip': 'Available for Premium users',
599 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
600 'only_matching': True,
604 _DISCO_API_PARAMS
= {
605 'disco_host': 'us1-prod-direct.sciencechannel.com',
611 class DIYNetworkIE(DiscoveryPlusBaseIE
):
612 _VALID_URL
= r
'https?://(?:watch\.)?diynetwork\.com/video' + DPlayBaseIE
._PATH
_REGEX
614 'url': 'https://watch.diynetwork.com/video/pool-kings-diy-network/bringing-beach-life-to-texas',
617 'display_id': 'pool-kings-diy-network/bringing-beach-life-to-texas',
619 'title': 'Bringing Beach Life to Texas',
620 'description': 'The Pool Kings give a family a day at the beach in their own backyard.',
624 'skip': 'Available for Premium users',
626 'url': 'https://watch.diynetwork.com/video/pool-kings-diy-network/bringing-beach-life-to-texas',
627 'only_matching': True,
631 _DISCO_API_PARAMS
= {
632 'disco_host': 'us1-prod-direct.watch.diynetwork.com',
638 class DiscoveryLifeIE(DiscoveryPlusBaseIE
):
639 _VALID_URL
= r
'https?://(?:www\.)?discoverylife\.com/video' + DPlayBaseIE
._PATH
_REGEX
641 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
644 'display_id': 'surviving-death-discovery-life-atve-us/bodily-trauma',
646 'title': 'Bodily Trauma',
647 'description': 'Meet three people who tested the limits of the human body.',
651 'skip': 'Available for Premium users',
653 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
654 'only_matching': True,
658 _DISCO_API_PARAMS
= {
659 'disco_host': 'us1-prod-direct.discoverylife.com',
665 class AnimalPlanetIE(DiscoveryPlusBaseIE
):
666 _VALID_URL
= r
'https?://(?:www\.)?animalplanet\.com/video' + DPlayBaseIE
._PATH
_REGEX
668 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
671 'display_id': 'north-woods-law-animal-planet/squirrel-showdown',
673 'title': 'Squirrel Showdown',
674 'description': 'A woman is suspected of being in possession of flying squirrel kits.',
676 'episode_number': 11,
678 'skip': 'Available for Premium users',
680 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
681 'only_matching': True,
685 _DISCO_API_PARAMS
= {
686 'disco_host': 'us1-prod-direct.animalplanet.com',
692 class TLCIE(DiscoveryPlusBaseIE
):
693 _VALID_URL
= r
'https?://(?:go\.)?tlc\.com/video' + DPlayBaseIE
._PATH
_REGEX
695 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
698 'display_id': 'my-600-lb-life-tlc/melissas-story-part-1',
700 'title': 'Melissas Story (Part 1)',
701 'description': 'At 650 lbs, Melissa is ready to begin her seven-year weight loss journey.',
705 'skip': 'Available for Premium users',
707 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
708 'only_matching': True,
712 _DISCO_API_PARAMS
= {
713 'disco_host': 'us1-prod-direct.tlc.com',
719 class MotorTrendIE(DiscoveryPlusBaseIE
):
720 _VALID_URL
= r
'https?://(?:watch\.)?motortrend\.com/video' + DPlayBaseIE
._PATH
_REGEX
722 'url': 'https://watch.motortrend.com/video/car-issues-motortrend-atve-us/double-dakotas',
725 'display_id': 'double-dakotas',
727 'title': 'Double Dakotas',
728 'description': 'Tylers buy-one-get-one Dakota deal has the Wizard pulling double duty.',
732 'skip': 'Available for Premium users',
734 'url': 'https://watch.motortrend.com/video/car-issues-motortrend-atve-us/double-dakotas',
735 'only_matching': True,
739 _DISCO_API_PARAMS
= {
740 'disco_host': 'us1-prod-direct.watch.motortrend.com',
746 class MotorTrendOnDemandIE(DiscoveryPlusBaseIE
):
747 _VALID_URL
= r
'https?://(?:www\.)?motortrend(?:ondemand\.com|\.com/plus)/detail' + DPlayBaseIE
._PATH
_REGEX
749 'url': 'https://www.motortrendondemand.com/detail/wheelstanding-dump-truck-stubby-bobs-comeback/37699/784',
752 'display_id': 'wheelstanding-dump-truck-stubby-bobs-comeback/37699',
754 'title': 'Wheelstanding Dump Truck! Stubby Bob’s Comeback',
755 'description': 'md5:996915abe52a1c3dfc83aecea3cce8e7',
757 'episode_number': 52,
758 'episode': 'Episode 52',
759 'season': 'Season 5',
760 'thumbnail': r
're:^https?://.+\.jpe?g$',
761 'timestamp': 1388534401,
762 'duration': 1887.345,
763 'creator': 'Originals',
764 'series': 'Roadkill',
765 'upload_date': '20140101',
769 'url': 'https://www.motortrend.com/plus/detail/roadworthy-rescues-teaser-trailer/4922860/',
773 'title': 'Roadworthy Rescues | Teaser Trailer',
774 'description': 'Derek Bieri helps Freiburger and Finnegan with their \'68 big-block Dart.',
775 'display_id': 'roadworthy-rescues-teaser-trailer/4922860',
776 'creator': 'Originals',
777 'series': 'Roadworthy Rescues',
778 'thumbnail': r
're:^https?://.+\.jpe?g$',
779 'upload_date': '20220907',
780 'timestamp': 1662523200,
781 'duration': 1066.356,
785 'url': 'https://www.motortrend.com/plus/detail/ugly-duckling/2450033/12439',
786 'only_matching': True,
790 _DISCO_API_PARAMS
= {
791 'disco_host': 'us1-prod-direct.motortrendondemand.com',
792 'realm': 'motortrend',
796 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
798 'x-disco-params': f
'realm={realm}',
799 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:4.39.1-gi1',
800 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
804 class DiscoveryPlusIE(DiscoveryPlusBaseIE
):
805 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.com/(?!it/)(?:\w{2}/)?video' + DPlayBaseIE
._PATH
_REGEX
807 'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
810 'display_id': 'property-brothers-forever-home/food-and-family',
812 'title': 'Food and Family',
813 'description': 'The brothers help a Richmond family expand their single-level home.',
814 'duration': 2583.113,
815 'timestamp': 1609304400,
816 'upload_date': '20201230',
818 'series': 'Property Brothers: Forever Home',
822 'skip': 'Available for Premium users',
824 'url': 'https://discoveryplus.com/ca/video/bering-sea-gold-discovery-ca/goldslingers',
825 'only_matching': True,
828 _PRODUCT
= 'dplus_us'
829 _DISCO_API_PARAMS
= {
830 'disco_host': 'us1-prod-direct.discoveryplus.com',
836 class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE
):
837 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.in/videos?' + DPlayBaseIE
._PATH
_REGEX
839 'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
843 'display_id': 'how-do-they-do-it/fugu-and-more',
844 'title': 'Fugu and More',
845 'description': 'The Japanese catch, prepare and eat the deadliest fish on the planet.',
847 'timestamp': 1582309800,
848 'upload_date': '20200221',
849 'series': 'How Do They Do It?',
852 'creator': 'Discovery Channel',
853 'thumbnail': r
're:https://.+\.jpeg',
854 'episode': 'Episode 2',
855 'season': 'Season 8',
859 'skip_download': True,
863 _PRODUCT
= 'dplus-india'
864 _DISCO_API_PARAMS
= {
865 'disco_host': 'ap2-prod-direct.discoveryplus.in',
866 'realm': 'dplusindia',
868 'domain': 'https://www.discoveryplus.in/',
871 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
873 'x-disco-params': 'realm=%s' % realm
,
874 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
875 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
879 class DiscoveryNetworksDeIE(DiscoveryPlusBaseIE
):
880 _VALID_URL
= r
'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
883 'url': 'https://dmax.de/sendungen/goldrausch-in-australien/german-gold',
887 'title': 'German Gold',
888 'description': 'md5:f3073306553a8d9b40e6ac4cdbf09fc6',
889 'display_id': 'goldrausch-in-australien/german-gold',
890 'episode': 'Episode 1',
892 'season': 'Season 5',
894 'series': 'Goldrausch in Australien',
896 'upload_date': '20230517',
897 'timestamp': 1684357500,
898 'creators': ['DMAX'],
899 'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/05/09/f72fb510-7992-3b12-af7f-f16a2c22d1e3.jpeg',
900 'tags': ['schatzsucher', 'schatz', 'nugget', 'bodenschätze', 'down under', 'australien', 'goldrausch'],
902 'params': {'skip_download': 'm3u8'}
,
904 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
908 'title': 'Die Welt da draußen',
909 'description': 'md5:61033c12b73286e409d99a41742ef608',
910 'timestamp': 1554069600,
911 'upload_date': '20190331',
913 'season': 'Season 1',
914 'series': 'Breaking Amish',
916 'tags': ['new york', 'großstadt', 'amische', 'landleben', 'modern', 'infos', 'tradition', 'herausforderung'],
917 'display_id': 'breaking-amish/die-welt-da-drauen',
918 'episode': 'Episode 1',
919 'duration': 2625.024,
921 'thumbnail': r
're:https://.+\.jpg',
923 'skip': '404 Not Found',
925 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
926 'only_matching': True,
928 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
929 'only_matching': True,
931 'url': 'https://tlc.de/sendungen/breaking-amish/die-welt-da-drauen/',
932 'only_matching': True,
935 def _real_extract(self
, url
):
936 domain
, programme
, alternate_id
= self
._match
_valid
_url
(url
).groups()
937 country
= 'GB' if domain
== 'dplay.co.uk' else 'DE'
938 realm
= 'questuk' if country
== 'GB' else domain
.replace('.', '')
939 return self
._get
_disco
_api
_info
(
940 url
, f
'{programme}/{alternate_id}', 'eu1-prod.disco-api.com', realm
, country
)
942 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
944 'x-disco-params': f
'realm={realm}',
945 'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
946 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
950 class DiscoveryPlusShowBaseIE(DPlayBaseIE
):
952 def _entries(self
, show_name
):
954 'x-disco-client': self
._X
_CLIENT
,
955 'x-disco-params': f
'realm={self._REALM}',
956 'referer': self
._DOMAIN
,
957 'Authentication': self
._get
_auth
(self
._BASE
_API
, None, self
._REALM
),
959 show_json
= self
._download
_json
(
960 f
'{self._BASE_API}cms/routes/{self._SHOW_STR}/{show_name}?include=default',
961 video_id
=show_name
, headers
=headers
)['included'][self
._INDEX
]['attributes']['component']
962 show_id
= show_json
['mandatoryParams'].split('=')[-1]
963 season_url
= self
._BASE
_API
+ 'content/videos?sort=episodeNumber&filter[seasonNumber]={}&filter[show.id]={}&page[size]=100&page[number]={}'
964 for season
in show_json
['filters'][0]['options']:
965 season_id
= season
['id']
966 total_pages
, page_num
= 1, 0
967 while page_num
< total_pages
:
968 season_json
= self
._download
_json
(
969 season_url
.format(season_id
, show_id
, str(page_num
+ 1)), show_name
, headers
=headers
,
970 note
='Downloading season %s JSON metadata%s' % (season_id
, ' page %d' % page_num
if page_num
else ''))
972 total_pages
= try_get(season_json
, lambda x
: x
['meta']['totalPages'], int) or 1
973 episodes_json
= season_json
['data']
974 for episode
in episodes_json
:
975 video_path
= episode
['attributes']['path']
976 yield self
.url_result(
977 '%svideos/%s' % (self
._DOMAIN
, video_path
),
978 ie
=self
._VIDEO
_IE
.ie_key(), video_id
=episode
.get('id') or video_path
)
981 def _real_extract(self
, url
):
982 show_name
= self
._match
_valid
_url
(url
).group('show_name')
983 return self
.playlist_result(self
._entries
(show_name
), playlist_id
=show_name
)
986 class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE
):
987 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.com/it/video' + DPlayBaseIE
._PATH
_REGEX
989 'url': 'https://www.discoveryplus.com/it/video/i-signori-della-neve/stagione-2-episodio-1-i-preparativi',
990 'only_matching': True,
992 'url': 'https://www.discoveryplus.com/it/video/super-benny/trailer',
993 'only_matching': True,
996 _PRODUCT
= 'dplus_us'
997 _DISCO_API_PARAMS
= {
998 'disco_host': 'eu1-prod-direct.discoveryplus.com',
1003 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
1005 'x-disco-params': 'realm=%s' % realm
,
1006 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:25.2.6',
1007 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
1011 class DiscoveryPlusItalyShowIE(DiscoveryPlusShowBaseIE
):
1012 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.it/programmi/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1014 'url': 'https://www.discoveryplus.it/programmi/deal-with-it-stai-al-gioco',
1015 'playlist_mincount': 168,
1017 'id': 'deal-with-it-stai-al-gioco',
1021 _BASE_API
= 'https://disco-api.discoveryplus.it/'
1022 _DOMAIN
= 'https://www.discoveryplus.it/'
1023 _X_CLIENT
= 'WEB:UNKNOWN:dplay-client:2.6.0'
1025 _SHOW_STR
= 'programmi'
1030 class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE
):
1031 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
1033 'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
1034 'playlist_mincount': 140,
1036 'id': 'how-do-they-do-it',
1040 _BASE_API
= 'https://ap2-prod-direct.discoveryplus.in/'
1041 _DOMAIN
= 'https://www.discoveryplus.in/'
1042 _X_CLIENT
= 'WEB:UNKNOWN:dplus-india:prod'
1043 _REALM
= 'dplusindia'
1046 _VIDEO_IE
= DiscoveryPlusIndiaIE
1049 class GlobalCyclingNetworkPlusIE(DiscoveryPlusBaseIE
):
1050 _VALID_URL
= r
'https?://plus\.globalcyclingnetwork\.com/watch/(?P<id>\d+)'
1052 'url': 'https://plus.globalcyclingnetwork.com/watch/1397691',
1056 'title': 'The Athertons: Mountain Biking\'s Fastest Family',
1057 'description': 'md5:75a81937fcd8b989eec6083a709cd837',
1058 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/04/eb9e3026-4849-3001-8281-9356466f0557.png',
1061 'upload_date': '20210309',
1062 'timestamp': 1615248000,
1066 'skip': 'Subscription required',
1067 'params': {'skip_download': 'm3u8'}
,
1071 _DISCO_API_PARAMS
= {
1072 'disco_host': 'disco-api-prod.globalcyclingnetwork.com',
1077 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
1079 'x-disco-params': f
'realm={realm}',
1080 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:27.3.2',
1081 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),