diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:11 +0000 |
commit | fd5a06560caab95c71a2e2e805efa8d0f3a696a0 (patch) | |
tree | e1c600b8612bc4b301e2f51b875fcd835c5008cc /yt_dlp/extractor/tv2.py | |
parent | Releasing progress-linux version 2024.05.27-1~progress7.99u1. (diff) | |
download | yt-dlp-fd5a06560caab95c71a2e2e805efa8d0f3a696a0.tar.xz yt-dlp-fd5a06560caab95c71a2e2e805efa8d0f3a696a0.zip |
Merging upstream version 2024.07.01.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | yt_dlp/extractor/tv2.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/yt_dlp/extractor/tv2.py b/yt_dlp/extractor/tv2.py index 9b19e79..601ecab 100644 --- a/yt_dlp/extractor/tv2.py +++ b/yt_dlp/extractor/tv2.py @@ -52,10 +52,10 @@ class TV2IE(InfoExtractor): format_urls = [] for protocol in self._PROTOCOLS: try: - data = self._download_json('https://api.sumo.tv2.no/play/%s?stream=%s' % (video_id, protocol), + data = self._download_json(f'https://api.sumo.tv2.no/play/{video_id}?stream={protocol}', video_id, 'Downloading playabck JSON', headers={'content-type': 'application/json'}, - data='{"device":{"id":"1-1-1","name":"Nettleser (HTML)"}}'.encode())['playback'] + data=b'{"device":{"id":"1-1-1","name":"Nettleser (HTML)"}}')['playback'] except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 401: error = self._parse_json(e.cause.response.read().decode(), video_id)['error'] @@ -71,7 +71,7 @@ class TV2IE(InfoExtractor): video_url = item.get('url') if not video_url or video_url in format_urls: continue - format_id = '%s-%s' % (protocol.lower(), item.get('type')) + format_id = '{}-{}'.format(protocol.lower(), item.get('type')) if not self._is_valid_url(video_url, video_id, format_id): continue format_urls.append(video_url) @@ -97,9 +97,9 @@ class TV2IE(InfoExtractor): self.report_drm(video_id) thumbnails = [{ - 'id': type, + 'id': thumb_type, 'url': thumb_url, - } for type, thumb_url in (asset.get('images') or {}).items()] + } for thumb_type, thumb_url in (asset.get('images') or {}).items()] return { 'id': video_id, @@ -151,7 +151,7 @@ class TV2ArticleIE(InfoExtractor): assets.append(asset) entries = [ - self.url_result('http://www.tv2.no/v/%s' % asset_id, 'TV2') + self.url_result(f'http://www.tv2.no/v/{asset_id}', 'TV2') for asset_id in assets] title = remove_end(self._og_search_title(webpage), ' - TV2.no') @@ -196,7 +196,7 @@ class KatsomoIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - api_base = 'http://%s/api/web/asset/%s' % (self._API_DOMAIN, video_id) + api_base = f'http://{self._API_DOMAIN}/api/web/asset/{video_id}' asset = self._download_json( api_base + '.json', video_id, @@ -209,7 +209,7 @@ class KatsomoIE(InfoExtractor): for protocol in self._PROTOCOLS: try: data = self._download_json( - api_base + '/play.json?protocol=%s&videoFormat=SMIL+ISMUSP' % protocol, + api_base + f'/play.json?protocol={protocol}&videoFormat=SMIL+ISMUSP', video_id, 'Downloading play JSON')['playback'] except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 401: @@ -232,7 +232,7 @@ class KatsomoIE(InfoExtractor): video_url = item.get('url') if not video_url or video_url in format_urls: continue - format_id = '%s-%s' % (protocol.lower(), item.get('mediaFormat')) + format_id = '{}-{}'.format(protocol.lower(), item.get('mediaFormat')) if not self._is_valid_url(video_url, video_id, format_id): continue format_urls.append(video_url) |