关于 youtube-full
youtube-full 是通过 TranscriptAPI.com 获取 YouTube 数据的 Agent 技能,涵盖字幕、搜索、视频与频道信息、频道动态和播放列表。
主要功能
- 01获取带时间戳或纯文本字幕
- 02搜索视频、频道、播放列表和电影
- 03读取视频与频道信息
- 04浏览频道动态和播放列表
- 05解析频道账号句柄
适用场景
- 01围绕主题搜索并收集视频字幕
- 02跟踪频道最新上传内容
- 03查看频道资料与播放列表
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ zeropointrepo/ youtube-skills --skill youtube-full安装后在 Claude Code 中输入/youtube-full确认已加载。
附带文件references/auth-setup.mdreferences/curl-examples.md
详细介绍
YouTube Full
通过 TranscriptAPI.com 提供完整的 YouTube 工具包。一项技能即可满足所有需求。
设置
如果未设置 $TRANSCRIPT_API_KEY,请阅读 references/auth-setup.md,并按照其中的说明获取和保存密钥。
必需的请求头
每个请求都需要两个请求头:
- Authorization:
Bearer $TRANSCRIPT_API_KEY - User-Agent: 如果已知,请填写 Agent 的名称和版本(例如
HermesAgent/0.11.0、ClaudeCode/1.0)。版本可选;仅填写 Agent 名称也可以。不要省略此请求头,也不要发送默认的空值,否则 Cloudflare 会返回 403(错误代码 1010)并阻止请求。
API 参考
完整的 OpenAPI 规范:transcriptapi.com/openapi.json — 请查阅以获取最新的参数和架构。
转录稿 — 1 个额度
GET https://transcriptapi.com/api/v2/youtube/transcript?video_url=VIDEO_URL&format=text&include_timestamp=true&send_metadata=true
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
| 参数 | 必填 | 默认值 | 值 |
|---|---|---|---|
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": "..." }
}
视频信息与元数据
# Free — languages available for the transcript endpoint
GET https://transcriptapi.com/api/v2/youtube/info?video_url=VIDEO_URL
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# 1 credit — rich metadata (views, likes, description, duration, tags)
GET https://transcriptapi.com/api/v2/youtube/video/metadata?video_url=VIDEO_URL&include=details,related
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
video/metadata 的 include 接受 details 和/或 related。命名说明:/video/metadata 以前称为 /video/info,旧路径仍可用,但已弃用。
搜索 — 每页 1 个额度
# Videos
GET https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=video&limit=20
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# Channels, playlists, or movies
GET https://transcriptapi.com/api/v2/youtube/search?q=QUERY&type=channel&limit=10
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
| 参数 | 必填 | 默认值 | 验证规则 |
|---|---|---|---|
q | 是 | — | 1-200 个字符 |
type | 否 | video | video、channel、playlist、movie |
sort | 否 | relevance | relevance、views(仅限第一页) |
upload_date | 否 | — | hour、today、week、month、year(仅限视频,第一页) |
duration | 否 | — | short、medium、long(仅限视频,第一页) |
features | 否 | — | 例如 hd,subtitles,cc(仅限第一页) |
limit | 否 | 20 | 1-50 |
频道
所有频道端点都接受 channel,可以是 @handle、频道 URL 或 UC... 频道 ID。无需先解析。
解析 handle — 免费
GET https://transcriptapi.com/api/v2/youtube/channel/resolve?input=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
响应:{"channel_id": "UC...", "resolved_from": "@TED"}
最新 15 个视频 — 免费
GET https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
返回准确的 viewCount 和 ISO 格式的 published 时间戳。
频道动态(视频/短视频/直播)— 每页 1 个额度
# First page (100 items, tab defaults to "videos")
GET https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA&tab=videos
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# Most-viewed first (channel Videos tab, ~30 items)
GET https://transcriptapi.com/api/v2/youtube/channel/videos?channel=@NASA&sort=popular
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# Next pages (repeat the same tab AND sort)
GET https://transcriptapi.com/api/v2/youtube/channel/videos?continuation=TOKEN&sort=popular
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
必须且只能提供 channel 或 continuation 中的一个。tab 可以是 videos(默认值)、shorts 或 streams。响应包含 continuation_token 和 has_more。
排序。 在 channel/videos 中添加 sort=latest、popular 或 oldest,即可按所需顺序获取频道视频,例如优先显示观看次数最多的视频。排序后的页面约返回 30 个视频(未排序的页面约返回 100 个),每页的额度消耗均为 1 个。
翻页时,每次请求都使用相同的 sort。
条目字段。 每个条目都包含 members_only;只有当 YouTube 将其标记为“仅限会员”时,该值才为 true,这些条目没有 viewCountText。tab=streams 条目包含 lengthText 和 publishedTimeText(例如 Streamed 2 years ago);tab=shorts 的这两个字段都为 null,因为 YouTube 的 Shorts 网格不会提供这两项信息。在频道标签页动态中(tab=videos 且带有 sort、tab=shorts、tab=streams),channelId、channelTitle、channelHandle 和 index 均为 null。
在频道内搜索 — 1 个额度
GET https://transcriptapi.com/api/v2/youtube/channel/search?channel=@TED&q=QUERY&limit=30
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
频道资料 — 1 个额度
GET https://transcriptapi.com/api/v2/youtube/channel/info?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
返回标题、handle、认证标记、订阅者/视频数量、说明、标签、缩略图、横幅和 availableTabs。
频道播放列表 — 每页 1 个额度
GET https://transcriptapi.com/api/v2/youtube/channel/playlists?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
返回每个播放列表的 playlistId、title、url、videoCountText — 将 playlistId 传入下方的 Playlists 端点。
频道社区帖子 — 每页 1 个额度
GET https://transcriptapi.com/api/v2/youtube/channel/posts?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
频道精选版块 — 1 个额度
GET https://transcriptapi.com/api/v2/youtube/channel/sections?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
tab 可以是 featured(默认,主页)、podcasts 或 releases。
播放列表 — 每页 1 个额度
接受 playlist — YouTube 播放列表 URL 或播放列表 ID。
# First page
GET https://transcriptapi.com/api/v2/youtube/playlist/videos?playlist=PL_ID
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# Next pages
GET https://transcriptapi.com/api/v2/youtube/playlist/videos?continuation=TOKEN
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
有效的 ID 前缀:PL、UU、LL、FL、OL。响应包含 playlist_info、results、continuation_token、has_more。
额度费用
| 端点 | 费用 |
|---|---|
| transcript | 1 |
| info | 免费 |
| video/metadata | 1 |
| search | 1/页 |
| channel/resolve | 免费 |
| channel/info | 1 |
| channel/latest | 免费 |
| channel/videos | 1/页 |
| channel/search | 1 |
| channel/playlists | 1/页 |
| channel/posts | 1/页 |
| channel/sections | 1 |
| playlist/videos | 1/页 |
验证规则
| 字段 | 规则 |
|---|---|
channel | @handle、频道 URL 或 UC... ID |
playlist | 播放列表 URL 或 ID(PL/UU/LL/FL/OL 前缀) |
q | 1-200 个字符 |
type(search) | video(默认)、channel、playlist、movie |
tab(channel/videos) | videos(默认)、shorts、streams |
sort(channel/videos) | latest、popular、oldest(上传动态流省略此项) |
tab(channel/sections) | featured(默认)、podcasts、releases |
include(video/metadata) | details、related(以逗号分隔) |
limit | 1-50 |
错误
| 代码 | 含义 | 操作 |
|---|---|---|
| 401 | API 密钥无效 | 检查密钥 |
| 402 | 无可用额度 | transcriptapi.com/billing |
| 403/1010 | Cloudflare 拦截 | 添加或修正 User-Agent 标头 |
| 404 | 未找到 | 资源不存在或没有字幕 |
| 408 | 超时 | 等待 2 秒后重试一次 |
| 422 | 验证错误 | 检查参数格式 |
| 429 | 请求过多 | 等待,并遵守 Retry-After |
典型工作流
研究工作流: 搜索 → 选择视频 → 获取转录文本
# 1. Search
GET https://transcriptapi.com/api/v2/youtube/search?q=machine+learning+explained&limit=5
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# 2. Transcript
GET https://transcriptapi.com/api/v2/youtube/transcript?video_url=VIDEO_ID&format=text&include_timestamp=true&send_metadata=true
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
频道监控: 最新内容(免费)→ 转录文本
# 1. Latest uploads (free — pass @handle directly)
GET https://transcriptapi.com/api/v2/youtube/channel/latest?channel=@TED
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
# 2. Transcript of latest
GET https://transcriptapi.com/api/v2/youtube/transcript?video_url=VIDEO_ID&format=text&include_timestamp=true&send_metadata=true
Authorization: Bearer $TRANSCRIPT_API_KEY
User-Agent: YourAgent/1.0
免费套餐:100 个额度,每分钟 300 个请求。Starter($5/月):1,000 个额度。
可直接复制的示例
本文件中的每个请求都提供了可直接运行的单行命令:references/curl-examples.md