11
11
ExtractorError ,
12
12
float_or_none ,
13
13
int_or_none ,
14
+ strip_or_none ,
14
15
unified_timestamp ,
15
16
)
16
17
17
18
18
19
class DPlayIE (InfoExtractor ):
20
+ _PATH_REGEX = r'/(?P<id>[^/]+/[^/?#]+)'
19
21
_VALID_URL = r'''(?x)https?://
20
22
(?P<domain>
21
23
(?:www\.)?(?P<host>d
@@ -25,7 +27,7 @@ class DPlayIE(InfoExtractor):
25
27
)
26
28
)|
27
29
(?P<subdomain_country>es|it)\.dplay\.com
28
- )/[^/]+/(?P<id>[^/]+/[^/?#]+) '''
30
+ )/[^/]+''' + _PATH_REGEX
29
31
30
32
_TESTS = [{
31
33
# 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):
272
274
'id' : video_id ,
273
275
'display_id' : display_id ,
274
276
'title' : title ,
275
- 'description' : info .get ('description' ),
277
+ 'description' : strip_or_none ( info .get ('description' ) ),
276
278
'duration' : float_or_none (info .get ('videoDuration' ), 1000 ),
277
279
'timestamp' : unified_timestamp (info .get ('publishStart' )),
278
280
'series' : series ,
@@ -295,7 +297,7 @@ def _real_extract(self, url):
295
297
296
298
297
299
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
299
301
_TESTS = [{
300
302
'url' : 'https://www.discoveryplus.com/video/property-brothers-forever-home/food-and-family' ,
301
303
'info_dict' : {
@@ -335,3 +337,32 @@ def _real_extract(self, url):
335
337
display_id = self ._match_id (url )
336
338
return self ._get_disco_api_info (
337
339
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' )
0 commit comments