mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-29 11:44:33 +01:00
[youtube] Return sub name in subtitle dict
Document the subtitles 'name' key in extractor/common.py
This commit is contained in:
parent
a115e07594
commit
c23c35c9c1
@ -247,6 +247,8 @@ class InfoExtractor(object):
|
||||
entry and one of:
|
||||
* "data": The subtitles file contents
|
||||
* "url": A URL pointing to the subtitles file
|
||||
* "name": (optional) Name or description of the subtitles, used
|
||||
when there are more than one subtitles file for this language
|
||||
"ext" will be calculated from URL if missing
|
||||
automatic_captions: Like 'subtitles', used by the YoutubeIE for
|
||||
automatically generated captions
|
||||
|
@ -1448,18 +1448,21 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
for track in subs_doc.findall('track'):
|
||||
lang = track.attrib['lang_code']
|
||||
if lang in sub_lang_list:
|
||||
continue
|
||||
sub_formats = sub_lang_list[lang]
|
||||
else:
|
||||
sub_formats = []
|
||||
for ext in self._SUBTITLE_FORMATS:
|
||||
name = track.attrib['name']
|
||||
params = compat_urllib_parse_urlencode({
|
||||
'lang': lang,
|
||||
'v': video_id,
|
||||
'fmt': ext,
|
||||
'name': track.attrib['name'].encode('utf-8'),
|
||||
'name': name.encode('utf-8'),
|
||||
})
|
||||
sub_formats.append({
|
||||
'url': 'https://www.youtube.com/api/timedtext?' + params,
|
||||
'ext': ext,
|
||||
'name': name,
|
||||
})
|
||||
sub_lang_list[lang] = sub_formats
|
||||
if not sub_lang_list:
|
||||
|
Loading…
Reference in New Issue
Block a user