]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/dplay.py
8eb4d8ffa8a73862c6ffe1646912d788dafb45be
4 from .common
import InfoExtractor
5 from ..compat
import compat_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
.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 geo_countries
= [country
.upper()]
69 self
._initialize
_geo
_bypass
({
70 'countries': geo_countries
,
72 disco_base
= 'https://%s/' % disco_host
76 self
._update
_disco
_api
_headers
(headers
, disco_base
, display_id
, realm
)
78 video
= self
._download
_json
(
79 disco_base
+ 'content/videos/' + display_id
, display_id
,
80 headers
=headers
, query
={
81 'fields[channel]': 'name',
82 'fields[image]': 'height,src,width',
83 'fields[show]': 'name',
84 'fields[tag]': 'name',
85 'fields[video]': 'description,episodeNumber,name,publishStart,seasonNumber,videoDuration',
86 'include': 'images,primaryChannel,show,tags'
88 except ExtractorError
as e
:
89 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 400:
90 self
._process
_errors
(e
, geo_countries
)
92 video_id
= video
['data']['id']
93 info
= video
['data']['attributes']
94 title
= info
['name'].strip()
98 streaming
= self
._download
_video
_playback
_info
(
99 disco_base
, video_id
, headers
)
100 except ExtractorError
as e
:
101 if isinstance(e
.cause
, compat_HTTPError
) and e
.cause
.code
== 403:
102 self
._process
_errors
(e
, geo_countries
)
104 for format_dict
in streaming
:
105 if not isinstance(format_dict
, dict):
107 format_url
= format_dict
.get('url')
110 format_id
= format_dict
.get('type')
111 ext
= determine_ext(format_url
)
112 if format_id
== 'dash' or ext
== 'mpd':
113 dash_fmts
, dash_subs
= self
._extract
_mpd
_formats
_and
_subtitles
(
114 format_url
, display_id
, mpd_id
='dash', fatal
=False)
115 formats
.extend(dash_fmts
)
116 subtitles
= self
._merge
_subtitles
(subtitles
, dash_subs
)
117 elif format_id
== 'hls' or ext
== 'm3u8':
118 m3u8_fmts
, m3u8_subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(
119 format_url
, display_id
, 'mp4',
120 entry_protocol
='m3u8_native', m3u8_id
='hls',
122 formats
.extend(m3u8_fmts
)
123 subtitles
= self
._merge
_subtitles
(subtitles
, m3u8_subs
)
127 'format_id': format_id
,
130 creator
= series
= None
133 included
= video
.get('included') or []
134 if isinstance(included
, list):
136 attributes
= e
.get('attributes')
139 e_type
= e
.get('type')
140 if e_type
== 'channel':
141 creator
= attributes
.get('name')
142 elif e_type
== 'image':
143 src
= attributes
.get('src')
147 'width': int_or_none(attributes
.get('width')),
148 'height': int_or_none(attributes
.get('height')),
151 series
= attributes
.get('name')
152 elif e_type
== 'tag':
153 name
= attributes
.get('name')
158 'display_id': display_id
,
160 'description': strip_or_none(info
.get('description')),
161 'duration': float_or_none(info
.get('videoDuration'), 1000),
162 'timestamp': unified_timestamp(info
.get('publishStart')),
164 'season_number': int_or_none(info
.get('seasonNumber')),
165 'episode_number': int_or_none(info
.get('episodeNumber')),
168 'thumbnails': thumbnails
,
170 'subtitles': subtitles
,
177 class DPlayIE(DPlayBaseIE
):
178 _VALID_URL
= r
'''(?x)https?://
182 play\.(?P<country>dk|fi|jp|se|no)|
183 iscoveryplus\.(?P<plus_country>dk|es|fi|it|se|no)
186 (?P<subdomain_country>es|it)\.dplay\.com
187 )/[^/]+''' + DPlayBaseIE
._PATH
_REGEX
190 # non geo restricted, via secure api, unsigned download hls URL
191 'url': 'https://www.dplay.se/videos/nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
194 'display_id': 'nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
196 'title': 'Svensken lär sig njuta av livet',
197 'description': 'md5:d3819c9bccffd0fe458ca42451dd50d8',
198 'duration': 2649.856,
199 'timestamp': 1365453720,
200 'upload_date': '20130408',
201 'creator': 'Kanal 5',
202 'series': 'Nugammalt - 77 händelser som format Sverige',
207 'skip_download': True,
210 # geo restricted, via secure api, unsigned download hls URL
211 'url': 'http://www.dplay.dk/videoer/ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
214 'display_id': 'ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
216 'title': 'Ted Bundy: Mind Of A Monster',
217 'description': 'md5:8b780f6f18de4dae631668b8a9637995',
218 'duration': 5290.027,
219 'timestamp': 1570694400,
220 'upload_date': '20191010',
221 'creator': 'ID - Investigation Discovery',
222 'series': 'Ted Bundy: Mind Of A Monster',
227 'skip_download': True,
231 'url': 'https://www.dplay.no/videoer/i-kongens-klr/sesong-1-episode-7',
234 'display_id': 'i-kongens-klr/sesong-1-episode-7',
236 'title': 'Episode 7',
237 'description': 'md5:e3e1411b2b9aebeea36a6ec5d50c60cf',
239 'timestamp': 1516726800,
240 'upload_date': '20180123',
241 'series': 'I kongens klær',
246 'skip_download': True,
248 'skip': 'Available for Premium users',
250 'url': 'http://it.dplay.com/nove/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij/',
251 'md5': '2b808ffb00fc47b884a172ca5d13053c',
254 'display_id': 'biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
256 'title': 'Luigi Di Maio: la psicosi di Stanislawskij',
257 'description': 'md5:3c7a4303aef85868f867a26f5cc14813',
258 'thumbnail': r
're:^https?://.*\.jpe?g',
259 'upload_date': '20160524',
260 'timestamp': 1464076800,
261 'series': 'Biografie imbarazzanti',
263 'episode': 'Episode 1',
267 'url': 'https://es.dplay.com/dmax/la-fiebre-del-oro/temporada-8-episodio-1/',
270 'display_id': 'la-fiebre-del-oro/temporada-8-episodio-1',
272 'title': 'Episodio 1',
273 'description': 'md5:b9dcff2071086e003737485210675f69',
274 'thumbnail': r
're:^https?://.*\.png',
275 'upload_date': '20180709',
276 'timestamp': 1531173540,
277 'series': 'La fiebre del oro',
279 'episode': 'Episode 1',
283 'skip_download': True,
286 'url': 'https://www.dplay.fi/videot/shifting-gears-with-aaron-kaufman/episode-16',
287 'only_matching': True,
289 'url': 'https://www.dplay.jp/video/gold-rush/24086',
290 'only_matching': True,
292 'url': 'https://www.discoveryplus.se/videos/nugammalt-77-handelser-som-format-sverige/nugammalt-77-handelser-som-format-sverige-101',
293 'only_matching': True,
295 'url': 'https://www.discoveryplus.dk/videoer/ted-bundy-mind-of-a-monster/ted-bundy-mind-of-a-monster',
296 'only_matching': True,
298 'url': 'https://www.discoveryplus.no/videoer/i-kongens-klr/sesong-1-episode-7',
299 'only_matching': True,
301 'url': 'https://www.discoveryplus.it/videos/biografie-imbarazzanti/luigi-di-maio-la-psicosi-di-stanislawskij',
302 'only_matching': True,
304 'url': 'https://www.discoveryplus.es/videos/la-fiebre-del-oro/temporada-8-episodio-1',
305 'only_matching': True,
307 'url': 'https://www.discoveryplus.fi/videot/shifting-gears-with-aaron-kaufman/episode-16',
308 'only_matching': True,
311 def _real_extract(self
, url
):
312 mobj
= self
._match
_valid
_url
(url
)
313 display_id
= mobj
.group('id')
314 domain
= remove_start(mobj
.group('domain'), 'www.')
315 country
= mobj
.group('country') or mobj
.group('subdomain_country') or mobj
.group('plus_country')
316 host
= 'disco-api.' + domain
if domain
[0] == 'd' else 'eu2-prod.disco-api.com'
317 return self
._get
_disco
_api
_info
(
318 url
, display_id
, host
, 'dplay' + country
, country
, domain
)
321 class HGTVDeIE(DPlayBaseIE
):
322 _VALID_URL
= r
'https?://de\.hgtv\.com/sendungen' + DPlayBaseIE
._PATH
_REGEX
324 'url': 'https://de.hgtv.com/sendungen/tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette/',
327 'display_id': 'tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette',
329 'title': 'Wer braucht schon eine Toilette',
330 'description': 'md5:05b40a27e7aed2c9172de34d459134e2',
331 'duration': 1177.024,
332 'timestamp': 1595705400,
333 'upload_date': '20200725',
335 'series': 'Tiny House - klein, aber oho',
341 def _real_extract(self
, url
):
342 display_id
= self
._match
_id
(url
)
343 return self
._get
_disco
_api
_info
(
344 url
, display_id
, 'eu1-prod.disco-api.com', 'hgtv', 'de')
347 class DiscoveryPlusBaseIE(DPlayBaseIE
):
348 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
349 headers
['x-disco-client'] = f
'WEB:UNKNOWN:{self._PRODUCT}:25.2.6'
351 def _download_video_playback_info(self
, disco_base
, video_id
, headers
):
352 return self
._download
_json
(
353 disco_base
+ 'playback/v3/videoPlaybackInfo',
354 video_id
, headers
=headers
, data
=json
.dumps({
359 'wisteriaProperties': {
360 'platform': 'desktop',
361 'product': self
._PRODUCT
,
363 }).encode('utf-8'))['data']['attributes']['streaming']
365 def _real_extract(self
, url
):
366 return self
._get
_disco
_api
_info
(url
, self
._match
_id
(url
), **self
._DISCO
_API
_PARAMS
)
369 class GoDiscoveryIE(DiscoveryPlusBaseIE
):
370 _VALID_URL
= r
'https?://(?:go\.)?discovery\.com/video' + DPlayBaseIE
._PATH
_REGEX
372 'url': 'https://go.discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
375 'display_id': 'dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
377 'title': 'Rodbuster / Galvanizer',
378 'description': 'Mike installs rebar with a team of rodbusters, then he galvanizes steel.',
382 'skip': 'Available for Premium users',
384 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',
385 'only_matching': True,
389 _DISCO_API_PARAMS
= {
390 'disco_host': 'us1-prod-direct.go.discovery.com',
396 class TravelChannelIE(DiscoveryPlusBaseIE
):
397 _VALID_URL
= r
'https?://(?:watch\.)?travelchannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
399 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
402 'display_id': 'ghost-adventures-travel-channel/ghost-train-of-ely',
404 'title': 'Ghost Train of Ely',
405 'description': 'The crew investigates the dark history of the Nevada Northern Railway.',
409 'skip': 'Available for Premium users',
411 'url': 'https://watch.travelchannel.com/video/ghost-adventures-travel-channel/ghost-train-of-ely',
412 'only_matching': True,
416 _DISCO_API_PARAMS
= {
417 'disco_host': 'us1-prod-direct.watch.travelchannel.com',
423 class CookingChannelIE(DiscoveryPlusBaseIE
):
424 _VALID_URL
= r
'https?://(?:watch\.)?cookingchanneltv\.com/video' + DPlayBaseIE
._PATH
_REGEX
426 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
429 'display_id': 'carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
431 'title': 'The Postman Always Brings Rice',
432 'description': 'Noah visits the Maui Fair and the Aurora Winter Festival in Vancouver.',
436 'skip': 'Available for Premium users',
438 'url': 'https://watch.cookingchanneltv.com/video/carnival-eats-cooking-channel/the-postman-always-brings-rice-2348634',
439 'only_matching': True,
443 _DISCO_API_PARAMS
= {
444 'disco_host': 'us1-prod-direct.watch.cookingchanneltv.com',
450 class HGTVUsaIE(DiscoveryPlusBaseIE
):
451 _VALID_URL
= r
'https?://(?:watch\.)?hgtv\.com/video' + DPlayBaseIE
._PATH
_REGEX
453 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
456 'display_id': 'home-inspector-joe-hgtv-atve-us/this-mold-house',
458 'title': 'This Mold House',
459 'description': 'Joe and Noel help take a familys dream home from hazardous to fabulous.',
463 'skip': 'Available for Premium users',
465 'url': 'https://watch.hgtv.com/video/home-inspector-joe-hgtv-atve-us/this-mold-house',
466 'only_matching': True,
470 _DISCO_API_PARAMS
= {
471 'disco_host': 'us1-prod-direct.watch.hgtv.com',
477 class FoodNetworkIE(DiscoveryPlusBaseIE
):
478 _VALID_URL
= r
'https?://(?:watch\.)?foodnetwork\.com/video' + DPlayBaseIE
._PATH
_REGEX
480 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
483 'display_id': 'kids-baking-championship-food-network/float-like-a-butterfly',
485 'title': 'Float Like a Butterfly',
486 'description': 'The 12 kid bakers create colorful carved butterfly cakes.',
490 'skip': 'Available for Premium users',
492 'url': 'https://watch.foodnetwork.com/video/kids-baking-championship-food-network/float-like-a-butterfly',
493 'only_matching': True,
497 _DISCO_API_PARAMS
= {
498 'disco_host': 'us1-prod-direct.watch.foodnetwork.com',
504 class DestinationAmericaIE(DiscoveryPlusBaseIE
):
505 _VALID_URL
= r
'https?://(?:www\.)?destinationamerica\.com/video' + DPlayBaseIE
._PATH
_REGEX
507 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
510 'display_id': 'alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
512 'title': 'Central Alaskas Bigfoot',
513 'description': 'A team heads to central Alaska to investigate an aggressive Bigfoot.',
517 'skip': 'Available for Premium users',
519 'url': 'https://www.destinationamerica.com/video/alaska-monsters-destination-america-atve-us/central-alaskas-bigfoot',
520 'only_matching': True,
524 _DISCO_API_PARAMS
= {
525 'disco_host': 'us1-prod-direct.destinationamerica.com',
531 class InvestigationDiscoveryIE(DiscoveryPlusBaseIE
):
532 _VALID_URL
= r
'https?://(?:www\.)?investigationdiscovery\.com/video' + DPlayBaseIE
._PATH
_REGEX
534 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
537 'display_id': 'unmasked-investigation-discovery/the-killer-clown',
539 'title': 'The Killer Clown',
540 'description': 'A wealthy Florida woman is fatally shot in the face by a clown at her door.',
544 'skip': 'Available for Premium users',
546 'url': 'https://www.investigationdiscovery.com/video/unmasked-investigation-discovery/the-killer-clown',
547 'only_matching': True,
551 _DISCO_API_PARAMS
= {
552 'disco_host': 'us1-prod-direct.investigationdiscovery.com',
558 class AmHistoryChannelIE(DiscoveryPlusBaseIE
):
559 _VALID_URL
= r
'https?://(?:www\.)?ahctv\.com/video' + DPlayBaseIE
._PATH
_REGEX
561 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
564 'display_id': 'modern-sniper-ahc/army',
567 'description': 'Snipers today face challenges their predecessors couldve only dreamed of.',
571 'skip': 'Available for Premium users',
573 'url': 'https://www.ahctv.com/video/modern-sniper-ahc/army',
574 'only_matching': True,
578 _DISCO_API_PARAMS
= {
579 'disco_host': 'us1-prod-direct.ahctv.com',
585 class ScienceChannelIE(DiscoveryPlusBaseIE
):
586 _VALID_URL
= r
'https?://(?:www\.)?sciencechannel\.com/video' + DPlayBaseIE
._PATH
_REGEX
588 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
591 'display_id': 'strangest-things-science-atve-us/nazi-mystery-machine',
593 'title': 'Nazi Mystery Machine',
594 'description': 'Experts investigate the secrets of a revolutionary encryption machine.',
598 'skip': 'Available for Premium users',
600 'url': 'https://www.sciencechannel.com/video/strangest-things-science-atve-us/nazi-mystery-machine',
601 'only_matching': True,
605 _DISCO_API_PARAMS
= {
606 'disco_host': 'us1-prod-direct.sciencechannel.com',
612 class DIYNetworkIE(DiscoveryPlusBaseIE
):
613 _VALID_URL
= r
'https?://(?:watch\.)?diynetwork\.com/video' + DPlayBaseIE
._PATH
_REGEX
615 'url': 'https://watch.diynetwork.com/video/pool-kings-diy-network/bringing-beach-life-to-texas',
618 'display_id': 'pool-kings-diy-network/bringing-beach-life-to-texas',
620 'title': 'Bringing Beach Life to Texas',
621 'description': 'The Pool Kings give a family a day at the beach in their own backyard.',
625 'skip': 'Available for Premium users',
627 'url': 'https://watch.diynetwork.com/video/pool-kings-diy-network/bringing-beach-life-to-texas',
628 'only_matching': True,
632 _DISCO_API_PARAMS
= {
633 'disco_host': 'us1-prod-direct.watch.diynetwork.com',
639 class DiscoveryLifeIE(DiscoveryPlusBaseIE
):
640 _VALID_URL
= r
'https?://(?:www\.)?discoverylife\.com/video' + DPlayBaseIE
._PATH
_REGEX
642 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
645 'display_id': 'surviving-death-discovery-life-atve-us/bodily-trauma',
647 'title': 'Bodily Trauma',
648 'description': 'Meet three people who tested the limits of the human body.',
652 'skip': 'Available for Premium users',
654 'url': 'https://www.discoverylife.com/video/surviving-death-discovery-life-atve-us/bodily-trauma',
655 'only_matching': True,
659 _DISCO_API_PARAMS
= {
660 'disco_host': 'us1-prod-direct.discoverylife.com',
666 class AnimalPlanetIE(DiscoveryPlusBaseIE
):
667 _VALID_URL
= r
'https?://(?:www\.)?animalplanet\.com/video' + DPlayBaseIE
._PATH
_REGEX
669 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
672 'display_id': 'north-woods-law-animal-planet/squirrel-showdown',
674 'title': 'Squirrel Showdown',
675 'description': 'A woman is suspected of being in possession of flying squirrel kits.',
677 'episode_number': 11,
679 'skip': 'Available for Premium users',
681 'url': 'https://www.animalplanet.com/video/north-woods-law-animal-planet/squirrel-showdown',
682 'only_matching': True,
686 _DISCO_API_PARAMS
= {
687 'disco_host': 'us1-prod-direct.animalplanet.com',
693 class TLCIE(DiscoveryPlusBaseIE
):
694 _VALID_URL
= r
'https?://(?:go\.)?tlc\.com/video' + DPlayBaseIE
._PATH
_REGEX
696 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
699 'display_id': 'my-600-lb-life-tlc/melissas-story-part-1',
701 'title': 'Melissas Story (Part 1)',
702 'description': 'At 650 lbs, Melissa is ready to begin her seven-year weight loss journey.',
706 'skip': 'Available for Premium users',
708 'url': 'https://go.tlc.com/video/my-600-lb-life-tlc/melissas-story-part-1',
709 'only_matching': True,
713 _DISCO_API_PARAMS
= {
714 'disco_host': 'us1-prod-direct.tlc.com',
720 class MotorTrendIE(DiscoveryPlusBaseIE
):
721 _VALID_URL
= r
'https?://(?:watch\.)?motortrend\.com/video' + DPlayBaseIE
._PATH
_REGEX
723 'url': 'https://watch.motortrend.com/video/car-issues-motortrend-atve-us/double-dakotas',
726 'display_id': 'double-dakotas',
728 'title': 'Double Dakotas',
729 'description': 'Tylers buy-one-get-one Dakota deal has the Wizard pulling double duty.',
733 'skip': 'Available for Premium users',
735 'url': 'https://watch.motortrend.com/video/car-issues-motortrend-atve-us/double-dakotas',
736 'only_matching': True,
740 _DISCO_API_PARAMS
= {
741 'disco_host': 'us1-prod-direct.watch.motortrend.com',
747 class MotorTrendOnDemandIE(DiscoveryPlusBaseIE
):
748 _VALID_URL
= r
'https?://(?:www\.)?motortrendondemand\.com/detail' + DPlayBaseIE
._PATH
_REGEX
750 'url': 'https://www.motortrendondemand.com/detail/wheelstanding-dump-truck-stubby-bobs-comeback/37699/784',
753 'display_id': 'wheelstanding-dump-truck-stubby-bobs-comeback/37699',
755 'title': 'Wheelstanding Dump Truck! Stubby Bob’s Comeback',
756 'description': 'md5:996915abe52a1c3dfc83aecea3cce8e7',
758 'episode_number': 52,
759 'episode': 'Episode 52',
760 'season': 'Season 5',
761 'thumbnail': r
're:^https?://.+\.jpe?g$',
762 'timestamp': 1388534401,
763 'duration': 1887.345,
764 'creator': 'Originals',
765 'series': 'Roadkill',
766 'upload_date': '20140101',
772 _DISCO_API_PARAMS
= {
773 'disco_host': 'us1-prod-direct.motortrendondemand.com',
774 'realm': 'motortrend',
778 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
780 'x-disco-params': f
'realm={realm}',
781 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:4.39.1-gi1',
782 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
786 class DiscoveryPlusIE(DiscoveryPlusBaseIE
):
787 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.com/(?!it/)(?:\w{2}/)?video' + DPlayBaseIE
._PATH
_REGEX
789 'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
792 'display_id': 'property-brothers-forever-home/food-and-family',
794 'title': 'Food and Family',
795 'description': 'The brothers help a Richmond family expand their single-level home.',
796 'duration': 2583.113,
797 'timestamp': 1609304400,
798 'upload_date': '20201230',
800 'series': 'Property Brothers: Forever Home',
804 'skip': 'Available for Premium users',
806 'url': 'https://discoveryplus.com/ca/video/bering-sea-gold-discovery-ca/goldslingers',
807 'only_matching': True,
810 _PRODUCT
= 'dplus_us'
811 _DISCO_API_PARAMS
= {
812 'disco_host': 'us1-prod-direct.discoveryplus.com',
818 class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE
):
819 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.in/videos?' + DPlayBaseIE
._PATH
_REGEX
821 'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
825 'display_id': 'how-do-they-do-it/fugu-and-more',
826 'title': 'Fugu and More',
827 'description': 'The Japanese catch, prepare and eat the deadliest fish on the planet.',
829 'timestamp': 1582309800,
830 'upload_date': '20200221',
831 'series': 'How Do They Do It?',
834 'creator': 'Discovery Channel',
835 'thumbnail': r
're:https://.+\.jpeg',
836 'episode': 'Episode 2',
837 'season': 'Season 8',
841 'skip_download': True,
845 _PRODUCT
= 'dplus-india'
846 _DISCO_API_PARAMS
= {
847 'disco_host': 'ap2-prod-direct.discoveryplus.in',
848 'realm': 'dplusindia',
850 'domain': 'https://www.discoveryplus.in/',
853 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
855 'x-disco-params': 'realm=%s' % realm
,
856 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
857 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
861 class DiscoveryNetworksDeIE(DPlayBaseIE
):
862 _VALID_URL
= r
'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
865 'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
869 'title': 'Die Welt da draußen',
870 'description': 'md5:61033c12b73286e409d99a41742ef608',
871 'timestamp': 1554069600,
872 'upload_date': '20190331',
874 'season': 'Season 1',
875 'series': 'Breaking Amish',
877 'tags': ['new york', 'großstadt', 'amische', 'landleben', 'modern', 'infos', 'tradition', 'herausforderung'],
878 'display_id': 'breaking-amish/die-welt-da-drauen',
879 'episode': 'Episode 1',
880 'duration': 2625.024,
882 'thumbnail': r
're:https://.+\.jpg',
885 'skip_download': True,
888 'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
889 'only_matching': True,
891 'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
892 'only_matching': True,
894 'url': 'https://tlc.de/sendungen/breaking-amish/die-welt-da-drauen/',
895 'only_matching': True,
898 def _real_extract(self
, url
):
899 domain
, programme
, alternate_id
= self
._match
_valid
_url
(url
).groups()
900 country
= 'GB' if domain
== 'dplay.co.uk' else 'DE'
901 realm
= 'questuk' if country
== 'GB' else domain
.replace('.', '')
902 return self
._get
_disco
_api
_info
(
903 url
, '%s/%s' % (programme
, alternate_id
),
904 'sonic-eu1-prod.disco-api.com', realm
, country
)
907 class DiscoveryPlusShowBaseIE(DPlayBaseIE
):
909 def _entries(self
, show_name
):
911 'x-disco-client': self
._X
_CLIENT
,
912 'x-disco-params': f
'realm={self._REALM}',
913 'referer': self
._DOMAIN
,
914 'Authentication': self
._get
_auth
(self
._BASE
_API
, None, self
._REALM
),
916 show_json
= self
._download
_json
(
917 f
'{self._BASE_API}cms/routes/{self._SHOW_STR}/{show_name}?include=default',
918 video_id
=show_name
, headers
=headers
)['included'][self
._INDEX
]['attributes']['component']
919 show_id
= show_json
['mandatoryParams'].split('=')[-1]
920 season_url
= self
._BASE
_API
+ 'content/videos?sort=episodeNumber&filter[seasonNumber]={}&filter[show.id]={}&page[size]=100&page[number]={}'
921 for season
in show_json
['filters'][0]['options']:
922 season_id
= season
['id']
923 total_pages
, page_num
= 1, 0
924 while page_num
< total_pages
:
925 season_json
= self
._download
_json
(
926 season_url
.format(season_id
, show_id
, str(page_num
+ 1)), show_name
, headers
=headers
,
927 note
='Downloading season %s JSON metadata%s' % (season_id
, ' page %d' % page_num
if page_num
else ''))
929 total_pages
= try_get(season_json
, lambda x
: x
['meta']['totalPages'], int) or 1
930 episodes_json
= season_json
['data']
931 for episode
in episodes_json
:
932 video_path
= episode
['attributes']['path']
933 yield self
.url_result(
934 '%svideos/%s' % (self
._DOMAIN
, video_path
),
935 ie
=self
._VIDEO
_IE
.ie_key(), video_id
=episode
.get('id') or video_path
)
938 def _real_extract(self
, url
):
939 show_name
= self
._match
_valid
_url
(url
).group('show_name')
940 return self
.playlist_result(self
._entries
(show_name
), playlist_id
=show_name
)
943 class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE
):
944 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.com/it/video' + DPlayBaseIE
._PATH
_REGEX
946 'url': 'https://www.discoveryplus.com/it/video/i-signori-della-neve/stagione-2-episodio-1-i-preparativi',
947 'only_matching': True,
949 'url': 'https://www.discoveryplus.com/it/video/super-benny/trailer',
950 'only_matching': True,
953 _PRODUCT
= 'dplus_us'
954 _DISCO_API_PARAMS
= {
955 'disco_host': 'eu1-prod-direct.discoveryplus.com',
960 def _update_disco_api_headers(self
, headers
, disco_base
, display_id
, realm
):
962 'x-disco-params': 'realm=%s' % realm
,
963 'x-disco-client': f
'WEB:UNKNOWN:{self._PRODUCT}:25.2.6',
964 'Authorization': self
._get
_auth
(disco_base
, display_id
, realm
),
968 class DiscoveryPlusItalyShowIE(DiscoveryPlusShowBaseIE
):
969 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.it/programmi/(?P<show_name>[^/]+)/?(?:[?#]|$)'
971 'url': 'https://www.discoveryplus.it/programmi/deal-with-it-stai-al-gioco',
972 'playlist_mincount': 168,
974 'id': 'deal-with-it-stai-al-gioco',
978 _BASE_API
= 'https://disco-api.discoveryplus.it/'
979 _DOMAIN
= 'https://www.discoveryplus.it/'
980 _X_CLIENT
= 'WEB:UNKNOWN:dplay-client:2.6.0'
982 _SHOW_STR
= 'programmi'
987 class DiscoveryPlusIndiaShowIE(DiscoveryPlusShowBaseIE
):
988 _VALID_URL
= r
'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
990 'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
991 'playlist_mincount': 140,
993 'id': 'how-do-they-do-it',
997 _BASE_API
= 'https://ap2-prod-direct.discoveryplus.in/'
998 _DOMAIN
= 'https://www.discoveryplus.in/'
999 _X_CLIENT
= 'WEB:UNKNOWN:dplus-india:prod'
1000 _REALM
= 'dplusindia'
1003 _VIDEO_IE
= DiscoveryPlusIndiaIE