YouTube Lite
Complete YouTube toolkit via TranscriptAPI.com. Everything in one skill.
Setup
You MUST have a $TRANSCRIPT_API_KEY environment variable set.
If you don't have tell the user to create a free account at transcriptapi.com: transcriptapi.com/signup → Dashboard → API Keys.
If you have the key, See File Writes below for details. Existing file is backed up before modification.
File Writes
The verify and save-key commands save the API key to ~/.openclaw/openclaw.json (sets skills.entries.transcriptapi.apiKey and enabled: true). Existing file is backed up to ~/.openclaw/openclaw.json.bak before modification.
To use the API key in terminal/CLI outside the agent, add to your shell profile manually:
INLINECODE5
API Reference
Full OpenAPI spec: transcriptapi.com/openapi.json — consult this for the latest parameters and schemas.
Transcript — COST 1 credit
CODEBLOCK0
| Param | Required | Default | Values |
|---|
| INLINECODE6 | yes | — | YouTube URL or 11-char video ID |
| INLINECODE7 |
no |
json |
json,
text |
|
include_timestamp | no |
true |
true,
false |
|
send_metadata | no |
false |
true,
false |
Response (format=json):
CODEBLOCK1
Search — COST 1 credit
CODEBLOCK2
| Param | Required | Default | Validation |
|---|
| INLINECODE20 | yes | — | 1-200 chars |
| INLINECODE21 |
no |
video |
video,
channel |
|
limit | no |
20 | 1-50 |
Channels
All channel endpoints accept channel — an @handle, channel URL, or UC... channel ID. No need to resolve first.
Resolve handle — FREE
CODEBLOCK3
Response: INLINECODE30
Latest 15 videos — FREE
CODEBLOCK4
Returns exact viewCount and ISO published timestamps.
All channel videos — COST 1 credit/page
CODEBLOCK5
Provide exactly one of channel or continuation. Response includes continuation_token and has_more.
Search within channel — COST 1 credit
CODEBLOCK6
Playlists — COST 1 credit/page
Accepts playlist — a YouTube playlist URL or playlist ID.
CODEBLOCK7
Valid ID prefixes: PL, UU, LL, FL, OL. Response includes playlist_info, results, continuation_token, has_more.
Credit Costs
If you will use NOT FREE endpoints, make sure to tell the user and let them to choose if they want to proceed or not.
| Endpoint | Cost |
|---|
| transcript | 1 |
| search |
1 |
| channel/resolve |
free |
| channel/latest |
free |
| channel/videos | 1/page |
| channel/search | 1 |
| playlist/videos | 1/page |
Validation Rules
| Field | Rule |
|---|
| INLINECODE47 | INLINECODE48 , channel URL, or UC... ID |
| INLINECODE50 |
Playlist URL or ID (
PL/
UU/
LL/
FL/
OL prefix) |
|
q | 1-200 chars |
|
limit | 1-50 |
Errors
| Code | Meaning | Action |
|---|
| 401 | Bad API key | Check key |
| 402 |
No credits | transcriptapi.com/billing |
| 404 | Not found | Resource doesn't exist or no captions |
| 408 | Timeout | Retry once after 2s |
| 422 | Validation error | Check param format |
| 429 | Rate limited | Wait, respect Retry-After |
Typical Workflows
Research workflow: search → pick videos → fetch transcripts
CODEBLOCK8
Channel monitoring: latest (free) → transcript
CODEBLOCK9
Free tier: 100 credits, 300 req/min. Starter ($5/mo): 1,000 credits.
YouTube Lite
通过 TranscriptAPI.com 实现的完整 YouTube 工具包。一站式技能。
设置
您必须设置 $TRANSCRIPTAPIKEY 环境变量。
如果没有,请告知用户在 transcriptapi.com 创建免费账户:transcriptapi.com/signup → 控制面板 → API 密钥。
如果已有密钥,请参阅下方 文件写入 了解详情。修改前会备份现有文件。
文件写入
verify 和 save-key 命令会将 API 密钥保存到 ~/.openclaw/openclaw.json(设置 skills.entries.transcriptapi.apiKey 和 enabled: true)。修改前现有文件会备份到 ~/.openclaw/openclaw.json.bak。
要在代理之外的终端/命令行中使用 API 密钥,请手动添加到您的 shell 配置文件中:
export TRANSCRIPTAPIKEY=
API 参考
完整 OpenAPI 规范:transcriptapi.com/openapi.json — 请查阅此文档获取最新参数和模式。
转录 — 消耗 1 积分
bash
curl -s https://transcriptapi.com/api/v2/youtube/transcript\
?videourl=VIDEOURL&format=text&includetimestamp=true&sendmetadata=true \
-H Authorization: Bearer $TRANSCRIPTAPIKEY
| 参数 | 必填 | 默认值 | 值 |
|---|
| video_url | 是 | — | YouTube URL 或 11 位视频 ID |
| format |
否 | json | json, text |
| include_timestamp | 否 | true | true, false |
| send_metadata | 否 | false | true, false |
响应 (format=json):
json
{
video_id: dQw4w9WgXcQ,
language: en,
transcript: [{ text: ..., start: 18.0, duration: 3.5 }],
metadata: { title: ..., authorname: ..., authorurl: ... }
}
搜索 — 消耗 1 积分
bash
视频
curl -s https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=20 \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
频道
curl -s https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=channel&limit=10 \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
| 参数 | 必填 | 默认值 | 验证规则 |
|---|
| q | 是 | — | 1-200 个字符 |
| type |
否 | video | video, channel|
| limit | 否 | 20 | 1-50 |
频道
所有频道端点接受 channel — 可以是 @handle、频道 URL 或 UC... 频道 ID。无需预先解析。
解析 handle — 免费
bash
curl -s https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED \
-H Authorization: Bearer $TRANSCRIPTAPIKEY
响应:{channelid: UC..., resolvedfrom: @TED}
最新 15 个视频 — 免费
bash
curl -s https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED \
-H Authorization: Bearer $TRANSCRIPTAPIKEY
返回精确的 viewCount 和 ISO 格式的 published 时间戳。
所有频道视频 — 消耗 1 积分/页
bash
第一页(100 个视频)
curl -s https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
后续页面
curl -s https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=TOKEN \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
仅提供 channel 或 continuation 其中之一。响应包含 continuationtoken 和 hasmore。
频道内搜索 — 消耗 1 积分
bash
curl -s https://transcriptapi.com/api/v2/youtube/channel/search\
?channel=@TED&q=QUERY&limit=30 \
-H Authorization: Bearer $TRANSCRIPTAPIKEY
播放列表 — 消耗 1 积分/页
接受 playlist — YouTube 播放列表 URL 或播放列表 ID。
bash
第一页
curl -s https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_ID \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
后续页面
curl -s https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
有效 ID 前缀:PL、UU、LL、FL、OL。响应包含 playlistinfo、results、continuationtoken、has_more。
积分消耗
如果您将使用非免费端点,请务必告知用户,并让他们选择是否继续。
1 |
| channel/resolve |
免费 |
| channel/latest |
免费 |
| channel/videos | 1/页 |
| channel/search | 1 |
| playlist/videos | 1/页 |
验证规则
| 字段 | 规则 |
|---|
| channel | @handle、频道 URL 或 UC... ID |
| playlist |
播放列表 URL 或 ID(PL/UU/LL/FL/OL 前缀)|
| q | 1-200 个字符 |
| limit | 1-50 |
错误
积分不足 | transcriptapi.com/billing |
| 404 | 未找到 | 资源不存在或无字幕 |
| 408 | 超时 | 等待 2 秒后重试一次 |
| 422 | 验证错误 | 检查参数格式 |
| 429 | 请求频率限制 | 等待,遵守 Retry-After |
典型工作流程
研究工作流程: 搜索 → 选择视频 → 获取转录
bash
1. 搜索
curl -s https://transcriptapi.com/api/v2/youtube/search\
?q=machine+learning+explained&limit=5 \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
2. 转录
curl -s https://transcriptapi.com/api/v2/youtube/transcript\
?video
url=VIDEOID&format=text&include
timestamp=true&sendmetadata=true \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
频道监控: 最新(免费)→ 转录
bash
1. 最新上传(免费 — 直接传入 @handle)
curl -s https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
2. 最新视频的转录
curl -s https://transcriptapi.com/api/v2/youtube/transcript\
?video
url=VIDEOID&format=text&include
timestamp=true&sendmetadata=true \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
免费套餐:100 积分,300 次请求/分钟。入门版($5/月):1,000 积分。