mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 00:11:26 +01:00
Compare commits
No commits in common. "c5fc6b25c72a20c29bd5a9bebb2020dd943d7f2c" and "39c1aec0c51a10b8e7c094b67d394bf718a49284" have entirely different histories.
c5fc6b25c7
...
39c1aec0c5
|
@ -40,36 +40,8 @@ class NintendoIE(InfoExtractor):
|
|||
'age_limit': 6,
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.nintendo.com/us/nintendo-direct/50-fact-extravaganza/',
|
||||
'info_dict': {
|
||||
'ext': 'mp4',
|
||||
'id': 'j0BBGzfw0pQ',
|
||||
'channel_follower_count': int,
|
||||
'view_count': int,
|
||||
'description': 'Learn new details about Super Smash Bros. for Wii U, which launches on November 21.',
|
||||
'duration': 2123,
|
||||
'availability': 'public',
|
||||
'thumbnail': 'https://i.ytimg.com/vi_webp/j0BBGzfw0pQ/maxresdefault.webp',
|
||||
'timestamp': 1414047600,
|
||||
'channel_id': 'UCGIY_O-8vW4rfX98KlMkvRg',
|
||||
'chapters': 'count:53',
|
||||
'heatmap': 'count:100',
|
||||
'upload_date': '20141023',
|
||||
'uploader_id': '@NintendoAmerica',
|
||||
'playable_in_embed': True,
|
||||
'categories': ['Gaming'],
|
||||
'display_id': '50-fact-extravaganza',
|
||||
'channel': 'Nintendo of America',
|
||||
'tags': ['Comic Mischief', 'Cartoon Violence', 'Mild Suggestive Themes'],
|
||||
'like_count': int,
|
||||
'channel_url': 'https://www.youtube.com/channel/UCGIY_O-8vW4rfX98KlMkvRg',
|
||||
'age_limit': 10,
|
||||
'uploader_url': 'https://www.youtube.com/@NintendoAmerica',
|
||||
'comment_count': int,
|
||||
'live_status': 'not_live',
|
||||
'uploader': 'Nintendo of America',
|
||||
'title': '50-FACT Extravaganza',
|
||||
},
|
||||
'url': 'https://www.nintendo.com/en/nintendo-direct/09-04-2019/',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
def _create_asset_url(self, path):
|
||||
|
@ -78,8 +50,8 @@ class NintendoIE(InfoExtractor):
|
|||
def _real_extract(self, url):
|
||||
locale, slug = self._match_valid_url(url).group('locale', 'slug')
|
||||
|
||||
language, _, country = (locale or 'US').rpartition('-')
|
||||
parsed_locale = f'{language.lower() or "en"}_{country.upper()}'
|
||||
language, _, country = (locale or 'en').partition('-')
|
||||
parsed_locale = f'{language.lower()}_{country.upper() or "US"}'
|
||||
self.write_debug(f'Using locale {parsed_locale} (from {locale})', only_once=True)
|
||||
|
||||
response = self._download_json('https://graph.nintendo.com/', slug, query={
|
||||
|
@ -104,7 +76,16 @@ class NintendoIE(InfoExtractor):
|
|||
if errors:
|
||||
raise ExtractorError(f'GraphQL API error: {errors or "Unknown error"}')
|
||||
|
||||
result = traverse_obj(direct_info, {
|
||||
asset_id = traverse_obj(direct_info, ('video', 'publicId', {str}))
|
||||
if not asset_id:
|
||||
self.raise_no_formats('Could not find any video formats', video_id=slug)
|
||||
|
||||
result = {
|
||||
'display_id': slug,
|
||||
'formats': self._extract_m3u8_formats(
|
||||
self._create_asset_url(f'/video/upload/sp_full_hd/v1/{asset_id}.m3u8'), slug),
|
||||
}
|
||||
result.update(traverse_obj(direct_info, {
|
||||
'id': ('id', {str}),
|
||||
'title': ('name', {str}),
|
||||
'timestamp': ('startDate', {unified_timestamp}),
|
||||
|
@ -112,20 +93,8 @@ class NintendoIE(InfoExtractor):
|
|||
'age_limit': ('contentRating', 'order', {int}),
|
||||
'tags': ('contentDescriptors', ..., 'label', {str}),
|
||||
'thumbnail': ('thumbnail', {self._create_asset_url}),
|
||||
})
|
||||
result['display_id'] = slug
|
||||
|
||||
asset_id = traverse_obj(direct_info, ('video', 'publicId', {str}))
|
||||
if not asset_id:
|
||||
youtube_id = traverse_obj(direct_info, ('liveStream', {str}))
|
||||
if not youtube_id:
|
||||
self.raise_no_formats('Could not find any video formats', video_id=slug)
|
||||
|
||||
return self.url_result(youtube_id, **result, url_transparent=True)
|
||||
|
||||
}))
|
||||
if asset_id.startswith('Legacy Videos/'):
|
||||
result['_old_archive_ids'] = [make_archive_id(self, asset_id[14:])]
|
||||
result['formats'] = self._extract_m3u8_formats(
|
||||
self._create_asset_url(f'/video/upload/sp_full_hd/v1/{asset_id}.m3u8'), slug)
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue
Block a user