Youtube Playlist技能使用说明
YouTube播放列表
通过以下方式浏览播放列表并获取字幕TranscriptAPI.com.
设置
如果$TRANSCRIPT_API_KEY未设置,请帮助用户创建一个账户(100个免费积分,无需信用卡):

步骤 1 — 注册:询问用户的电子邮件地址。
node ./scripts/tapi-auth.js register --email USER_EMAIL
→ 一次性密码(OTP)将发送到该邮箱。询问用户:"请检查您的邮箱,获取6位验证码。"
步骤 2 — 验证:当用户提供OTP后:
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— 请查阅此文件以获取最新的参数和模式。
GET /api/v2/youtube/playlist/videos — 1 积分/页
分页的播放列表视频列表(每页100个)。接受playlist— YouTube播放列表URL或播放列表ID。
# First page
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# Next pages
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
| 参数 | 必填 | 验证 |
|---|---|---|
播放列表 | 条件性 | 播放列表URL或ID(PL/UU/LL/FL/OL前缀) |
继续 | 条件性 | 非空字符串 |
请只提供以下之一:播放列表或继续,不能同时提供两者。
可接受的播放列表ID前缀:
PL——用户创建的播放列表UU— 频道上传播放列表LL— 喜欢的视频FL— 收藏夹OL— 其他系统播放列表
响应:
{
"results": [
{
"videoId": "abc123xyz00",
"title": "Playlist Video Title",
"channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
"channelTitle": "Channel Name",
"channelHandle": "@handle",
"lengthText": "10:05",
"viewCountText": "1.5M views",
"thumbnails": [{ "url": "...", "width": 120, "height": 90 }],
"index": "0"
}
],
"playlist_info": {
"title": "Best Science Talks",
"numVideos": "47",
"description": "Top science presentations",
"ownerName": "TED",
"viewCount": "5000000"
},
"continuation_token": "4qmFsgKlARIYVVV1...",
"has_more": true
}
分页流程:
- 首次请求:
?playlist=PLxxx— 返回前100个视频 +continuation_token - 后续请求:
?continuation=TOKEN— 返回下100个 + 新令牌 - 重复直至
has_more: false或continuation_token: null
工作流程:播放列表 → 字幕
# 1. List playlist videos
curl -s "https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_PLAYLIST_ID" \
-H "Authorization: Bearer $TRANSCRIPT_API_KEY"
# 2. Get transcript from a video in the playlist
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"
从URL提取播放列表ID
从https://www.youtube.com/playlist?list=PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf这个播放列表的ID是PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf。你也可以直接将完整的URL传递给playlist参数。
错误
| 代码 | 含义 | 操作 |
|---|---|---|
| 400 | 两个参数都提供或都没提供 | 请只提供`playlist`或`continuation`参数中的一个 |
| 402 | 额度不足 | transcriptapi.com/billing |
| 404 | 播放列表未找到 | 检查播放列表是否为公开状态 |
| 408 | 超时 | 请重试一次 |
| 422 | 播放列表格式无效 | 必须是一个有效的播放列表URL或ID |
每页1个积分。免费套餐:100积分,300次请求/分钟。


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