add "captions" as download format

This commit is contained in:
vitaliibudnyi
2026-02-21 19:06:49 +02:00
committed by Alex Shnitman
parent e24890fd9b
commit 973a87ffc6
4 changed files with 48 additions and 4 deletions

View File

@@ -26,6 +26,10 @@ def get_format(format: str, quality: str) -> str:
# Quality is irrelevant in this case since we skip the download
return "bestaudio/best"
if format == "captions":
# Quality is irrelevant in this case since we skip the download
return "bestaudio/best"
if format in AUDIO_FORMATS:
# Audio quality needs to be set post-download, set in opts
return f"bestaudio[ext={format}]/bestaudio/best"
@@ -98,6 +102,13 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
{"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"}
)
if format == "captions":
opts["skip_download"] = True
opts["writesubtitles"] = True
opts["writeautomaticsub"] = True
opts["subtitleslangs"] = ["en"]
opts["subtitlesformat"] = "vtt"
opts["postprocessors"] = postprocessors + (
opts["postprocessors"] if "postprocessors" in opts else []
)