formatstring
Caption format
По умолчанию: "srt"
Возможные значения: srt, xml, json3, txt
https://api.sandbase.ai/v1/api/youtube/web-v2/video-captionsReturns available video caption tracks or transcripts in multiple formats, filtered by video identifier and language code.
[
{
"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"
}
}
]Выберите пример, чтобы загрузить его входные данные и результат в playground.
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.
txt to feed a video summarization workflow.srt files with timestamps to build subtitles for a re-upload or translation.json3 captions to index spoken words for search.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.
| Name | Type | Required | Description |
|---|---|---|---|
format | string | No | Caption format |
language_code | string | No | Language code (e.g. en, zh-Hans, a.en), returns available caption list if empty |
video_id | string | No | Video ID (recommended) |
video_url | string | No | Full video URL (optional) |
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"
}
| Field | Meaning |
|---|---|
content | The 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. |
format | The caption format of content, matching the format you requested. |
language_code | The language code of the returned captions, for example en. |
language_name | The readable name of the caption language, for example English. |
video_id | The ID of the video the captions belong to. |
video_id when you can. video_url is optional and is not needed if you have the ID.video_id is the value after v= in a watch URL, for example dQw4w9WgXcQ.en or zh-Hans, or auto-generated tracks like a.en.format defaults to srt when you leave it out.$0.008 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
Укажите video_id или video_url; видео обязательно, даже если ни одно поле по отдельности не помечено как обязательное. Оставьте language_code пустым, чтобы найти треки, затем используйте возвращенный код языка, чтобы получить текст субтитров. Следуйте руководству по транскриптам YouTube на Python для выбора языка, сохранения SRT и сохранения источников для исследований.
Начните разработку
Конечная точка платформенного API с единообразной аутентификацией и учётом использования.
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 '{
"format": "srt",
"video_id": "l4tHKJFQvRg",
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"language_code": "en"
}'Укажите свой ключ SandBase API в окружении сервера. Запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Храните ключ на сервере. Не раскрывайте его в коде браузера.
formatstringCaption format
По умолчанию: "srt"
Возможные значения: srt, xml, json3, txt
language_codestringLanguage code (e.g. en, zh-Hans, a.en), returns available caption list if empty
video_idstringVideo ID (recommended)
video_urlstringFull video URL (optional)
Сохранённый пример ответа для этого API; при просмотре живой запрос не выполняется.
[
{
"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"
}
}
]Посмотреть больше
| API | Цена | Ответ |
|---|---|---|
YouTube Video CaptionsЭтот API YouTube | $0.008 за запрос | JSON |
YouTube | $0.001 за запрос | JSON |
YouTube | $0.001 за запрос | JSON |
YouTube | $0.001 за запрос | JSON |
YouTube | $0.001 за запрос | JSON |
YouTube | $0.001 за запрос | JSON |
Руководства:Best YouTube API in 2026: Pricing Compared
Вопросы
Отправьте POST-запрос на https://api.sandbase.ai/v1/api/youtube/web-v2/video-captions, указав ключ SandBase API в заголовке Authorization (Bearer), а параметры — в теле JSON. Вы также можете попробовать это в Playground на этой странице без написания кода.
$0.008 за вызов, списывается с баланса SandBase. Оплата взимается только за сделанные вызовы; подписка не требуется.
Укажите video_id или video_url, чтобы идентифицировать видео. Оставьте language_code пустым, чтобы получить список доступных дорожек субтитров, затем используйте код языка, возвращенный для этого видео, чтобы получить содержимое. Необязательный параметр format принимает srt, xml, json3 или txt. См. README и Playground для актуальных деталей запроса.
JSON-ответ, возвращаемый в том же HTTP-запросе (синхронно). В README на этой странице приведен пример ответа.
Нет. YouTube Video Captions работает через SandBase, поэтому один API key SandBase покрывает этот endpoint и все остальные API и модели в каталоге. Вам не нужно отдельно запрашивать доступ к API YouTube.