[youtube] Fix subtitle names for age-gated videos

Related: https://github.com/iv-org/invidious/pull/2205#issuecomment-868680486
This commit is contained in:
pukkandan 2021-06-25 23:10:31 +05:30
parent d3f62c1967
commit 49c258e18d
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
2 changed files with 4 additions and 2 deletions

View file

@ -3084,7 +3084,7 @@ class YoutubeDL(object):
'Available %s for %s:' % (name, video_id)) 'Available %s for %s:' % (name, video_id))
def _row(lang, formats): def _row(lang, formats):
exts, names = zip(*((f['ext'], f.get('name', 'unknown')) for f in reversed(formats))) exts, names = zip(*((f['ext'], f.get('name') or 'unknown') for f in reversed(formats)))
if len(set(names)) == 1: if len(set(names)) == 1:
names = [] if names[0] == 'unknown' else names[:1] names = [] if names[0] == 'unknown' else names[:1]
return [lang, ', '.join(names), ', '.join(exts)] return [lang, ', '.join(names), ', '.join(exts)]

View file

@ -2307,7 +2307,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
continue continue
process_language( process_language(
automatic_captions, base_url, translation_language_code, automatic_captions, base_url, translation_language_code,
try_get(translation_language, lambda x: x['languageName']['simpleText']), try_get(translation_language, (
lambda x: x['languageName']['simpleText'],
lambda x: x['languageName']['runs'][0]['text'])),
{'tlang': translation_language_code}) {'tlang': translation_language_code})
info['automatic_captions'] = automatic_captions info['automatic_captions'] = automatic_captions
info['subtitles'] = subtitles info['subtitles'] = subtitles