[extractor/fifa] Fix extractor (#4272)

Authored by: ischmidt20
This commit is contained in:
ischmidt20 2022-07-09 03:53:49 -04:00 committed by GitHub
parent 65493f64e1
commit 170a031386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,21 +16,21 @@ class FifaIE(InfoExtractor):
'title': 'Italy v France | Final | 2006 FIFA World Cup Germany™ | Full Match Replay', 'title': 'Italy v France | Final | 2006 FIFA World Cup Germany™ | Full Match Replay',
'description': 'md5:f4520d0ee80529c8ba4134a7d692ff8b', 'description': 'md5:f4520d0ee80529c8ba4134a7d692ff8b',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Replay'], 'categories': ['FIFA Tournaments'],
'thumbnail': 'https://digitalhub.fifa.com/transform/fa6f0b3e-a2e9-4cf7-9f32-53c57bcb7360/2006_Final_ITA_FRA', 'thumbnail': 'https://digitalhub.fifa.com/transform/fa6f0b3e-a2e9-4cf7-9f32-53c57bcb7360/2006_Final_ITA_FRA',
'duration': 8164, 'duration': 8165,
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
}, { }, {
'url': 'https://www.fifa.com/fifaplus/pt/watch/1cg5r5Qt6Qt12ilkDgb1sV', 'url': 'https://www.fifa.com/fifaplus/pt/watch/1cg5r5Qt6Qt12ilkDgb1sV',
'info_dict': { 'info_dict': {
'id': '1cg5r5Qt6Qt12ilkDgb1sV', 'id': '1cg5r5Qt6Qt12ilkDgb1sV',
'title': 'Brasil x Alemanha | Semifinais | Copa do Mundo FIFA Brasil 2014 | Compacto', 'title': 'Brazil v Germany | Semi-finals | 2014 FIFA World Cup Brazil™ | Extended Highlights',
'description': 'md5:ba4ffcc084802b062beffc3b4c4b19d6', 'description': 'md5:d908c74ee66322b804ae2e521b02a855',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Highlights'], 'categories': ['FIFA Tournaments', 'Highlights'],
'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB', 'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB',
'duration': 901, 'duration': 902,
'release_timestamp': 1404777600, 'release_timestamp': 1404777600,
'release_date': '20140708', 'release_date': '20140708',
}, },
@ -39,8 +39,8 @@ class FifaIE(InfoExtractor):
'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp', 'url': 'https://www.fifa.com/fifaplus/fr/watch/3C6gQH9C2DLwzNx7BMRQdp',
'info_dict': { 'info_dict': {
'id': '3C6gQH9C2DLwzNx7BMRQdp', 'id': '3C6gQH9C2DLwzNx7BMRQdp',
'title': 'Le but de Josimar contre le Irlande du Nord | Buts classiques', 'title': 'Josimar goal against Northern Ireland | Classic Goals',
'description': 'md5:16f9f789f09960bfe7220fe67af31f34', 'description': 'md5:cbe7e7bb52f603c9f1fe9a4780fe983b',
'ext': 'mp4', 'ext': 'mp4',
'categories': ['FIFA Tournaments', 'Goal'], 'categories': ['FIFA Tournaments', 'Goal'],
'duration': 28, 'duration': 28,
@ -56,27 +56,13 @@ def _real_extract(self, url):
preconnect_link = self._search_regex( preconnect_link = self._search_regex(
r'<link[^>]+rel\s*=\s*"preconnect"[^>]+href\s*=\s*"([^"]+)"', webpage, 'Preconnect Link') r'<link[^>]+rel\s*=\s*"preconnect"[^>]+href\s*=\s*"([^"]+)"', webpage, 'Preconnect Link')
json_data = self._download_json(
f'{preconnect_link}/video/GetVideoPlayerData/{video_id}', video_id,
'Downloading Video Player Data', query={'includeIdents': True, 'locale': locale})
video_details = self._download_json( video_details = self._download_json(
f'{preconnect_link}/sections/videoDetails/{video_id}', video_id, 'Downloading Video Details', fatal=False) f'{preconnect_link}/sections/videoDetails/{video_id}', video_id, 'Downloading Video Details', fatal=False)
preplay_parameters = self._download_json( preplay_parameters = self._download_json(
f'{preconnect_link}/video/GetVerizonPreplayParameters', video_id, 'Downloading Preplay Parameters', query={ f'{preconnect_link}/video/GetVerizonPreplayParameters/{video_id}', video_id, 'Downloading Preplay Parameters')['preplayParameters']
'entryId': video_id,
'assetId': json_data['verizonAssetId'],
'useExternalId': False,
'requiresToken': json_data['requiresToken'],
'adConfig': 'fifaplusvideo',
'prerollAds': True,
'adVideoId': json_data['externalVerizonAssetId'],
'preIdentId': json_data['preIdentId'],
'postIdentId': json_data['postIdentId'],
})
cid = f'{json_data["preIdentId"]},{json_data["verizonAssetId"]},{json_data["postIdentId"]}' cid = preplay_parameters['contentId']
content_data = self._download_json( content_data = self._download_json(
f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={ f'https://content.uplynk.com/preplay/{cid}/multiple.json', video_id, 'Downloading Content Data', query={
'v': preplay_parameters['preplayAPIVersion'], 'v': preplay_parameters['preplayAPIVersion'],
@ -98,9 +84,9 @@ def _real_extract(self, url):
return { return {
'id': video_id, 'id': video_id,
'title': json_data.get('title'), 'title': video_details.get('title'),
'description': json_data.get('description'), 'description': video_details.get('description'),
'duration': int_or_none(json_data.get('duration')), 'duration': int_or_none(video_details.get('duration')),
'release_timestamp': unified_timestamp(video_details.get('dateOfRelease')), 'release_timestamp': unified_timestamp(video_details.get('dateOfRelease')),
'categories': traverse_obj(video_details, (('videoCategory', 'videoSubcategory'),)), 'categories': traverse_obj(video_details, (('videoCategory', 'videoSubcategory'),)),
'thumbnail': traverse_obj(video_details, ('backgroundImage', 'src')), 'thumbnail': traverse_obj(video_details, ('backgroundImage', 'src')),