yt

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

yt

yt

Quick YouTube lookup via TranscriptAPI.com.
通过TranscriptAPI.com快速查询YouTube内容。

Setup

配置步骤

If
$TRANSCRIPT_API_KEY
is not set, help the user create an account (100 free credits, no card):
Step 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 CODE
API key saved to your shell profile and agent config. Ready to use.
Manual option: transcriptapi.com/signup → Dashboard → API Keys.
如果未设置
$TRANSCRIPT_API_KEY
,帮助用户创建账户(100个免费额度,无需信用卡):
步骤1 — 注册: 询问用户的邮箱。
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL
→ 验证码(OTP)将发送至邮箱。询问用户:"请查看您的邮箱,获取6位验证码。"
步骤2 — 验证: 用户提供OTP后:
bash
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODE
API密钥将保存到您的Shell配置文件和Agent配置中,即可使用。
手动注册选项:transcriptapi.com/signup → 控制台 → API密钥。

API Reference

API参考

Full OpenAPI spec: transcriptapi.com/openapi.json — consult this for the latest parameters and schemas.
完整的OpenAPI规范:transcriptapi.com/openapi.json — 请参考此文档获取最新的参数和模式。

Transcript — 1 credit

获取字幕 — 1个额度

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"
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"

Search — 1 credit

搜索视频 — 1个额度

bash
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=10" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
ParamDefaultValues
q
1-200 chars (required)
type
video
video
,
channel
limit
20
1-50
bash
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=10" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数默认值可选值
q
1-200字符(必填)
type
video
video
,
channel
limit
20
1-50

Channel latest — FREE

获取频道最新内容 — 免费

bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
Returns last 15 videos with exact view counts and publish dates. Accepts
@handle
, channel URL, or
UC...
ID.
bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
返回最近15个视频,包含精确的观看次数和发布日期。支持
@用户名
、频道URL或
UC...
格式的频道ID。

Resolve handle — FREE

解析用户名 — 免费

bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
Use to convert @handle to UC... channel ID.
bash
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
用于将@用户名转换为UC...格式的频道ID。

Errors

错误处理

CodeAction
402No credits — transcriptapi.com/billing
404Not found / no captions
408Timeout — retry once
Free tier: 100 credits. Search and transcript cost 1 credit. Channel latest and resolve are free.
错误码处理方式
402额度不足 — 前往transcriptapi.com/billing充值
404未找到内容/无字幕
408请求超时 — 重试一次
免费套餐:100个额度。搜索和获取字幕各消耗1个额度。获取频道最新内容和解析用户名功能免费。