diff options
Diffstat (limited to 'yt_dlp/extractor/redbulltv.py')
-rw-r--r-- | yt_dlp/extractor/redbulltv.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/yt_dlp/extractor/redbulltv.py b/yt_dlp/extractor/redbulltv.py index fac51b9..ceeef52 100644 --- a/yt_dlp/extractor/redbulltv.py +++ b/yt_dlp/extractor/redbulltv.py @@ -57,7 +57,7 @@ class RedBullTVIE(InfoExtractor): 'os_family': 'http', }) if session.get('code') == 'error': - raise ExtractorError('%s said: %s' % ( + raise ExtractorError('{} said: {}'.format( self.IE_NAME, session['message'])) token = session['token'] @@ -65,20 +65,19 @@ class RedBullTVIE(InfoExtractor): video = self._download_json( 'https://api.redbull.tv/v3/products/' + video_id, video_id, note='Downloading video information', - headers={'Authorization': token} + headers={'Authorization': token}, ) except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 404: error_message = self._parse_json( e.cause.response.read().decode(), video_id)['error'] - raise ExtractorError('%s said: %s' % ( - self.IE_NAME, error_message), expected=True) + raise ExtractorError(f'{self.IE_NAME} said: {error_message}', expected=True) raise title = video['title'].strip() formats, subtitles = self._extract_m3u8_formats_and_subtitles( - 'https://dms.redbull.tv/v3/%s/%s/playlist.m3u8' % (video_id, token), + f'https://dms.redbull.tv/v3/{video_id}/{token}/playlist.m3u8', video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls') for resource in video.get('resources', []): @@ -86,13 +85,13 @@ class RedBullTVIE(InfoExtractor): splitted_resource = resource.split('_') if splitted_resource[2]: subtitles.setdefault('en', []).append({ - 'url': 'https://resources.redbull.tv/%s/%s' % (video_id, resource), + 'url': f'https://resources.redbull.tv/{video_id}/{resource}', 'ext': splitted_resource[2], }) subheading = video.get('subheading') if subheading: - title += ' - %s' % subheading + title += f' - {subheading}' return { 'id': video_id, @@ -135,7 +134,7 @@ class RedBullEmbedIE(RedBullTVIE): # XXX: Do not subclass from concrete IE %s %s } -}''' % (rrn_id, self._VIDEO_ESSENSE_TMPL % 'LiveVideo', self._VIDEO_ESSENSE_TMPL % 'VideoResource'), +}''' % (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) @@ -155,7 +154,7 @@ class RedBullTVRrnContentIE(InfoExtractor): def _real_extract(self, url): region, lang, rrn_id = self._match_valid_url(url).groups() - rrn_id += ':%s-%s' % (lang, region.upper()) + rrn_id += f':{lang}-{region.upper()}' return self.url_result( 'https://www.redbull.com/embed/' + rrn_id, RedBullEmbedIE.ie_key(), rrn_id) @@ -209,7 +208,7 @@ class RedBullIE(InfoExtractor): regions.append('LAT') if lang in self._INT_FALLBACK_LIST: regions.append('INT') - locale = '>'.join(['%s-%s' % (lang, reg) for reg in regions]) + locale = '>'.join([f'{lang}-{reg}' for reg in regions]) rrn_id = self._download_json( 'https://www.redbull.com/v3/api/graphql/v1/v3/query/' + locale, |