Download Caption Track
youtube_download_captionDownload subtitle tracks from YouTube videos by caption ID. Supports SRT, VTT, or SBV formats and auto-translation to other languages.
Instructions
Download the raw content of a caption track by its ID.
If outPath is provided the content is written to that local file path and
a confirmation message is returned. Otherwise the caption text is returned
directly (truncated to the character limit if necessary).
Args
captionId(string, required): The caption track ID to download.format("srt" | "vtt" | "sbv", optional): Subtitle format. Defaults to the track's native format when omitted.tlang(string, optional): ISO 639-1 language code for auto-translated output (e.g. "fr", "de").outPath(string, optional): Absolute local path to write the caption file to.
Returns
Without
outPath: the raw caption file content as a text string.With
outPath: a confirmation string"Written N bytes to <path>".
JSON shape (structured) when content returned inline:
{ "captionId": "string", "format": "string|null", "tlang": "string|null", "content": "string" }Examples
Download as SRT:
captionId="AYtvM...", format="srt"Translate to French and save:
captionId="AYtvM...", tlang="fr", outPath="/tmp/fr.vtt"
Errors
403: Captions can only be downloaded for videos on your own channel. Check scopes (
youtube.force-ssl).404: Caption track not found.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| captionId | Yes | The caption track ID to download. | |
| format | No | Subtitle format: "srt", "vtt", or "sbv". Omit to use the track's native format. | |
| tlang | No | ISO 639-1 language code for auto-translated output (e.g. "fr"). | |
| outPath | No | Absolute local file path to write the caption content to. When provided, returns a confirmation instead of the content. |