mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
parent
fbb888a3d5
commit
1765c6039e
1 changed files with 3 additions and 2 deletions
|
@ -137,14 +137,15 @@ def _get_subtitles(self, video_id, domain):
|
||||||
url_sub = sub.get('url')
|
url_sub = sub.get('url')
|
||||||
if not url_sub:
|
if not url_sub:
|
||||||
continue
|
continue
|
||||||
locale = sub.get('captionCountrySimpleName')
|
locale = sub.get('captionSimpleName') or 'en'
|
||||||
sub = self._download_json(f'{domain}{url_sub}', video_id, fatal=False,
|
sub = self._download_json(f'{domain}{url_sub}', video_id, fatal=False,
|
||||||
note=f'Download subtitle for locale {sub.get("name")} ({locale})') or {}
|
note=f'Download subtitle for locale {sub.get("name")} ({locale})') or {}
|
||||||
sub_url = url_or_none(sub.get('info'))
|
sub_url = url_or_none(sub.get('info'))
|
||||||
if not sub_url:
|
if not sub_url:
|
||||||
continue
|
continue
|
||||||
subtitles.setdefault(locale or 'en', []).append({
|
subtitles.setdefault(locale.lower(), []).append({
|
||||||
'url': sub_url,
|
'url': sub_url,
|
||||||
|
'name': sub.get('name'),
|
||||||
'ext': 'srt'
|
'ext': 'srt'
|
||||||
})
|
})
|
||||||
return subtitles
|
return subtitles
|
||||||
|
|
Loading…
Reference in a new issue