youtube-transcript-api
Extract, transcribe, and translate YouTube video transcripts using the YouTubeTranscript.dev V2 API. Supports captions, ASR audio transcription, batch processing (up to 100 videos), translation to 100+ languages, and multiple output formats. Use when working with YouTube videos, subtitles, captions, or video-to-text conversion.
- License 许可
- MIT
- 最近更新
- 2026-05-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- youtube-transcript-api
- license
- MIT
- metadata
- { "author": "YouTubeTranscript.dev", "version": "2.0" }
- description
- Extract, transcribe, and translate YouTube video transcripts using the YouTubeTranscript.dev V2 API. Supports captions, ASR audio transcription, batch processing (up to 100 videos), translation to 100+ languages, and multiple output formats. Use when working with YouTube videos, subtitles, captions, or video-to-text conversion.
- compatibility
- Requires network access to youtubetranscript.dev API. Works with any language or runtime that can make HTTP requests.
02 资源文件 1
- 参考文档_meta.json301 B
03 SKILL.md 正文
YouTube Transcript API Skill
Use this skill when the user wants to extract transcripts from YouTube videos, transcribe videos without captions, translate video content, or process multiple videos in batch.
When to Use
- User asks to get a transcript/subtitles/captions from a YouTube video
- User wants to transcribe a YouTube video that has no captions (ASR)
- User wants to translate a YouTube video transcript to another language
- User needs to process multiple YouTube videos at once
- User wants to build an AI/LLM pipeline that uses YouTube video content
- User wants to repurpose video content into text (blog posts, summaries, etc.)
API Overview
Base URL: https://youtubetranscript.dev/api/v2
Authentication: Bearer token via Authorization: Bearer YOUR_API_KEY
Users can get a free API key at youtubetranscript.dev.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v2/transcribe |
Extract transcript from a single video |
POST |
/api/v2/batch |
Extract transcripts from up to 100 videos |
GET |
/api/v2/jobs/{job_id} |
Check status of an ASR job |
GET |
/api/v2/batch/{batch_id} |
Check status of a batch request |
Request Fields
| Field | Required | Description |
|---|---|---|
video |
Yes (single) | YouTube URL or 11-character video ID |
video_ids |
Yes (batch) | Array of IDs or URLs (up to 100) |
language |
No | ISO 639-1 code (e.g., "es", "fr"). Omit for best available |
source |
No | auto (default), manual, or asr |
format |
No | timestamp, paragraphs, or words |
webhook_url |
No | URL for async delivery (required for source="asr") |
Credit Costs
| Method | Cost | Speed |
|---|---|---|
| Native Captions | 1 credit | 5–10 seconds |
| Translation | 1 credit per 2,500 chars | 5–10 seconds |
| ASR (Audio) | 1 credit per 90 seconds | 2–20 minutes (async) |
Examples
Basic Transcript Extraction (Python)
import requests
API_KEY = "your_api_key"
response = requests.post(
"https://youtubetranscript.dev/api/v2/transcribe",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={"video": "dQw4w9WgXcQ"}
)
data = response.json()
for segment in data["data"]["transcript"]:
print(f"[{segment['start']:.1f}s] {segment['text']}")
Basic Transcript Extraction (JavaScript/Node.js)
const response = await fetch("https://youtubetranscript.dev/api/v2/transcribe", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ video: "dQw4w9WgXcQ" }),
});
const { data } = await response.json();
console.log(data.transcript);
Using the Node.js SDK
npm install youtube-audio-transcript-api
import { YouTubeTranscript } from "youtube-audio-transcript-api";
const yt = new YouTubeTranscript({ apiKey: "your_api_key" });
// Simple extraction
const result = await yt.getTranscript("dQw4w9WgXcQ");
// With translation
const translated = await yt.transcribe({
video: "dQw4w9WgXcQ",
language: "es",
});
// Batch (up to 100 videos)
const batch = await yt.batch({
video_ids: ["dQw4w9WgXcQ", "jNQXAC9IVRw", "9bZkp7q19f0"],
});
Basic Transcript Extraction (cURL)
curl -X POST https://youtubetranscript.dev/api/v2/transcribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video": "dQw4w9WgXcQ"}'
Batch Processing (up to 100 videos)
curl -X POST https://youtubetranscript.dev/api/v2/batch \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video_ids": ["dQw4w9WgXcQ", "jNQXAC9IVRw", "9bZkp7q19f0"]}'
Translation
Add "language": "es" (or any ISO 639-1 code) to get the transcript translated:
curl -X POST https://youtubetranscript.dev/api/v2/transcribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video": "dQw4w9WgXcQ", "language": "es"}'
ASR Transcription (videos without captions)
For videos that don't have captions, use ASR with a webhook:
curl -X POST https://youtubetranscript.dev/api/v2/transcribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video": "VIDEO_ID", "source": "asr", "webhook_url": "https://yoursite.com/webhook"}'
This returns immediately with status: "processing". Results are delivered to the webhook URL when ready. Poll with GET /api/v2/jobs/{job_id} if not using webhooks.
Error Handling
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | invalid_request |
Invalid JSON or missing required fields |
| 401 | invalid_api_key |
Missing or invalid API key |
| 402 | payment_required |
Insufficient credits |
| 404 | no_captions |
No captions available and ASR not used |
| 429 | rate_limit_exceeded |
Too many requests — check Retry-After header |
Important Notes
- Always ask the user for their API key if they haven't provided one. Free keys are available at youtubetranscript.dev.
- Omitting the
languageparameter returns the best available transcript without translation (saves credits). - ASR is async — always use a webhook URL or poll the jobs endpoint.
- Batch endpoint accepts both YouTube URLs and 11-character video IDs.
- Re-fetching an already-owned transcript costs 0 credits.
Resources
04 同仓库更多 Skills
zvukogram
Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.
zohomail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-recruit
Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows. Use this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-people
Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave. Use this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-mail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-inventory
Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments. Use this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.