diff options
Diffstat (limited to '')
-rw-r--r-- | yt_dlp/extractor/spreaker.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/yt_dlp/extractor/spreaker.py b/yt_dlp/extractor/spreaker.py index 36a9bd2..d1df459 100644 --- a/yt_dlp/extractor/spreaker.py +++ b/yt_dlp/extractor/spreaker.py @@ -1,7 +1,6 @@ import itertools from .common import InfoExtractor -from ..compat import compat_str from ..utils import ( float_or_none, int_or_none, @@ -16,26 +15,26 @@ def _extract_episode(data, episode_id=None): title = data['title'] download_url = data['download_url'] - series = try_get(data, lambda x: x['show']['title'], compat_str) - uploader = try_get(data, lambda x: x['author']['fullname'], compat_str) + series = try_get(data, lambda x: x['show']['title'], str) + uploader = try_get(data, lambda x: x['author']['fullname'], str) thumbnails = [] for image in ('image_original', 'image_medium', 'image'): - image_url = url_or_none(data.get('%s_url' % image)) + image_url = url_or_none(data.get(f'{image}_url')) if image_url: thumbnails.append({'url': image_url}) def stats(key): return int_or_none(try_get( data, - (lambda x: x['%ss_count' % key], - lambda x: x['stats']['%ss' % key]))) + (lambda x: x[f'{key}s_count'], + lambda x: x['stats'][f'{key}s']))) def duration(key): return float_or_none(data.get(key), scale=1000) return { - 'id': compat_str(episode_id or data['episode_id']), + 'id': str(episode_id or data['episode_id']), 'url': download_url, 'display_id': data.get('permalink'), 'title': title, @@ -97,7 +96,7 @@ class SpreakerIE(InfoExtractor): def _real_extract(self, url): episode_id = self._match_id(url) data = self._download_json( - 'https://api.spreaker.com/v2/episodes/%s' % episode_id, + f'https://api.spreaker.com/v2/episodes/{episode_id}', episode_id)['response']['episode'] return _extract_episode(data, episode_id) @@ -116,7 +115,7 @@ class SpreakerPageIE(InfoExtractor): (r'data-episode_id=["\'](?P<id>\d+)', r'episode_id\s*:\s*(?P<id>\d+)'), webpage, 'episode id') return self.url_result( - 'https://api.spreaker.com/episode/%s' % episode_id, + f'https://api.spreaker.com/episode/{episode_id}', ie=SpreakerIE.ie_key(), video_id=episode_id) @@ -133,8 +132,8 @@ class SpreakerShowIE(InfoExtractor): def _entries(self, show_id): for page_num in itertools.count(1): episodes = self._download_json( - 'https://api.spreaker.com/show/%s/episodes' % show_id, - show_id, note='Downloading JSON page %d' % page_num, query={ + f'https://api.spreaker.com/show/{show_id}/episodes', + show_id, note=f'Downloading JSON page {page_num}', query={ 'page': page_num, 'max_per_page': 100, }) @@ -169,5 +168,5 @@ class SpreakerShowPageIE(InfoExtractor): show_id = self._search_regex( r'show_id\s*:\s*(?P<id>\d+)', webpage, 'show id') return self.url_result( - 'https://api.spreaker.com/show/%s' % show_id, + f'https://api.spreaker.com/show/{show_id}', ie=SpreakerShowIE.ie_key(), video_id=show_id) |