mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 01:18:30 +00:00
Merge f6d97b3060
into 73bf102116
This commit is contained in:
commit
c6986c6c1f
@ -1,5 +1,4 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..networking.exceptions import HTTPError
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
@ -61,6 +60,7 @@ def extract_info(self, video_id):
|
|||||||
self.IE_NAME, session['message']))
|
self.IE_NAME, session['message']))
|
||||||
token = session['token']
|
token = session['token']
|
||||||
|
|
||||||
|
video = {}
|
||||||
try:
|
try:
|
||||||
video = self._download_json(
|
video = self._download_json(
|
||||||
'https://api.redbull.tv/v3/products/' + video_id,
|
'https://api.redbull.tv/v3/products/' + video_id,
|
||||||
@ -68,13 +68,9 @@ def extract_info(self, video_id):
|
|||||||
headers={'Authorization': token},
|
headers={'Authorization': token},
|
||||||
)
|
)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, HTTPError) and e.cause.status == 404:
|
self.report_warning(f'Downloading video information failed, {e.cause.response.read().decode()}')
|
||||||
error_message = self._parse_json(
|
|
||||||
e.cause.response.read().decode(), video_id)['error']
|
|
||||||
raise ExtractorError(f'{self.IE_NAME} said: {error_message}', expected=True)
|
|
||||||
raise
|
|
||||||
|
|
||||||
title = video['title'].strip()
|
title = (video.get('title') or 'title').strip()
|
||||||
|
|
||||||
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
||||||
f'https://dms.redbull.tv/v3/{video_id}/{token}/playlist.m3u8',
|
f'https://dms.redbull.tv/v3/{video_id}/{token}/playlist.m3u8',
|
||||||
@ -123,19 +119,11 @@ class RedBullEmbedIE(RedBullTVIE): # XXX: Do not subclass from concrete IE
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
rrn_id = self._match_id(url)
|
rrn_id = self._match_id(url)
|
||||||
asset_id = self._download_json(
|
data = self._download_json(
|
||||||
'https://edge-graphql.crepo-production.redbullaws.com/v1/graphql',
|
url_or_request=f'https://api-player.redbull.com/rbcom/videoresource?videoId={rrn_id}',
|
||||||
rrn_id, headers={
|
video_id=rrn_id,
|
||||||
'Accept': 'application/json',
|
)
|
||||||
'API-KEY': 'e90a1ff11335423998b100c929ecc866',
|
asset_id = data['assetId']
|
||||||
}, query={
|
|
||||||
'query': '''{
|
|
||||||
resource(id: "%s", enforceGeoBlocking: false) {
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
}
|
|
||||||
}''' % (rrn_id, self._VIDEO_ESSENSE_TMPL % 'LiveVideo', self._VIDEO_ESSENSE_TMPL % 'VideoResource'), # noqa: UP031
|
|
||||||
})['data']['resource']['videoEssence']['attributes']['assetId']
|
|
||||||
return self.extract_info(asset_id)
|
return self.extract_info(asset_id)
|
||||||
|
|
||||||
|
|
||||||
@ -210,13 +198,19 @@ def _real_extract(self, url):
|
|||||||
regions.append('INT')
|
regions.append('INT')
|
||||||
locale = '>'.join([f'{lang}-{reg}' for reg in regions])
|
locale = '>'.join([f'{lang}-{reg}' for reg in regions])
|
||||||
|
|
||||||
rrn_id = self._download_json(
|
response_data = self._download_json(
|
||||||
'https://www.redbull.com/v3/api/graphql/v1/v3/query/' + locale,
|
'https://www.redbull.com/v3/api/graphql/v1/v3/feed/' + locale,
|
||||||
display_id, query={
|
display_id,
|
||||||
|
query={
|
||||||
|
'page[limit]': '1',
|
||||||
|
'disableUsageRestrictions': 'true',
|
||||||
'filter[type]': filter_type,
|
'filter[type]': filter_type,
|
||||||
'filter[uriSlug]': display_id,
|
'filter[uriSlug]': display_id,
|
||||||
'rb3Schema': 'v1:hero',
|
'rb3Schema': 'v1:pageConfig',
|
||||||
})['data']['id']
|
'rb3PageUrl': f'/{region}-{lang}/{filter_type}/{display_id}',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
rrn_id = response_data['data']['id']
|
||||||
|
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
'https://www.redbull.com/embed/' + rrn_id,
|
'https://www.redbull.com/embed/' + rrn_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user