名称: youtube-full
描述: 完整的 YouTube 工具套件——字幕、搜索、频道、播放列表和元数据,全部集成于一个技能中。当您需要全面的 YouTube 访问、希望搜索并获取字幕、浏览频道内容、处理播放列表或需要全套 YouTube 数据端点时使用。适用于智能体的全能 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.com 提供的完整 YouTube 工具包。一切尽在一个技能中。
如果未设置 $TRANSCRIPT_API_KEY,请帮助用户创建一个账户(100 个免费积分,无需信用卡):
步骤 1 — 注册: 向用户询问其邮箱。
node ./scripts/tapi-auth.js register --email 用户邮箱
→ 验证码已发送至邮箱。询问用户:“请检查您的邮箱,获取 6 位验证码。”
步骤 2 — 验证: 一旦用户提供验证码:
node ./scripts/tapi-auth.js verify --token 步骤1获取的令牌 --otp 验证码
API 密钥将保存至
~/.openclaw/openclaw.json。详情请参阅下方的文件写入部分。修改前会备份现有文件。
手动选项:transcriptapi.com/signup → 仪表盘 → API 密钥。
验证和保存密钥命令会将 API 密钥保存到 ~/.openclaw/openclaw.json(设置 skills.entries.transcriptapi.apiKey 和 enabled: true)。修改前,现有文件会备份到 ~/.openclaw/openclaw.json.bak。
若要在智能体之外的终端/CLI 中使用此 API 密钥,请手动将其添加到您的 shell 配置文件中:
export TRANSCRIPT_API_KEY=<您的密钥>
完整 OpenAPI 规范:transcriptapi.com/openapi.json — 请查阅此文件以获取最新的参数和模式。
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 |
json, text |
include_timestamp |
否 | true |
true, false |
send_metadata |
否 | false |
true, false |
响应 (format=json):
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"transcript": [{ "text": "...", "start": 18.0, "duration": 3.5 }],
"metadata": { "title": "...", "author_name": "...", "author_url": "..." }
}
# 视频
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=查询词&type=video&limit=20" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 频道
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=查询词&type=channel&limit=10" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
| 参数 | 必填 | 默认值 | 验证规则 |
|---|---|---|---|
q |
是 | — | 1-200 个字符 |
type |
否 | video |
video, channel |
limit |
否 | 20 |
1-50 |
所有频道端点都接受 channel 参数——可以是 @句柄、频道 URL 或 UC... 格式的频道 ID。无需预先解析。
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
响应:{"channel_id": "UC...", "resolved_from": "@TED"}
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
返回精确的 viewCount 和 ISO 格式的 published 时间戳。
# 第一页 (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 或 continuation 参数中的一个。响应包含 continuation_token 和 has_more。
curl -s "https://transcriptapi.com/api/v2/youtube/channel/search\
?channel=@TED&q=查询词&limit=30" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
接受 playlist 参数——可以是 YouTube 播放列表 URL 或播放列表 ID。
# 第一页
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=播放列表ID" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 后续页
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=令牌" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
有效的 ID 前缀:PL, UU, LL, FL, OL。响应包含 playlist_info, results, continuation_token, has_more。
| 端点 | 成本 |
|---|---|
| transcript | 1 |
| search | 1 |
| channel/resolve | 免费 |
| channel/latest | 免费 |
| channel/videos | 1/页 |
| channel/search | 1 |
| playlist/videos | 1/页 |
| 字段 | 规则 |
|---|---|
channel |
@句柄、频道 URL 或 UC... 格式的 ID |
playlist |
播放列表 URL 或 ID (PL/UU/LL/FL/OL 前缀) |
q |
1-200 个字符 |
limit |
1-50 |
| 代码 | 含义 | 处理建议 |
|---|---|---|
| 401 | API 密钥错误 | 检查密钥 |
| 402 | 积分不足 | 前往 transcriptapi.com/billing |
| 404 | 未找到 | 资源不存在或无字幕 |
| 408 | 请求超时 | 等待 2 秒后重试一次 |
| 422 | 参数验证错误 | 检查参数格式 |
| 429 | 请求频率受限 | 等待,遵循 Retry-After 头信息 |
研究工作流: 搜索 → 选择视频 → 获取字幕
# 1. 搜索
curl -s "https://transcriptapi.com/api/v2/youtube/search\
?q=machine+learning+explained&limit=5" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 2. 获取字幕
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=视频ID&format=text&include_timestamp=true&send_metadata=true" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
频道监控工作流: 获取最新视频(免费)→ 获取字幕
# 1. 获取最新上传(免费 — 可直接传入 @句柄)
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 2. 获取最新视频的字幕
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=视频ID&format=text&include_timestamp=true&send_metadata=true" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
免费套餐:100 积分,300 次请求/分钟。入门套餐($5/月):1,000 积分。