OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  transcriptapi:完整的 TranscriptAPI 工具包,支持批量获取 YouTube 转录

transcriptapi:完整的 TranscriptAPI 工具包,支持批量获取 YouTube 转录

 
  acmuuu ·  2026-02-18 12:00:47 · 3 次点击  · 0 条评论  

名称: transcriptapi
描述: 完整的 TranscriptAPI 工具包 — 获取 YouTube 字幕、搜索视频和频道、浏览频道上传内容、获取最新视频、探索播放列表。当用户希望以编程方式处理 YouTube 内容、获取用于摘要或分析的字幕、查找视频或监控频道时使用。触发词:YouTube URL、"transcript"、"transcriptapi"、"video summary"、"what did they say"、"find videos about"、"search youtube"。
主页: https://transcriptapi.com
user-invocable: true
元数据: {"openclaw":{"emoji":"📺","requires":{"env":["TRANSCRIPT_API_KEY"],"bins":["node"],"config":["~/.openclaw/openclaw.json"]},"primaryEnv":"TRANSCRIPT_API_KEY"}}


TranscriptAPI

通过 TranscriptAPI.com 提供的完整 YouTube 数据工具包。字幕、搜索、频道、播放列表 — 一个 API 密钥即可。

设置

如果未设置 $TRANSCRIPT_API_KEY,请帮助用户创建账户(100 个免费积分,无需信用卡):

步骤 1 — 注册: 向用户询问其邮箱。

node ./scripts/tapi-auth.js register --email 用户邮箱

→ OTP 将发送至邮箱。询问用户:"请检查您的邮箱,获取 6 位验证码。"

步骤 2 — 验证: 用户提供 OTP 后:

node ./scripts/tapi-auth.js verify --token 步骤1的令牌 --otp 验证码

API 密钥将保存至 ~/.openclaw/openclaw.json。详情请参阅下方的文件写入部分。修改前会备份现有文件。

手动选项:transcriptapi.com/signup → 仪表板 → API 密钥。

文件写入

验证和保存密钥命令会将 API 密钥保存到 ~/.openclaw/openclaw.json(设置 skills.entries.transcriptapi.apiKeyenabled: true)。修改前,现有文件会备份到 ~/.openclaw/openclaw.json.bak

若要在代理之外的终端/CLI 中使用此 API 密钥,请手动将其添加到 shell 配置文件中:
export TRANSCRIPT_API_KEY=<你的密钥>

API 参考

完整 OpenAPI 规范:transcriptapi.com/openapi.json — 请查阅此文件以获取最新的参数和模式。

认证

所有请求:-H "Authorization: Bearer $TRANSCRIPT_API_KEY"

端点

频道端点接受 channel 参数 — 可以是 @句柄、频道 URL 或 UC... ID。无需预先解析。播放列表端点接受 playlist 参数 — 可以是播放列表 URL 或 ID。

GET /api/v2/youtube/transcript — 1 积分

curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=视频URL&format=text&include_timestamp=true&send_metadata=true" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需 默认值 验证规则
video_url YouTube URL 或 11 位视频 ID
format json jsontext
include_timestamp true truefalse
send_metadata false truefalse

接受格式:https://youtube.com/watch?v=ID, https://youtu.be/ID, youtube.com/shorts/ID, 或纯 ID

响应 (format=json):

{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "transcript": [
    { "text": "We're no strangers...", "start": 18.0, "duration": 3.5 }
  ],
  "metadata": { "title": "...", "author_name": "...", "author_url": "..." }
}

GET /api/v2/youtube/search — 1 积分

curl -s "https://transcriptapi.com/api/v2/youtube/search?q=查询词&type=video&limit=20" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需 默认值 验证规则
q 1-200 个字符(自动修剪)
type video videochannel
limit 20 1-50

响应 (type=video):

{
  "results": [
    {
      "type": "video",
      "videoId": "dQw4w9WgXcQ",
      "title": "Rick Astley - Never Gonna Give You Up",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "channelTitle": "Rick Astley",
      "channelHandle": "@RickAstley",
      "channelVerified": true,
      "lengthText": "3:33",
      "viewCountText": "1.5B views",
      "publishedTimeText": "14 years ago",
      "hasCaptions": true,
      "thumbnails": [{ "url": "...", "width": 120, "height": 90 }]
    }
  ],
  "result_count": 20
}

