Sand AISand AI MAGI-2MAGI-2 hiện đã có trên SandBase: video 1080p với âm thanh gốcDùng thử ngay

YouTube Video Transcript

Tài liệu API
https://api.sandbase.ai/v1/api/youtube/video-transcript

Fetch the transcript/captions of a YouTube video or Short by URL or ID.

Giá
Từ $0.0009USD / lượt gọi
Phương thức
POST
Phản hồi
JSON
Tham số
0 bắt buộc · 2 tùy chọn

Phòng thử nghiệm

Đầu vào
YouTube video ID. A Short uses the same ID as any other video.
Full YouTube video URL. Shorts (youtube.com/shorts/...), youtu.be, live, and embed URLs all work.
Đầu raSẵn sàng

Đầu ra của bạn sẽ xuất hiện ở đây

Hoàn tất đầu vào, rồi nhấp Run.

README API

YouTube Video Transcript API

Returns the transcript of a YouTube video or Short as plain text and as timed segments. You pass either a video url or a video id.

Use cases

  • Index what a video says so you can search across many videos by spoken words.
  • Feed the transcript text into a summarizer or a question-answering tool.
  • Build subtitles or clickable timestamps from the timed segments.
  • Check whether a video mentions a brand, product, or phrase.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/video-transcript" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'

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

Parameters

NameTypeRequiredDescription
idstringNoYouTube video ID. A Short uses the same ID as any other video.
urlstringNoFull YouTube video URL. Shorts (youtube.com/shorts/...), youtu.be, live, and embed URLs all work.

Example response

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

{
  "data": {
    "language": "en",
    "segments": [
      {
        "durationSeconds": 1.68,
        "startSeconds": 1.36,
        "text": "[♪♪♪]"
      }
    ],
    "transcript": "[♪♪♪]\n♪ We're no strangers to love ♪\n♪ You know the rules and so do I ♪\n♪ A full…"
  },
  "found": true
}

Response fields

FieldMeaning
foundtrue when a transcript was found for the video. A lookup that finds nothing returns found: false.
data.languageLanguage code of the transcript, for example en.
data.transcriptThe full transcript as one string. Each caption line is separated by a newline.
data.segments[].textThe text of one caption line. Music cues such as [♪♪♪] can appear as text.
data.segments[].startSecondsStart time of the segment, in seconds from the beginning of the video.
data.segments[].durationSecondsHow long the segment lasts, in seconds.

Notes

  • Send either url or id. A Short uses the same ID as any other video, and youtube.com/shorts/..., youtu.be, live, and embed URLs all work for url.
  • The id is the value after v= in a standard watch URL, for example dQw4w9WgXcQ.
  • Use data.transcript for the whole text and data.segments when you need timing.
  • To get video metadata such as title and stats, call YouTube Video Details.

Pricing

Billed at the actual cost of each call, about $0.0009 for the request above. Failed calls are not charged.

Khám phá thêm

APIs liên quan

Tất cả APIs
APIGiáPhản hồi
YouTubeTừ $0.0009 mỗi lần gọiJSON
YouTubeTừ $0.00045 mỗi lần gọiJSON
YouTubeTừ $0.0012 mỗi lần gọiJSON
YouTubeTừ $0.0012 mỗi lần gọiJSON
YouTubeTừ $0.0012 mỗi lần gọiJSON
YouTube$0.014286 mỗi lần gọiJSON

Hướng dẫn:Best YouTube API in 2026: Pricing Compared

Câu hỏi

FAQ

Làm thế nào để dùng API YouTube Video Transcript?

Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/youtube/video-transcript với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.

API YouTube Video Transcript có giá bao nhiêu?

Từ $0.0009 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.

API YouTube Video Transcript chấp nhận những tham số nào?

Không có tham số bắt buộc. Tùy chọn: id (string) và url (string). Bảng Parameters và Playground trên trang này liệt kê mọi trường.

API YouTube Video Transcript trả về gì?

Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.

Tôi có cần tài khoản nhà phát triển hoặc API key của YouTube không?

Không. YouTube Video Transcript chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của YouTube.