video-transcript
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVideo Transcript
视频转录文本
Extract transcripts from videos via TranscriptAPI.com.
通过TranscriptAPI.com提取视频转录文本。
Setup
配置步骤
If is not set, help the user create an account (100 free credits, no card):
$TRANSCRIPT_API_KEYStep 1 — Register: Ask user for their email.
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL→ OTP sent to email. Ask user: "Check your email for a 6-digit verification code."
Step 2 — Verify: Once user provides the OTP:
bash
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODEAPI key saved to your shell profile and agent config. Ready to use.
Manual option: transcriptapi.com/signup → Dashboard → API Keys.
如果未设置,请协助用户创建账户(赠送100个免费额度,无需绑定银行卡):
$TRANSCRIPT_API_KEY步骤1 — 注册: 向用户索要电子邮箱地址。
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL→ 一次性验证码(OTP)将发送至该邮箱。请询问用户:“请查收您的邮箱,获取6位验证码。”
步骤2 — 验证: 当用户提供验证码后:
bash
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODEAPI密钥已保存至您的Shell配置文件和Agent配置中,可开始使用。
手动注册方式:访问transcriptapi.com/signup → 控制台(Dashboard)→ API密钥(API Keys)。
GET /api/v2/youtube/transcript
GET /api/v2/youtube/transcript
bash
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_URL&format=text&include_timestamp=true&send_metadata=true" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"| Param | Required | Default | Values |
|---|---|---|---|
| yes | — | YouTube URL or 11-char video ID |
| no | | |
| no | | |
| no | | |
Accepted URL formats:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://youtube.com/shorts/VIDEO_ID- Bare video ID:
dQw4w9WgXcQ
Response ():
format=text&send_metadata=truejson
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"transcript": "[00:00:18] We're no strangers to love\n[00:00:21] You know the rules...",
"metadata": {
"title": "Rick Astley - Never Gonna Give You Up",
"author_name": "Rick Astley",
"author_url": "https://www.youtube.com/@RickAstley",
"thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg"
}
}Response ():
format=jsonjson
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"transcript": [
{ "text": "We're no strangers to love", "start": 18.0, "duration": 3.5 },
{ "text": "You know the rules and so do I", "start": 21.5, "duration": 2.8 }
]
}bash
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_URL&format=text&include_timestamp=true&send_metadata=true" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"| 参数名 | 是否必填 | 默认值 | 可选值 |
|---|---|---|---|
| 是 | — | YouTube URL或11位视频ID |
| 否 | | |
| 否 | | |
| 否 | | |
支持的URL格式:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://youtube.com/shorts/VIDEO_ID- 纯视频ID:
dQw4w9WgXcQ
响应结果():
format=text&send_metadata=truejson
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"transcript": "[00:00:18] We're no strangers to love\n[00:00:21] You know the rules...",
"metadata": {
"title": "Rick Astley - Never Gonna Give You Up",
"author_name": "Rick Astley",
"author_url": "https://www.youtube.com/@RickAstley",
"thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg"
}
}响应结果():
format=jsonjson
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"transcript": [
{ "text": "We're no strangers to love", "start": 18.0, "duration": 3.5 },
{ "text": "You know the rules and so do I", "start": 21.5, "duration": 2.8 }
]
}Tips
使用技巧
- Summarize long transcripts into key points first, offer full text on request.
- Use when you need precise timestamps for quoting specific moments.
format=json - Use to get video title and channel for context.
send_metadata=true - Works with YouTube Shorts too.
- 对于较长的转录文本,可先提炼关键要点,再根据用户需求提供完整文本。
- 当需要精准的时间戳来引用特定片段时,使用格式。
format=json - 使用参数可获取视频标题和频道信息,以补充上下文。
send_metadata=true - 该API同样支持YouTube Shorts短视频。
Errors
错误码说明
| Code | Meaning | Action |
|---|---|---|
| 401 | Bad API key | Check key or re-setup |
| 402 | No credits | Top up at transcriptapi.com/billing |
| 404 | No transcript | Video may not have captions enabled |
| 408 | Timeout | Retry once after 2s |
1 credit per successful request. Errors don't consume credits. Free tier: 100 credits, 300 req/min.
| 状态码 | 含义 | 处理措施 |
|---|---|---|
| 401 | API密钥无效 | 检查密钥或重新完成配置步骤 |
| 402 | 额度不足 | 前往transcriptapi.com/billing页面充值 |
| 404 | 无转录文本 | 该视频可能未启用字幕功能 |
| 408 | 请求超时 | 等待2秒后重试一次 |
每成功请求1次消耗1个额度,请求失败不扣除额度。免费套餐:100个免费额度,每分钟最多300次请求。