mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-09-12 04:22:35 +02:00
[globo] extract subtitles(closes #22713)
This commit is contained in:
parent
2af01c0293
commit
30eb05cb41
@ -102,10 +102,18 @@ class GloboIE(InfoExtractor):
|
|||||||
title = video['title']
|
title = video['title']
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
subtitles = {}
|
||||||
for resource in video['resources']:
|
for resource in video['resources']:
|
||||||
resource_id = resource.get('_id')
|
resource_id = resource.get('_id')
|
||||||
resource_url = resource.get('url')
|
resource_url = resource.get('url')
|
||||||
if not resource_id or not resource_url:
|
resource_type = resource.get('type')
|
||||||
|
if not resource_url or (resource_type == 'media' and not resource_id) or resource_type not in ('subtitle', 'media'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if resource_type == 'subtitle':
|
||||||
|
subtitles.setdefault(resource.get('language') or 'por', []).append({
|
||||||
|
'url': resource_url,
|
||||||
|
})
|
||||||
continue
|
continue
|
||||||
|
|
||||||
security = self._download_json(
|
security = self._download_json(
|
||||||
@ -165,7 +173,8 @@ class GloboIE(InfoExtractor):
|
|||||||
'duration': duration,
|
'duration': duration,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
'formats': formats
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user