Sand AISand AI MAGI-2MAGI-2 が SandBase に登場しました: ネイティブ音声付き 1080p 動画今すぐ試す

YouTube Video Captions

APIドキュメント
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.

料金
$0.008USD / 回
メソッド
POST
レスポンス
JSON
パラメータ
必須 0 件 · 任意 4 件

プレイグラウンド

入力
Caption format
Language code (e.g. en, zh-Hans, a.en), returns available caption list if empty
Video ID (recommended)
Full video URL (optional)
出力例
レスポンスoutputs · 805 B · 11 行
[
  {
    "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 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.

video_id または video_url を指定してください。各フィールド単体では必須とされていなくても、動画入力が必要です。トラックを検出するには language_code を空欄にし、返された言語コードを使って字幕内容を取得します。言語選択、SRT の保存、調査用のソース保持については、Python YouTube transcript ガイドに従ってください。

さらに探索

関連 APIs

すべての APIs
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

質問

FAQ

YouTube Video Captions API はどのように使いますか?

Authorization ヘッダー(Bearer)に SandBase API key を指定し、パラメータを JSON ボディで送信して https://api.sandbase.ai/v1/api/youtube/web-v2/video-captions に POST リクエストを送ります。このページの Playground で、コードを書かずに試すこともできます。

YouTube Video Captions API の料金はいくらですか?

1回あたり $0.008、SandBase 残高から課金されます。課金対象はご利用分のみで、サブスクリプションはありません。

YouTube Video Captions API はどのパラメータを受け付けますか?

動画を識別するために video_id または video_url を指定してください。language_code を空のままにすると利用可能な字幕トラックを一覧表示でき、その後、その動画に対して返された言語コードを使って内容を取得できます。format パラメータには srt、xml、json3、txt を指定できます。現在のリクエスト詳細は README と Playground を参照してください。

YouTube Video Captions API は何を返しますか?

同じ HTTP リクエスト内で返される JSON レスポンスです(同期)。 このページの README にサンプルレスポンスがあります。

YouTube の開発者アカウントまたは API key は必要ですか?

いいえ。YouTube Video Captions は SandBase 経由で動作するため、SandBase の API key 1つでこのエンドポイントと、カタログ内の他のすべての API とモデルを利用できます。YouTube の API アクセスを別途申請する必要はありません。