Install
openclaw skills install youtube-transcript-apiExtract, transcribe, and translate YouTube video transcripts using the YouTubeTranscript.dev V2 API. Supports captions, ASR audio transcription, batch proces...
openclaw skills install youtube-transcript-apiUse 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.
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.
| 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 |
| 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") |
| 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) |
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']}")
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);
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"],
});
curl -X POST https://youtubetranscript.dev/api/v2/transcribe \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video": "dQw4w9WgXcQ"}'
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"]}'
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"}'
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.
| 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 |
language parameter returns the best available transcript without translation (saves credits).