import uuid
from .common import InfoExtractor
-from ..compat import compat_HTTPError
+from ..networking.exceptions import HTTPError
from ..utils import (
- determine_ext,
ExtractorError,
+ determine_ext,
float_or_none,
int_or_none,
remove_start,
return f'Bearer {token}'
def _process_errors(self, e, geo_countries):
- info = self._parse_json(e.cause.read().decode('utf-8'), None)
+ info = self._parse_json(e.cause.response.read().decode('utf-8'), None)
error = info['errors'][0]
error_code = error.get('code')
if error_code == 'access.denied.geoblocked':
return streaming_list
def _get_disco_api_info(self, url, display_id, disco_host, realm, country, domain=''):
+ country = self.get_param('geo_bypass_country') or country
geo_countries = [country.upper()]
self._initialize_geo_bypass({
'countries': geo_countries,
'include': 'images,primaryChannel,show,tags'
})
except ExtractorError as e:
- if isinstance(e.cause, compat_HTTPError) and e.cause.code == 400:
+ if isinstance(e.cause, HTTPError) and e.cause.status == 400:
self._process_errors(e, geo_countries)
raise
video_id = video['data']['id']
streaming = self._download_video_playback_info(
disco_base, video_id, headers)
except ExtractorError as e:
- if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
+ if isinstance(e.cause, HTTPError) and e.cause.status == 403:
self._process_errors(e, geo_countries)
raise
for format_dict in streaming:
video_id, headers=headers, data=json.dumps({
'deviceInfo': {
'adBlocker': False,
+ 'drmSupported': False,
},
'videoId': video_id,
- 'wisteriaProperties': {
- 'platform': 'desktop',
- 'product': self._PRODUCT,
- },
+ 'wisteriaProperties': {},
}).encode('utf-8'))['data']['attributes']['streaming']
def _real_extract(self, url):
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'
})
-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):
_SHOW_STR = 'show'
_INDEX = 4
_VIDEO_IE = DiscoveryPlusIndiaIE
+
+
+class GlobalCyclingNetworkPlusIE(DiscoveryPlusBaseIE):
+ _VALID_URL = r'https?://plus\.globalcyclingnetwork\.com/watch/(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://plus.globalcyclingnetwork.com/watch/1397691',
+ 'info_dict': {
+ 'id': '1397691',
+ 'ext': 'mp4',
+ 'title': 'The Athertons: Mountain Biking\'s Fastest Family',
+ 'description': 'md5:75a81937fcd8b989eec6083a709cd837',
+ 'thumbnail': 'https://us1-prod-images.disco-api.com/2021/03/04/eb9e3026-4849-3001-8281-9356466f0557.png',
+ 'series': 'gcn',
+ 'creator': 'Gcn',
+ 'upload_date': '20210309',
+ 'timestamp': 1615248000,
+ 'duration': 2531.0,
+ 'tags': [],
+ },
+ 'skip': 'Subscription required',
+ 'params': {'skip_download': 'm3u8'},
+ }]
+
+ _PRODUCT = 'web'
+ _DISCO_API_PARAMS = {
+ 'disco_host': 'disco-api-prod.globalcyclingnetwork.com',
+ 'realm': 'gcn',
+ 'country': 'us',
+ }
+
+ def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
+ headers.update({
+ 'x-disco-params': f'realm={realm}',
+ 'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:27.3.2',
+ 'Authorization': self._get_auth(disco_base, display_id, realm),
+ })