mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 07:28:19 +01:00
fix typo; compat code
This commit is contained in:
parent
77debf548f
commit
81075d168e
|
@ -16,8 +16,7 @@
|
|||
|
||||
|
||||
class FifaBaseIE(InfoExtractor):
|
||||
def _real_initialize(self):
|
||||
self._HEADERS = {
|
||||
_HEADERS = {
|
||||
'content-type': 'application/json; charset=UTF-8',
|
||||
'x-chili-accept-language': 'en',
|
||||
'x-chili-api-version': '1.1',
|
||||
|
@ -31,9 +30,17 @@ def _real_initialize(self):
|
|||
'x-chili-manifest-properties': 'subtitles',
|
||||
'x-chili-streaming-proto': 'https',
|
||||
}
|
||||
device_info = self._download_json(
|
||||
'https://www.plus.fifa.com/gatekeeper/api/v1/devices/', None, 'Getting device info',
|
||||
headers=self._HEADERS,
|
||||
|
||||
def _call_api(self, path, video_id, note=None, headers=None, query=None, data=None):
|
||||
return self._download_json(
|
||||
f'https://www.plus.fifa.com/{path}', video_id, note, headers={
|
||||
**self._HEADERS,
|
||||
**(headers or {}),
|
||||
}, query=query, data=data)
|
||||
|
||||
def _real_initialize(self):
|
||||
device_info = self._call_api(
|
||||
'gatekeeper/api/v1/devices/', None, 'Getting device info',
|
||||
data=json.dumps({
|
||||
'appVersion': '2.6.93',
|
||||
'displayName': None,
|
||||
|
@ -51,13 +58,6 @@ def _real_initialize(self):
|
|||
}).encode())
|
||||
self._HEADERS['x-chili-device-id'] = device_info['id']
|
||||
|
||||
def _call_api(self, path, video_id, note=None, headers=None, query=None, data=None):
|
||||
return self._download_json(
|
||||
f'https://www.plus.fifa.com/{path}', video_id, note, headers={
|
||||
**self._HEADERS,
|
||||
**(headers or {}),
|
||||
}, query=query, data=data)
|
||||
|
||||
def _extract_video(self, video_info, video_id):
|
||||
formats = []
|
||||
subtitles = {}
|
||||
|
@ -104,7 +104,7 @@ def _extract_video(self, video_info, video_id):
|
|||
|
||||
|
||||
class FifaPlayerIE(FifaBaseIE):
|
||||
_VALID_URL = r'https?://(www\.)?plus\.fifa\.com/(?:\w{2})/player/(?P<id>[\w-]+)/?\?(?:[^#]+&)?catalogId=(?P<display_id>[\w-]+)'
|
||||
_VALID_URL = r'https?://(www\.)?plus\.fifa\.com/(?:\w{2})/player/(?P<id>[\w-]+)/?\?(?:[^#]+&)?catalogId=(?P<catalog_id>[\w-]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.plus.fifa.com/en/player/f67b9d46-38c3-4e38-bbf3-89cf14cbcc1a?catalogId=b9c32230-1426-46d0-8448-ca824ae48603&entryPoint=Slider',
|
||||
'info_dict': {
|
||||
|
@ -133,10 +133,10 @@ class FifaPlayerIE(FifaBaseIE):
|
|||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id, catelog_id = self._match_valid_url(url).group('id', 'display_id')
|
||||
video_id, catalog_id = self._match_valid_url(url).group('id', 'catalog_id')
|
||||
video_asset = self._call_api(
|
||||
'flux-capacitor/api/v1/videoasset', video_id,
|
||||
'Downloading video asset', query={'catalog': catelog_id})
|
||||
'Downloading video asset', query={'catalog': catalog_id})
|
||||
video_info = traverse_obj(video_asset, (lambda _, v: v['id'] == video_id), get_all=False)
|
||||
if not video_info:
|
||||
raise ExtractorError('Unable to extract video info')
|
||||
|
@ -329,7 +329,6 @@ def _real_extract(self, url):
|
|||
video_ids = []
|
||||
if hero_video_entry_id := page_info.get('heroVideoEntryId'):
|
||||
video_ids.append(hero_video_entry_id)
|
||||
|
||||
video_ids.extend(traverse_obj(page_info, (
|
||||
'richtext', 'content', lambda _, v: v['data']['target']['contentTypesCheckboxValue'] == 'Video',
|
||||
'data', 'target', 'sys', 'id')))
|
||||
|
|
Loading…
Reference in New Issue
Block a user