100 free credits. No credit card required. Get a key

YouTube subtitles download API

A YouTube video’s captions as a ready subtitle file: srt, vtt, ttml, json3 or srv1.

GET /v1/youtube/videos/{id}/subtitlesBeta2 credits per callRefunded on failure
import os, requests

res = requests.get(
    "https://api.groundsocial.dev/v1/youtube/videos/dQw4w9WgXcQ/subtitles?format=vtt",
    headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()
Response
200 · 2 credits
{
"kind": "youtube#subtitles",
"videoId": "dQw4w9WgXcQ",
"languageCode": "en",
"isAutoGenerated": false,
"isTranslated": false,
"format": "vtt",
"content": "WEBVTT\nLanguage: en\n\n00:00:01.360 --> 00:00:03.040\n[♪♪♪]\n\n00:00:18.640 --> 00:00:21.880\n♪ We're no strangers to love ♪\n\n…",
"availableLanguages": [
{
"languageCode": "en",
"name": "English",
"isAutoGenerated": false,
"isTranslatable": true
},
{
"languageCode": "en",
"name": "English (auto-generated)",
"isAutoGenerated": true,
"isTranslatable": true
},
"… 4 more"
]
}

Parameters

NameTypeDescription
idpath · requiredstringA video or Short id, or any URL of it (watch, youtu.be, shorts, live, embed). Example: dQw4w9WgXcQ.
formatquery"srt" | "vtt" | "ttml" | "json3" | "srv1"srt (default), vtt, ttml, json3 or srv1. One of srt, vtt, ttml, json3, srv1.
languagequerystringISO 639-1 language code (en, es, pt-BR). Example: en.
Response fields

200 with a YouTubeSubtitles, in the shape of YouTube Data API v3 resources.

FieldTypeDescription
kind"youtube#subtitles"
videoIdstring
languageCodestring
isAutoGeneratedboolean
isTranslatedboolean
format"srt" | "vtt" | "ttml" | "json3" | "srv1"
contentstringThe subtitle file, in format.
availableLanguagesYouTubeCaptionTrack[]
Status codes
StatusMeaning
200The subtitle file.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The video, channel, playlist or post does not exist, was removed, or has nothing there.
429Too many requests. Wait for Retry-After seconds.
503YouTube is temporarily unavailable. Retryable; nothing was charged.

Every error has code, message, hint and retryable. All error codes

Questions

Which languages?

The tracks the video has, creator-made first; availableLanguages lists them.

YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.