Sand AISand AI MAGI-2MAGI-2 ist jetzt auf SandBase: 1080p-Video mit nativem AudioJetzt testen

YouTube Video Captions

API-Dokumentation
https://api.sandbase.ai/v1/api/youtube/web-v2/video-captions

Returns available video caption tracks or transcripts in multiple formats, filtered by video identifier and language code.

Preis
$0.008USD / Aufruf
Methode
POST
Antwort
JSON
Parameter
0 erforderlich · 4 optional

Playground

Eingabe
Caption format
Language code (e.g. en, zh-Hans, a.en), returns available caption list if empty
Video ID (recommended)
Full video URL (optional)
AusgabeBeispiel
Antwortoutputs · 805 B · 11 Zeilen
[
  {
    "data": {
      "content": "1\n00:00:00,080 --> 00:00:04,000\nCloud flare has released an AI agents\n\n2\n00:00:01,880 --> 00:00:06,240\nSDK it's durable objects but with\n\n3\n00:00:04,000 --> 00:00:08,000\nsuperpowers this makes building agents\n\n4\n00:00:06,240 --> 00:00:09,880\nmuch much easier as it handles the\n\n5\n00:00:08,000 --> 00:00:12,000\ncomplex parts for you like persisting\n\n6\n00:00:09,880 --> 00:00:14,000\nState handling long running tasks and\n\n7\n00:00:12,000 --> 00:00:15,440\neven horizontal scaling this is just the\n\n8\n00:00:14,000 --> 00:00:17,080\nbeginning too the road map talks of\n\n9\n00:00:15,440 --> 00:00:19,119\naddin…",
      "format": "srt",
      "language_code": "en",
      "language_name": "English",
      "video_id": "l4tHKJFQvRg"
    }
  }
]

Beispiele

Wählen Sie ein Beispiel aus, um seine Eingaben und das Ergebnis in den Playground zu laden.

API-README

YouTube Video Captions API

Returns the caption text of a YouTube video for one language, in the format you choose (srt, xml, json3 or txt). It needs a video_id or a video_url, plus a language_code. If you leave language_code empty, it returns the list of available caption tracks instead.

Use cases

  • Pull English subtitles as txt to feed a video summarization workflow.
  • Download srt files with timestamps to build subtitles for a re-upload or translation.
  • Fetch json3 captions to index spoken words for search.
  • Check which caption languages a video offers before choosing one to download.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/web-v2/video-captions" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_id": "dQw4w9WgXcQ", "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "language_code": "en", "format": "srt"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
formatstringNoCaption format
language_codestringNoLanguage code (e.g. en, zh-Hans, a.en), returns available caption list if empty
video_idstringNoVideo ID (recommended)
video_urlstringNoFull video URL (optional)

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "content": "1\n00:00:01,360 --> 00:00:03,040\n[♪♪♪]\n\n2\n00:00:18,640 --> 00:00:21,880\n♪ We're n…",
  "format": "srt",
  "language_code": "en",
  "language_name": "English",
  "video_id": "dQw4w9WgXcQ"
}

Response fields

FieldMeaning
contentThe full caption text in the requested format. For srt, each cue has a number, a start and end time in HH:MM:SS,mmm form, and the caption line. Sound cues such as [♪♪♪] appear as text.
formatThe caption format of content, matching the format you requested.
language_codeThe language code of the returned captions, for example en.
language_nameThe readable name of the caption language, for example English.
video_idThe ID of the video the captions belong to.

Notes

  • Send video_id when you can. video_url is optional and is not needed if you have the ID.
  • The video_id is the value after v= in a watch URL, for example dQw4w9WgXcQ.
  • Language codes can be plain, like en or zh-Hans, or auto-generated tracks like a.en.
  • format defaults to srt when you leave it out.

Pricing

$0.008 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

Geben Sie video_id oder video_url an; eine Videoeingabe ist erforderlich, auch wenn keines der Felder einzeln als erforderlich markiert ist. Lassen Sie language_code leer, um Tracks zu entdecken, und verwenden Sie dann einen zurückgegebenen Sprachcode, um Untertitelinhalte abzurufen. Folgen Sie der Python-Anleitung für YouTube-Transkripte für die Sprachauswahl, das Speichern von SRT und das Beibehalten von Quellen für Recherchen.

Mehr entdecken

Verwandte APIs

Alle APIs
APIPreisAntwort
YouTube$0.008 pro AufrufJSON
YouTube$0.001 pro AufrufJSON
YouTube$0.001 pro AufrufJSON
YouTube$0.001 pro AufrufJSON
YouTube$0.001 pro AufrufJSON
YouTube$0.001 pro AufrufJSON

Anleitungen:Best YouTube API in 2026: Pricing Compared

Fragen

FAQ

Wie verwende ich die YouTube Video Captions API?

Senden Sie eine POST-Anfrage an https://api.sandbase.ai/v1/api/youtube/web-v2/video-captions mit Ihrem SandBase API-Schlüssel im Authorization-Header (Bearer) und den Parametern als JSON-Body. Sie können das auch ohne Code direkt auf dieser Seite im Playground testen.

Was kostet die YouTube Video Captions API?

$0.008 pro Aufruf, abgerechnet von Ihrem SandBase-Guthaben. Es werden nur die von Ihnen getätigten Aufrufe berechnet; es gibt kein Abo.

Welche Parameter akzeptiert die YouTube Video Captions API?

Geben Sie video_id oder video_url an, um das Video zu identifizieren. Lassen Sie language_code leer, um verfügbare Untertitelspuren aufzulisten, und verwenden Sie dann den für dieses Video zurückgegebenen Sprachcode, um Inhalte abzurufen. Der optionale Parameter format akzeptiert srt, xml, json3 oder txt. Aktuelle Details zur Anfrage finden Sie in der README und im Playground.

Was gibt die YouTube Video Captions API zurück?

Eine JSON-Antwort, die in derselben HTTP-Anfrage zurückgegeben wird (synchron). Die README auf dieser Seite enthält eine Beispielantwort.

Benötige ich ein YouTube-Entwicklerkonto oder einen API-Schlüssel?

Nein. YouTube Video Captions läuft über SandBase, daher deckt ein SandBase API-Schlüssel diesen Endpunkt und jede andere API sowie jedes Modell im Katalog ab. Sie müssen keinen separaten Zugang für YouTube API beantragen.