响应 (type=channel):

{
  "results": [
    {
      "type": "channel",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "title": "Rick Astley",
      "handle": "@RickAstley",
      "subscriberCount": "4.2M subscribers",
      "verified": true,
      "rssUrl": "https://www.youtube.com/feeds/videos.xml?channel_id=UC..."
    }
  ],
  "result_count": 5
}

GET /api/v2/youtube/channel/resolve — 免费 (0 积分)

curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需 验证规则
input 1-200 个字符 — @句柄、URL 或 UC... ID

响应:

{ "channel_id": "UCsT0YIqwnpJCM-mx7-gSA4Q", "resolved_from": "@TED" }

如果输入已经是有效的 UC[a-zA-Z0-9_-]{22} ID,则立即返回,无需查询。

GET /api/v2/youtube/channel/videos — 1 积分/页

# 第一页 (100 个视频)
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"

# 后续页
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=令牌" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需条件 验证规则
channel 条件性 @句柄、频道 URL 或 UC... ID
continuation 条件性 非空字符串(用于后续页)

必须且仅提供 channelcontinuation 中的一个。

响应:

{
  "results": [{
    "videoId": "abc123xyz00",
    "title": "Latest Video",
    "channelId": "UCsT0YIqwnpJCM-mx7-gSA4Q",
    "channelTitle": "TED",
    "channelHandle": "@TED",
    "lengthText": "15:22",
    "viewCountText": "3.2M views",
    "thumbnails": [...],
    "index": "0"
  }],
  "playlist_info": {"title": "Uploads from TED", "numVideos": "5000"},
  "continuation_token": "4qmFsgKlARIYVVV1...",
  "has_more": true
}

GET /api/v2/youtube/channel/latest — 免费 (0 积分)

curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需 验证规则
channel @句柄、频道 URL 或 UC... ID

通过 RSS 返回最后 15 个视频,包含精确的观看次数和 ISO 时间戳。

响应:

{
  "channel": {
    "channelId": "...",
    "title": "TED",
    "author": "TED",
    "url": "..."
  },
  "results": [
    {
      "videoId": "abc123xyz00",
      "title": "Latest Video",
      "published": "2026-01-30T16:00:00Z",
      "viewCount": "2287630",
      "description": "Full description...",
      "thumbnail": { "url": "...", "width": "480", "height": "360" }
    }
  ],
  "result_count": 15
}

GET /api/v2/youtube/channel/search — 1 积分

curl -s "https://transcriptapi.com/api/v2/youtube/channel/search\
?channel=@TED&q=climate+change&limit=30" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需 验证规则
channel @句柄、频道 URL 或 UC... ID
q 1-200 个字符
limit 1-50 (默认 30)

GET /api/v2/youtube/playlist/videos — 1 积分/页

# 第一页
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_播放列表_ID" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"

# 后续页
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=令牌" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY"
参数 必需条件 验证规则
playlist 条件性 播放列表 URL 或 ID (PL/UU/LL/FL/OL 前缀)
continuation 条件性 非空字符串

积分成本

端点 成本
transcript 1
search 1
channel/resolve 免费
channel/search 1
channel/videos 1/页
channel/latest 免费
playlist/videos 1/页

错误代码

代码 含义 处理建议
401 API 密钥错误 检查密钥,重新运行设置
402 积分不足 前往 transcriptapi.com/billing 充值
404 未找到 视频/频道/播放列表不存在或无字幕
408 超时/可重试 等待 2 秒后重试一次
422 参数验证错误 检查参数格式
429 请求频率受限 等待,遵循 Retry-After 头部

使用技巧

  • 当用户分享 YouTube URL 但未说明意图时,可获取字幕并总结关键点。
  • 使用 channel/latest(免费)在获取字幕前检查新上传内容 — 可直接传递 @句柄。
  • 用于研究:搜索 → 选择视频 → 获取字幕。
  • 免费套餐:100 积分,300 次请求/分钟。入门套餐($5/月):1,000 积分,300 次请求/分钟。
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor