Sand AISand AI MAGI-2MAGI-2 jest teraz na SandBase: wideo 1080p z natywnym dźwiękiemWypróbuj teraz

YouTube Video Captions

Dokumentacja API
https://api.sandbase.ai/v1/api/youtube/video-captions

Get available caption tracks for a YouTube video or request captions in SRT, XML, JSON3, or plain-text format. Use it to support transcription, accessibility, localization, or text analysis.

Cena
$0.014286USD / wywołanie
Metoda
POST
Odpowiedź
JSON
Parametry
1 wymaganych · 2 opcjonalnych

Playground

Wejście
The unique identifier for a YouTube video.
Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.
Caption output format.
WyjścieGotowe

Twój wynik pojawi się tutaj

Uzupełnij dane wejściowe, a następnie kliknij Uruchom.

README API

YouTube Video Captions API

This API returns the caption tracks available for a YouTube video. It needs a videoId. If you also pass languageCode, it returns the captions for that language in the format you set with format.

Use cases

  • List which caption languages a video offers before you decide what to download.
  • Check whether a video has English captions before you queue it for transcription.
  • Build a language picker for a video player or localization tool from the track list.
  • Collect caption text in srt, xml, json3, or txt format for text analysis.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/video-captions" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"videoId": "dQw4w9WgXcQ"}'

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

Parameters

NameTypeRequiredDescription
videoIdstringYesThe unique identifier for a YouTube video.
formatstringNoCaption output format.
languageCodestringNoCaption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.

Example response

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

{
  "captions": [
    {
      "language_code": "en",
      "language_name": "English"
    }
  ],
  "video_id": "dQw4w9WgXcQ"
}

Response fields

FieldMeaning
video_idThe ID of the video the caption tracks belong to. It matches the videoId you sent.
captions[]One entry for each caption track available for the video.
captions[].language_codeThe code for the track language, such as en, de, or ja. Pass this value as languageCode to request the captions for that track.
captions[].language_nameThe language name for the track in English, such as English or German.

Notes

Pricing

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

Odkryj więcej

Powiązane APIs

Wszystkie APIs
APICenaOdpowiedź
YouTube$0.014286 za wywołanieJSON
YouTubeOd $0.00045 za wywołanieJSON
YouTubeOd $0.0012 za wywołanieJSON
YouTubeOd $0.0012 za wywołanieJSON
YouTubeOd $0.0012 za wywołanieJSON
YouTube$0.014286 za wywołanieJSON

Przewodniki:Best YouTube API in 2026: Pricing Compared

Pytania

FAQ

Jak używać API YouTube Video Captions?

Wyślij żądanie POST do https://api.sandbase.ai/v1/api/youtube/video-captions z kluczem API SandBase w nagłówku Authorization (Bearer) oraz parametrami w treści JSON. Możesz też wypróbować je w Playground na tej stronie bez pisania kodu.

Ile kosztuje API YouTube Video Captions?

$0.014286 za wywołanie, rozliczane z salda SandBase. Płacisz tylko za wykonane wywołania; nie ma subskrypcji.

Jakie parametry przyjmuje API YouTube Video Captions?

Wymagane: videoId (string). Opcjonalne: languageCode (string) i format (jedna z opcji: srt, xml, json3, txt). Tabela Parameters oraz Playground na tej stronie zawierają wszystkie pola.

Co zwraca API YouTube Video Captions?

Odpowiedź JSON zwrócona w tym samym żądaniu HTTP (synchronicznie). README na tej stronie zawiera przykładową odpowiedź.

Czy potrzebuję konta deweloperskiego YouTube lub klucza API?

Nie. YouTube Video Captions działa przez SandBase, więc jeden klucz API SandBase obejmuje ten endpoint i każde inne API oraz model w katalogu. Nie musisz osobno ubiegać się o dostęp do API YouTube.