Youtube Channels技能使用说明
YouTube频道
通过TranscriptAPI.com提供的YouTube频道工具
。
设置如果$TRANSCRIPT_API_KEY

未设置,帮助用户创建账户(100免费额度,无需绑卡):步骤1 — 注册:
node ./scripts/tapi-auth.js register --email USER_EMAIL
向用户索取其电子邮箱。→ 向邮箱发送一次性验证码。询问用户:
"请查收您的邮件,获取6位验证码。"步骤2 — 验证:
node ./scripts/tapi-auth.js verify --token TOKEN_FROM_STEP_1 --otp CODE
一旦用户提供验证码:
API密钥将保存至~/.openclaw/openclaw.json文件。详情请见下文文件写入
部分。修改前现有文件会被备份。手动操作选项:访问 transcriptapi.com/signup
→ 进入仪表盘 → API密钥。
verify 和 save-key 命令将 API 密钥保存至~/.openclaw/openclaw.json(设置skills.entries.transcriptapi.apiKey及enabled: true)。修改前,现有文件将备份至~/.openclaw/openclaw.json.bak。
若要在代理之外的终端/CLI 中使用 API 密钥,请手动添加至您的 shell 配置文件:export TRANSCRIPT_API_KEY=<您的密钥>
API 参考
完整的 OpenAPI 规范:transcriptapi.com/openapi.json— 请查阅此文件以获取最新的参数和模式。
所有频道端点均接受灵活的输入 —@句柄、频道 URL,或UC...频道 ID。无需预先解析。
GET /api/v2/youtube/channel/resolve — 免费
将@用户名、URL或UC... ID转换为规范的频道ID。
curl -s "https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
| 参数 | 必需 | 验证 |
|---|---|---|
输入 | 是 | 1-200个字符 — @用户名、URL或UC... ID |
响应:
{ "channel_id": "UCsT0YIqwnpJCM-mx7-gSA4Q", "resolved_from": "@TED" }
如果输入已经是UC[a-zA-Z0-9_-]{22}格式,则立即返回。
GET /api/v2/youtube/channel/latest — 免费
通过RSS获取最新的15个视频及其精确统计数据。
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
| 参数 | 必需 | 验证 |
|---|---|---|
频道 | 是 | @用户名、频道URL或UC...ID |
响应:
{
"channel": {
"channelId": "UCsT0YIqwnpJCM-mx7-gSA4Q",
"title": "TED",
"author": "TED",
"url": "https://www.youtube.com/channel/UCsT0YIqwnpJCM-mx7-gSA4Q",
"published": "2006-04-17T00:00:00Z"
},
"results": [
{
"videoId": "abc123xyz00",
"title": "Latest Video Title",
"channelId": "UCsT0YIqwnpJCM-mx7-gSA4Q",
"author": "TED",
"published": "2026-01-30T16:00:00Z",
"updated": "2026-01-31T02:00:00Z",
"link": "https://www.youtube.com/watch?v=abc123xyz00",
"description": "Full video description...",
"thumbnail": { "url": "https://i1.ytimg.com/vi/.../hqdefault.jpg" },
"viewCount": "2287630",
"starRating": {
"average": "4.92",
"count": "15000",
"min": "1",
"max": "5"
}
}
],
"result_count": 15
}
非常适合监控频道 — 免费且提供精确的观看次数和ISO时间戳。
GET /api/v2/youtube/channel/videos — 1 积分/页
所有频道上传视频的分页列表(每页 100 个)。
# First page
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# Next pages
curl -s "https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=TOKEN" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
| 参数 | 必需 | 验证 |
|---|---|---|
channel | 条件性 | @handle、频道 URL,或UC...ID |
continuation | 条件性 | 非空(用于后续页面) |
必须提供且仅提供channel或continuation中的一个,不能同时提供两者。
响应:
{
"results": [{
"videoId": "abc123xyz00",
"title": "Video Title",
"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", "ownerName": "TED"},
"continuation_token": "4qmFsgKlARIYVVV1...",
"has_more": true
}
持续调用并传递continuation,直到has_more: false。
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"
| 参数 | 必需 | 验证规则 |
|---|---|---|
频道标识符 | 是 | @句柄、频道URL,或UC...ID |
查询词 | 是 | 1-200个字符 |
结果数量限制 | 否 | 1-50(默认30) |
典型工作流程
# 1. Check latest uploads (free — pass @handle directly)
curl -s "https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 2. Get transcript of recent video
curl -s "https://transcriptapi.com/api/v2/youtube/transcript\
?video_url=VIDEO_ID&format=text&include_timestamp=true&send_metadata=true" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
错误代码
| 代码 | 说明 |
|---|---|
| 400 | 参数组合无效(同时提供了频道标识符和continuation参数,或两者都未提供) |
| 402 | 调用额度不足 — 请访问 transcriptapi.com/billing |
| 404 | 频道未找到 |
| 408 | 超时 — 请重试一次 |
| 422 | 无效的频道标识符 |
免费套餐:100 积分,每分钟 300 次请求。免费端点(解析、最新)需要认证但不消耗积分。


微信扫一扫,打赏作者吧~