mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
[youtube] Fix automatic captions
This commit is contained in:
parent
d97b0e3241
commit
23d17e4beb
1 changed files with 3 additions and 2 deletions
|
@ -369,6 +369,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
# RTMP (unnamed)
|
# RTMP (unnamed)
|
||||||
'_rtmp': {'protocol': 'rtmp'},
|
'_rtmp': {'protocol': 'rtmp'},
|
||||||
}
|
}
|
||||||
|
_SUBTITLE_FORMATS = ('ttml', 'vtt')
|
||||||
|
|
||||||
IE_NAME = 'youtube'
|
IE_NAME = 'youtube'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
|
@ -918,7 +919,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
if lang in sub_lang_list:
|
if lang in sub_lang_list:
|
||||||
continue
|
continue
|
||||||
sub_formats = []
|
sub_formats = []
|
||||||
for ext in ['ttml', 'vtt']:
|
for ext in self._SUBTITLE_FORMATS:
|
||||||
params = compat_urllib_parse.urlencode({
|
params = compat_urllib_parse.urlencode({
|
||||||
'lang': lang,
|
'lang': lang,
|
||||||
'v': video_id,
|
'v': video_id,
|
||||||
|
@ -988,7 +989,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
for lang_node in caption_list.findall('target'):
|
for lang_node in caption_list.findall('target'):
|
||||||
sub_lang = lang_node.attrib['lang_code']
|
sub_lang = lang_node.attrib['lang_code']
|
||||||
sub_formats = []
|
sub_formats = []
|
||||||
for ext in ['sbv', 'vtt', 'srt']:
|
for ext in self._SUBTITLE_FORMATS:
|
||||||
params = compat_urllib_parse.urlencode({
|
params = compat_urllib_parse.urlencode({
|
||||||
'lang': original_lang,
|
'lang': original_lang,
|
||||||
'tlang': sub_lang,
|
'tlang': sub_lang,
|
||||||
|
|
Loading…
Reference in a new issue