diff options
author | Remita Amine <remitamine@gmail.com> | 2019-10-15 19:54:53 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2019-10-15 19:54:53 +0100 |
commit | 30eb05cb41d95a73f7baff8da9ec1d6a50b08f50 (patch) | |
tree | 45c02c35c4239c51e4f0c0e721eec299f6b5ab22 /youtube_dl | |
parent | 2af01c0293db53dc80c552df3986d0e088b65b76 (diff) |
[globo] extract subtitles(closes #22713)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/globo.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/youtube_dl/extractor/globo.py b/youtube_dl/extractor/globo.py index b9c400a57..9ad1d95fb 100644 --- a/youtube_dl/extractor/globo.py +++ b/youtube_dl/extractor/globo.py @@ -102,10 +102,18 @@ class GloboIE(InfoExtractor): title = video['title'] formats = [] + subtitles = {} for resource in video['resources']: resource_id = resource.get('_id') 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 security = self._download_json( @@ -165,7 +173,8 @@ class GloboIE(InfoExtractor): 'duration': duration, 'uploader': uploader, 'uploader_id': uploader_id, - 'formats': formats + 'formats': formats, + 'subtitles': subtitles, } |