diff options
Diffstat (limited to '')
-rw-r--r-- | yt_dlp/extractor/vice.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/yt_dlp/extractor/vice.py b/yt_dlp/extractor/vice.py index b072d9d..3739a37 100644 --- a/yt_dlp/extractor/vice.py +++ b/yt_dlp/extractor/vice.py @@ -7,7 +7,6 @@ import time from .adobepass import AdobePassIE from .common import InfoExtractor from .youtube import YoutubeIE -from ..compat import compat_str from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, @@ -28,7 +27,7 @@ class ViceBaseIE(InfoExtractor): %s(locale: "%s", %s: "%s"%s) { %s } -}''' % (resource, locale, resource_key, resource_id, args, fields), +}''' % (resource, locale, resource_key, resource_id, args, fields), # noqa: UP031 })['data'][resource] @@ -127,7 +126,7 @@ class ViceIE(ViceBaseIE, AdobePassIE): query.update({ 'exp': exp, - 'sign': hashlib.sha512(('%s:GET:%d' % (video_id, exp)).encode()).hexdigest(), + 'sign': hashlib.sha512(f'{video_id}:GET:{exp}'.encode()).hexdigest(), 'skipadstitching': 1, 'platform': 'desktop', 'rn': random.randint(10000, 100000), @@ -135,14 +134,13 @@ class ViceIE(ViceBaseIE, AdobePassIE): try: preplay = self._download_json( - 'https://vms.vice.com/%s/video/preplay/%s' % (locale, video_id), + f'https://vms.vice.com/{locale}/video/preplay/{video_id}', video_id, query=query) except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status in (400, 401): error = json.loads(e.cause.response.read().decode()) error_message = error.get('error_description') or error['details'] - raise ExtractorError('%s said: %s' % ( - self.IE_NAME, error_message), expected=True) + raise ExtractorError(f'{self.IE_NAME} said: {error_message}', expected=True) raise video_data = preplay['video'] @@ -157,7 +155,7 @@ class ViceIE(ViceBaseIE, AdobePassIE): cc_url = subtitle.get('url') if not cc_url: continue - language_code = try_get(subtitle, lambda x: x['languages'][0]['language_code'], compat_str) or 'en' + language_code = try_get(subtitle, lambda x: x['languages'][0]['language_code'], str) or 'en' subtitles.setdefault(language_code, []).append({ 'url': cc_url, }) @@ -171,7 +169,7 @@ class ViceIE(ViceBaseIE, AdobePassIE): 'duration': int_or_none(video_data.get('video_duration')), 'timestamp': int_or_none(video_data.get('created_at'), 1000), 'age_limit': parse_age_limit(video_data.get('video_rating') or rating), - 'series': try_get(video_data, lambda x: x['show']['base']['display_title'], compat_str), + 'series': try_get(video_data, lambda x: x['show']['base']['display_title'], str), 'episode_number': int_or_none(episode.get('episode_number')), 'episode_id': str_or_none(episode.get('id') or video_data.get('episode_id')), 'season_number': int_or_none(season.get('season_number')), @@ -202,7 +200,7 @@ class ViceShowIE(ViceBaseIE): def _fetch_page(self, locale, show_id, page): videos = self._call_api('videos', 'show_id', show_id, locale, '''body id - url''', ', page: %d, per_page: %d' % (page + 1, self._PAGE_SIZE)) + url''', f', page: {page + 1}, per_page: {self._PAGE_SIZE}') for video in videos: yield self.url_result( video['url'], ViceIE.ie_key(), video.get('id')) |