YouTube Playlist
Browse playlists and fetch transcripts via TranscriptAPI.com.
Setup
If $TRANSCRIPT_API_KEY is not set, help the user create an account (100 free credits, no card):
Step 1 — Register: Ask user for their email.
CODEBLOCK0
→ OTP sent to email. Ask user: "Check your email for a 6-digit verification code."
Step 2 — Verify: Once user provides the OTP:
CODEBLOCK1
API key saved to ~/.openclaw/openclaw.json. See File Writes below for details. Existing file is backed up before modification.
Manual option: transcriptapi.com/signup → Dashboard → API Keys.
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:
INLINECODE6
API Reference
Full OpenAPI spec: transcriptapi.com/openapi.json — consult this for the latest parameters and schemas.
GET /api/v2/youtube/playlist/videos — 1 credit/page
Paginated playlist video listing (100 per page). Accepts playlist — a YouTube playlist URL or playlist ID.
CODEBLOCK2
| Param | Required | Validation |
|---|
| INLINECODE8 | conditional | Playlist URL or ID (PL/UU/LL/FL/OL prefix) |
| INLINECODE14 |
conditional | non-empty string |
Provide exactly one of playlist or continuation, not both.
Accepted playlist ID prefixes:
- -
PL — user-created playlists - INLINECODE18 — channel uploads playlist
- INLINECODE19 — liked videos
- INLINECODE20 — favorites
- INLINECODE21 — other system playlists
Response:
CODEBLOCK3
Pagination flow:
- 1. First request:
?playlist=PLxxx — returns first 100 videos + INLINECODE23 - Next request:
?continuation=TOKEN — returns next 100 + new token - Repeat until
has_more: false or INLINECODE26
Workflow: Playlist → Transcripts
CODEBLOCK4
Extract playlist ID from URL
From https://www.youtube.com/playlist?list=PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf, the playlist ID is PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf. You can also pass the full URL directly to the playlist parameter.
Errors
| Code | Meaning | Action |
|---|
| 400 | Both or neither params | Provide exactly one of playlist or continuation |
| 402 |
No credits | transcriptapi.com/billing |
| 404 | Playlist not found | Check if playlist is public |
| 408 | Timeout | Retry once |
| 422 | Invalid playlist format | Must be a valid playlist URL or ID |
1 credit per page. Free tier: 100 credits, 300 req/min.
YouTube 播放列表
通过 TranscriptAPI.com 浏览播放列表并获取转录文本。
设置
如果未设置 $TRANSCRIPTAPIKEY,请帮助用户创建账户(100 个免费积分,无需信用卡):
步骤 1 — 注册: 询问用户的邮箱。
bash
node ./scripts/tapi-auth.js register --email USER_EMAIL
→ 验证码已发送至邮箱。询问用户:请检查您的邮箱,获取 6 位验证码。
步骤 2 — 验证: 用户提供验证码后:
bash
node ./scripts/tapi-auth.js verify --token TOKENFROMSTEP_1 --otp CODE
API 密钥已保存至 ~/.openclaw/openclaw.json。详情请参见下方的文件写入部分。修改前会备份现有文件。
手动选项:transcriptapi.com/signup → 控制台 → API 密钥。
文件写入
验证和保存密钥命令会将 API 密钥保存至 ~/.openclaw/openclaw.json(设置 skills.entries.transcriptapi.apiKey 和 enabled: true)。修改前,现有文件会备份至 ~/.openclaw/openclaw.json.bak。
要在代理之外的终端/命令行中使用 API 密钥,请手动添加到您的 shell 配置文件中:
export TRANSCRIPTAPIKEY=
API 参考
完整 OpenAPI 规范:transcriptapi.com/openapi.json — 请查阅此文档获取最新参数和模式。
GET /api/v2/youtube/playlist/videos — 1 积分/页
分页播放列表视频列表(每页 100 个)。接受 playlist 参数 — YouTube 播放列表 URL 或播放列表 ID。
bash
第一页
curl -s https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL
PLAYLISTID \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
后续页面
curl -s https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN \
-H Authorization: Bearer $TRANSCRIPT
APIKEY
| 参数 | 必需 | 验证条件 |
|---|
| playlist | 条件必需 | 播放列表 URL 或 ID(PL/UU/LL/FL/OL 前缀) |
| continuation |
条件必需 | 非空字符串 |
仅提供 playlist 或 continuation 中的一个,不可同时提供。
接受的播放列表 ID 前缀:
- - PL — 用户创建的播放列表
- UU — 频道上传播放列表
- LL — 喜欢的视频
- FL — 收藏夹
- OL — 其他系统播放列表
响应:
json
{
results: [
{
videoId: abc123xyz00,
title: 播放列表视频标题,
channelId: UCuAXFkgsw1L7xaCfnd5JJOw,
channelTitle: 频道名称,
channelHandle: @handle,
lengthText: 10:05,
viewCountText: 150万次观看,
thumbnails: [{ url: ..., width: 120, height: 90 }],
index: 0
}
],
playlist_info: {
title: 最佳科学讲座,
numVideos: 47,
description: 顶级科学演讲,
ownerName: TED,
viewCount: 5000000
},
continuation_token: 4qmFsgKlARIYVVV1...,
has_more: true
}
分页流程:
- 1. 首次请求:?playlist=PLxxx — 返回前 100 个视频 + continuationtoken
- 后续请求:?continuation=TOKEN — 返回接下来 100 个视频 + 新 token
- 重复直到 hasmore: false 或 continuation_token: null
工作流程:播放列表 → 转录文本
bash
1. 列出播放列表视频
curl -s https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL
PLAYLISTID \
-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
从 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 次请求。