mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
parent
3615bfe1b4
commit
f2bb33a986
|
@ -271,20 +271,22 @@ def _talk_info(self, url, video_name):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_subtitles(self, video_id, talk_info):
|
def _get_subtitles(self, video_id, talk_info):
|
||||||
languages = [lang['languageCode'] for lang in talk_info.get('languages', [])]
|
sub_lang_list = {}
|
||||||
if languages:
|
for language in try_get(
|
||||||
sub_lang_list = {}
|
talk_info,
|
||||||
for l in languages:
|
(lambda x: x['downloads']['languages'],
|
||||||
sub_lang_list[l] = [
|
lambda x: x['languages']), list):
|
||||||
{
|
lang_code = language.get('languageCode') or language.get('ianaCode')
|
||||||
'url': 'http://www.ted.com/talks/subtitles/id/%s/lang/%s/format/%s' % (video_id, l, ext),
|
if not lang_code:
|
||||||
'ext': ext,
|
continue
|
||||||
}
|
sub_lang_list[lang_code] = [
|
||||||
for ext in ['ted', 'srt']
|
{
|
||||||
]
|
'url': 'http://www.ted.com/talks/subtitles/id/%s/lang/%s/format/%s' % (video_id, lang_code, ext),
|
||||||
return sub_lang_list
|
'ext': ext,
|
||||||
else:
|
}
|
||||||
return {}
|
for ext in ['ted', 'srt']
|
||||||
|
]
|
||||||
|
return sub_lang_list
|
||||||
|
|
||||||
def _watch_info(self, url, name):
|
def _watch_info(self, url, name):
|
||||||
webpage = self._download_webpage(url, name)
|
webpage = self._download_webpage(url, name)
|
||||||
|
|
Loading…
Reference in a new issue