videoIdstringobrigatório
The unique identifier for a YouTube video.
https://api.sandbase.ai/v1/api/youtube/video-captionsGet 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.
Sua saída aparecerá aqui
Preencha as entradas e clique em Executar.
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.
srt, xml, json3, or txt format for text analysis.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.
| Name | Type | Required | Description |
|---|---|---|---|
videoId | string | Yes | The unique identifier for a YouTube video. |
format | string | No | Caption output format. |
languageCode | string | No | Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks. |
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"
}
| Field | Meaning |
|---|---|
video_id | The 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_code | The 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_name | The language name for the track in English, such as English or German. |
videoId to get the list of tracks. Add languageCode to request the caption content.format accepts srt, xml, json3, or txt. The default is srt.videoId from a video URL, or from YouTube Search or YouTube Channel Videos.$0.014286 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Comece a construir
Endpoint da API da plataforma com autenticação unificada e rastreamento de uso.
curl -X POST "https://api.sandbase.ai/v1/api/youtube/video-captions" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"format": "srt",
"videoId": "dQw4w9WgXcQ"
}'Defina sua chave da API SandBase no ambiente do seu servidor. As requisições usam autenticação Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Mantenha sua chave no servidor. Não a exponha em código do navegador.
videoIdstringobrigatórioThe unique identifier for a YouTube video.
languageCodestringCaption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.
formatstringCaption output format.
Padrão: "srt"
Valores possíveis: srt, xml, json3, txt
Resposta de exemplo salva para esta API; nenhuma requisição ao vivo é feita ao visualizá-la.
Nenhuma resposta salva foi publicada. Execute a API no Playground para inspecionar a resposta.
Explorar mais
| API | Preço | Resposta |
|---|---|---|
YouTube Video CaptionsEsta API YouTube | $0.014286 por chamada | JSON |
YouTube | A partir de $0.00045 por chamada | JSON |
YouTube | A partir de $0.0012 por chamada | JSON |
YouTube | A partir de $0.0012 por chamada | JSON |
YouTube | A partir de $0.0012 por chamada | JSON |
YouTube | $0.014286 por chamada | JSON |
Perguntas
Envie uma solicitação POST para https://api.sandbase.ai/v1/api/youtube/video-captions com sua chave de API da SandBase no cabeçalho Authorization (Bearer) e os parâmetros no corpo JSON. Você também pode testar no Playground desta página sem escrever código.
$0.014286 por chamada, cobrado do seu saldo SandBase. Você paga apenas pelas chamadas que fizer; não há assinatura.
Obrigatórios: videoId (string). Opcionais: languageCode (string) e format (um de srt, xml, json3, txt). A tabela de Parâmetros e o Playground nesta página listam todos os campos.
Uma resposta JSON retornada na mesma solicitação HTTP (síncrona). O README desta página inclui um exemplo de resposta.
Não. YouTube Video Captions funciona via SandBase, então uma única chave de API da SandBase cobre este endpoint e todas as outras APIs e modelos do catálogo. Você não precisa solicitar acesso à API do YouTube separadamente.