improve documentation on subtitles

This commit is contained in:
Lauren Liberda 2021-04-09 18:41:55 +02:00
parent 860a8f2061
commit 9c0e55eb79

View file

@ -204,6 +204,14 @@ class InfoExtractor(object):
* downloader_options A dictionary of downloader options as * downloader_options A dictionary of downloader options as
described in FileDownloader described in FileDownloader
Internally, extractors can include subtitles in the format
list, in this format:
* _subtitle The subtitle object, in the same format
as in subtitles field
* _key The tag for the provided subtitle
This is never included in the output JSON, but moved
into the subtitles field.
url: Final video URL. url: Final video URL.
ext: Video filename extension. ext: Video filename extension.
format: The video format, defaults to ext (used for --get-format) format: The video format, defaults to ext (used for --get-format)
@ -247,11 +255,15 @@ class InfoExtractor(object):
subtitles: The available subtitles as a dictionary in the format subtitles: The available subtitles as a dictionary in the format
{tag: subformats}. "tag" is usually a language code, and {tag: subformats}. "tag" is usually a language code, and
"subformats" is a list sorted from lower to higher "subformats" is a list sorted from lower to higher
preference, each element is a dictionary with the "ext" preference, each element is a dictionary,
entry and one of: which must contain one of these values:
* "data": The subtitles file contents * "data": The subtitles file contents
* "url": A URL pointing to the subtitles file * "url": A URL pointing to the subtitles file
"ext" will be calculated from URL if missing These values are guessed based on other data, if missing,
in a way analogic to the formats data:
* "ext" - subtitle extension name (vtt, srt, ...)
* "proto" - download protocol (https, http, m3u8, ...)
* "http_headers"
automatic_captions: Like 'subtitles', used by the YoutubeIE for automatic_captions: Like 'subtitles', used by the YoutubeIE for
automatically generated captions automatically generated captions
duration: Length of the video in seconds, as an integer or float. duration: Length of the video in seconds, as an integer or float.