from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
- determine_ext,
ExtractorError,
+ determine_ext,
float_or_none,
int_or_none,
remove_start,
self._initialize_geo_bypass({
'countries': geo_countries,
})
- disco_base = 'https://%s/' % disco_host
+ disco_base = f'https://{disco_host}/'
headers = {
'Referer': url,
}
'fields[show]': 'name',
'fields[tag]': 'name',
'fields[video]': 'description,episodeNumber,name,publishStart,seasonNumber,videoDuration',
- 'include': 'images,primaryChannel,show,tags'
+ 'include': 'images,primaryChannel,show,tags',
})
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
video_id, headers=headers, data=json.dumps({
'deviceInfo': {
'adBlocker': False,
+ 'drmSupported': False,
},
'videoId': video_id,
- 'wisteriaProperties': {
- 'platform': 'desktop',
- 'product': self._PRODUCT,
- },
- }).encode('utf-8'))['data']['attributes']['streaming']
+ 'wisteriaProperties': {},
+ }).encode())['data']['attributes']['streaming']
def _real_extract(self, url):
return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PARAMS)
class MotorTrendOnDemandIE(DiscoveryPlusBaseIE):
- _VALID_URL = r'https?://(?:www\.)?motortrendondemand\.com/detail' + DPlayBaseIE._PATH_REGEX
+ _VALID_URL = r'https?://(?:www\.)?motortrend(?:ondemand\.com|\.com/plus)/detail' + DPlayBaseIE._PATH_REGEX
_TESTS = [{
'url': 'https://www.motortrendondemand.com/detail/wheelstanding-dump-truck-stubby-bobs-comeback/37699/784',
'info_dict': {
'upload_date': '20140101',
'tags': [],
},
+ }, {
+ 'url': 'https://www.motortrend.com/plus/detail/roadworthy-rescues-teaser-trailer/4922860/',
+ 'info_dict': {
+ 'id': '4922860',
+ 'ext': 'mp4',
+ 'title': 'Roadworthy Rescues | Teaser Trailer',
+ 'description': 'Derek Bieri helps Freiburger and Finnegan with their \'68 big-block Dart.',
+ 'display_id': 'roadworthy-rescues-teaser-trailer/4922860',
+ 'creator': 'Originals',
+ 'series': 'Roadworthy Rescues',
+ 'thumbnail': r're:^https?://.+\.jpe?g$',
+ 'upload_date': '20220907',
+ 'timestamp': 1662523200,
+ 'duration': 1066.356,
+ 'tags': [],
+ },
+ }, {
+ 'url': 'https://www.motortrend.com/plus/detail/ugly-duckling/2450033/12439',
+ 'only_matching': True,
}]
_PRODUCT = 'MTOD'
},
'params': {
'skip_download': True,
- }
+ },
}]
_PRODUCT = 'dplus-india'
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
headers.update({
- 'x-disco-params': 'realm=%s' % realm,
+ 'x-disco-params': f'realm={realm}',
'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
'Authorization': self._get_auth(disco_base, display_id, realm),
})
-class DiscoveryNetworksDeIE(DPlayBaseIE):
+class DiscoveryNetworksDeIE(DiscoveryPlusBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
_TESTS = [{
+ 'url': 'https://dmax.de/sendungen/goldrausch-in-australien/german-gold',
+ 'info_dict': {
+ 'id': '4756322',
+ 'ext': 'mp4',
+ 'title': 'German Gold',
+ 'description': 'md5:f3073306553a8d9b40e6ac4cdbf09fc6',
+ 'display_id': 'goldrausch-in-australien/german-gold',
+ 'episode': 'Episode 1',
+ 'episode_number': 1,
+ 'season': 'Season 5',
+ 'season_number': 5,
+ 'series': 'Goldrausch in Australien',
+ 'duration': 2648.0,
+ 'upload_date': '20230517',
+ 'timestamp': 1684357500,
+ 'creators': ['DMAX'],
+ 'thumbnail': 'https://eu1-prod-images.disco-api.com/2023/05/09/f72fb510-7992-3b12-af7f-f16a2c22d1e3.jpeg',
+ 'tags': ['schatzsucher', 'schatz', 'nugget', 'bodenschätze', 'down under', 'australien', 'goldrausch'],
+ },
+ 'params': {'skip_download': 'm3u8'},
+ }, {
'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
'info_dict': {
'id': '78867',
'season_number': 1,
'thumbnail': r're:https://.+\.jpg',
},
- 'params': {
- 'skip_download': True,
- },
+ 'skip': '404 Not Found',
}, {
'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
'only_matching': True,
country = 'GB' if domain == 'dplay.co.uk' else 'DE'
realm = 'questuk' if country == 'GB' else domain.replace('.', '')
return self._get_disco_api_info(
- url, '%s/%s' % (programme, alternate_id),
- 'sonic-eu1-prod.disco-api.com', realm, country)
+ url, f'{programme}/{alternate_id}', 'eu1-prod.disco-api.com', realm, country)
+
+ def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
+ headers.update({
+ 'x-disco-params': f'realm={realm}',
+ 'x-disco-client': 'Alps:HyogaPlayer:0.0.0',
+ 'Authorization': self._get_auth(disco_base, display_id, realm),
+ })
class DiscoveryPlusShowBaseIE(DPlayBaseIE):
while page_num < total_pages:
season_json = self._download_json(
season_url.format(season_id, show_id, str(page_num + 1)), show_name, headers=headers,
- note='Downloading season %s JSON metadata%s' % (season_id, ' page %d' % page_num if page_num else ''))
+ note='Downloading season {} JSON metadata{}'.format(season_id, f' page {page_num}' if page_num else ''))
if page_num == 0:
total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
episodes_json = season_json['data']
for episode in episodes_json:
video_path = episode['attributes']['path']
yield self.url_result(
- '%svideos/%s' % (self._DOMAIN, video_path),
+ f'{self._DOMAIN}videos/{video_path}',
ie=self._VIDEO_IE.ie_key(), video_id=episode.get('id') or video_path)
page_num += 1
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
headers.update({
- 'x-disco-params': 'realm=%s' % realm,
+ 'x-disco-params': f'realm={realm}',
'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:25.2.6',
'Authorization': self._get_auth(disco_base, display_id, realm),
})