Skip to content

Commit 3997efb

Browse files
committed
[dplay] add support for de.hgtv.com (closes ytdl-org#28182)
1 parent a7356df commit 3997efb

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

youtube_dl/extractor/dplay.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
ExtractorError,
1212
float_or_none,
1313
int_or_none,
14+
strip_or_none,
1415
unified_timestamp,
1516
)
1617

1718

1819
class DPlayIE(InfoExtractor):
20+
_PATH_REGEX = r'/(?P<id>[^/]+/[^/?#]+)'
1921
_VALID_URL = r'''(?x)https?://
2022
(?P<domain>
2123
(?:www\.)?(?P<host>d
@@ -25,7 +27,7 @@ class DPlayIE(InfoExtractor):
2527
)
2628
)|
2729
(?P<subdomain_country>es|it)\.dplay\.com
28-
)/[^/]+/(?P<id>[^/]+/[^/?#]+)'''
30+
)/[^/]+''' + _PATH_REGEX
2931

3032
_TESTS = [{
3133
# non geo restricted, via secure api, unsigned download hls URL
@@ -272,7 +274,7 @@ def _get_disco_api_info(self, url, display_id, disco_host, realm, country):
272274
'id': video_id,
273275
'display_id': display_id,
274276
'title': title,
275-
'description': info.get('description'),
277+
'description': strip_or_none(info.get('description')),
276278
'duration': float_or_none(info.get('videoDuration'), 1000),
277279
'timestamp': unified_timestamp(info.get('publishStart')),
278280
'series': series,
@@ -295,7 +297,7 @@ def _real_extract(self, url):
295297

296298

297299
class DiscoveryPlusIE(DPlayIE):
298-
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/video/(?P<id>[^/]+/[^/]+)'
300+
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.com/video' + DPlayIE._PATH_REGEX
299301
_TESTS = [{
300302
'url': 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family',
301303
'info_dict': {
@@ -335,3 +337,32 @@ def _real_extract(self, url):
335337
display_id = self._match_id(url)
336338
return self._get_disco_api_info(
337339
url, display_id, 'us1-prod-direct.discoveryplus.com', 'go', 'us')
340+
341+
342+
class HGTVDeIE(DPlayIE):
343+
_VALID_URL = r'https?://de\.hgtv\.com/sendungen' + DPlayIE._PATH_REGEX
344+
_TESTS = [{
345+
'url': 'https://de.hgtv.com/sendungen/tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette/',
346+
'info_dict': {
347+
'id': '151205',
348+
'display_id': 'tiny-house-klein-aber-oho/wer-braucht-schon-eine-toilette',
349+
'ext': 'mp4',
350+
'title': 'Wer braucht schon eine Toilette',
351+
'description': 'md5:05b40a27e7aed2c9172de34d459134e2',
352+
'duration': 1177.024,
353+
'timestamp': 1595705400,
354+
'upload_date': '20200725',
355+
'creator': 'HGTV',
356+
'series': 'Tiny House - klein, aber oho',
357+
'season_number': 3,
358+
'episode_number': 3,
359+
},
360+
'params': {
361+
'format': 'bestvideo',
362+
},
363+
}]
364+
365+
def _real_extract(self, url):
366+
display_id = self._match_id(url)
367+
return self._get_disco_api_info(
368+
url, display_id, 'eu1-prod.disco-api.com', 'hgtv', 'de')

youtube_dl/extractor/extractors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@
291291
from .dplay import (
292292
DPlayIE,
293293
DiscoveryPlusIE,
294+
HGTVDeIE,
294295
)
295296
from .dreisat import DreiSatIE
296297
from .drbonanza import DRBonanzaIE

0 commit comments

Comments
 (0)