mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 09:01:43 +00:00
[ie/MLBArticle] Fix extractor (#9021)
Closes #8682 Authored by: HobbyistDev
This commit is contained in:
parent
4310b6650e
commit
50e06e21a6
@ -355,11 +355,11 @@ class MLBArticleIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '36db7394-343c-4ea3-b8ca-ead2e61bca9a',
|
'id': '36db7394-343c-4ea3-b8ca-ead2e61bca9a',
|
||||||
'title': 'Machado\'s grab draws hilarious irate reaction',
|
'title': 'Machado\'s grab draws hilarious irate reaction',
|
||||||
'modified_timestamp': 1650130737,
|
'modified_timestamp': 1675888370,
|
||||||
'description': 'md5:a19d4eb0487b2cb304e9a176f6b67676',
|
'description': 'md5:a19d4eb0487b2cb304e9a176f6b67676',
|
||||||
'modified_date': '20220416',
|
'modified_date': '20230208',
|
||||||
},
|
},
|
||||||
'playlist_count': 2,
|
'playlist_mincount': 2,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -367,15 +367,13 @@ def _real_extract(self, url):
|
|||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
apollo_cache_json = self._search_json(r'window\.initState\s*=', webpage, 'window.initState', display_id)['apolloCache']
|
apollo_cache_json = self._search_json(r'window\.initState\s*=', webpage, 'window.initState', display_id)['apolloCache']
|
||||||
|
|
||||||
content_data_id = traverse_obj(
|
content_real_info = traverse_obj(
|
||||||
apollo_cache_json, ('ROOT_QUERY', lambda k, _: k.startswith('getForgeContent'), 'id'), get_all=False)
|
apollo_cache_json, ('ROOT_QUERY', lambda k, _: k.startswith('getArticle')), get_all=False)
|
||||||
|
|
||||||
content_real_info = apollo_cache_json[content_data_id]
|
|
||||||
|
|
||||||
return self.playlist_from_matches(
|
return self.playlist_from_matches(
|
||||||
traverse_obj(content_real_info, ('parts', lambda _, v: v['typename'] == 'Video', 'id')),
|
traverse_obj(content_real_info, ('parts', lambda _, v: v['__typename'] == 'Video' or v['type'] == 'video')),
|
||||||
getter=lambda x: f'https://www.mlb.com/video/{apollo_cache_json[x]["slug"]}',
|
getter=lambda x: f'https://www.mlb.com/video/{x["slug"]}',
|
||||||
ie=MLBVideoIE, playlist_id=content_real_info.get('_translationId'),
|
ie=MLBVideoIE, playlist_id=content_real_info.get('translationId'),
|
||||||
title=self._html_search_meta('og:title', webpage),
|
title=self._html_search_meta('og:title', webpage),
|
||||||
description=content_real_info.get('summary'),
|
description=content_real_info.get('summary'),
|
||||||
modified_timestamp=parse_iso8601(content_real_info.get('lastUpdatedDate')))
|
modified_timestamp=parse_iso8601(content_real_info.get('lastUpdatedDate')))
|
||||||
|
Loading…
Reference in New Issue
Block a user