diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-05 09:06:10 +0000 |
commit | 137f07c27a88b07df57df5b2cdebebe3c7722bac (patch) | |
tree | 4ebdcbea6b540f69c40ba0be6ac766008030d149 /yt_dlp/extractor/wimtv.py | |
parent | Adding debian version 2024.05.27-1. (diff) | |
download | yt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.tar.xz yt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.zip |
Merging upstream version 2024.07.01.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/wimtv.py')
-rw-r--r-- | yt_dlp/extractor/wimtv.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/yt_dlp/extractor/wimtv.py b/yt_dlp/extractor/wimtv.py index d7d77c0..000d143 100644 --- a/yt_dlp/extractor/wimtv.py +++ b/yt_dlp/extractor/wimtv.py @@ -10,14 +10,14 @@ from ..utils import ( class WimTVIE(InfoExtractor): _player = None _UUID_RE = r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}' - _VALID_URL = r'''(?x: + _VALID_URL = rf'''(?x: https?://platform\.wim\.tv/ (?: (?:embed/)?\? |\#/webtv/.+?/ ) (?P<type>vod|live|cast)[=/] - (?P<id>%s).*?)''' % _UUID_RE + (?P<id>{_UUID_RE}).*?)''' _EMBED_REGEX = [rf'<iframe[^>]+src=["\'](?P<url>{_VALID_URL})'] _TESTS = [{ # vod stream @@ -28,7 +28,7 @@ class WimTVIE(InfoExtractor): 'ext': 'mp4', 'title': 'AMA SUPERCROSS 2020 - R2 ST. LOUIS', 'duration': 6481, - 'thumbnail': r're:https?://.+?/thumbnail/.+?/720$' + 'thumbnail': r're:https?://.+?/thumbnail/.+?/720$', }, 'params': { 'skip_download': True, @@ -66,7 +66,7 @@ class WimTVIE(InfoExtractor): 'vars': [{ 'regex': r'appAuth = "(.+?)"', 'variable': 'app_auth', - }] + }], }, { 'url': 'https://platform.wim.tv/common/config/endpointconfig.js', 'vars': [{ @@ -75,7 +75,7 @@ class WimTVIE(InfoExtractor): }, { 'regex': r'PRODUCTION_HOSTNAME_THUMB\s*\+\s*"(.+?)"', 'variable': 'thumb_server_path', - }] + }], }] for data in datas: @@ -83,13 +83,13 @@ class WimTVIE(InfoExtractor): for var in data['vars']: val = self._search_regex(var['regex'], temp, msg_id) if not val: - raise ExtractorError('%s not found' % var['variable']) + raise ExtractorError('{} not found'.format(var['variable'])) self._player[var['variable']] = val def _generate_token(self): json = self._download_json( 'https://platform.wim.tv/wimtv-server/oauth/token', 'Token generation', - headers={'Authorization': 'Basic %s' % self._player['app_auth']}, + headers={'Authorization': 'Basic {}'.format(self._player['app_auth'])}, data=urlencode_postdata({'grant_type': 'client_credentials'})) token = json.get('access_token') if not token: @@ -101,7 +101,7 @@ class WimTVIE(InfoExtractor): return None if not self._player.get('thumb_server_path'): self._player['thumb_server_path'] = '' - return '%s%s/asset/thumbnail/%s/%s' % ( + return '{}{}/asset/thumbnail/{}/{}'.format( self._player['thumb_server'], self._player['thumb_server_path'], thumb_id, width) @@ -118,11 +118,11 @@ class WimTVIE(InfoExtractor): is_live = False token = self._generate_token() json = self._download_json( - 'https://platform.wim.tv/wimtv-server/api/public/%s/%s/play' % ( - stream_type, video_id), video_id, - headers={'Authorization': 'Bearer %s' % token, - 'Content-Type': 'application/json'}, - data=bytes('{}', 'utf-8')) + f'https://platform.wim.tv/wimtv-server/api/public/{stream_type}/{video_id}/play', + video_id, headers={ + 'Authorization': f'Bearer {token}', + 'Content-Type': 'application/json', + }, data=b'{}') formats = [] for src in json.get('srcs') or []: |