YouTube 频道课程 API
YouTube 频道课程 API,支持真实 JSON 示例与在线测试;空结果和失败免费。
YouTube 频道课程 API 查询公开业务数据,支持 URL 优先输入、真实 JSON 示例与在线测试。
打开产品页与 API Tester接口与鉴权
POST https://api.goanyapi.com/api/v1/youtube/channel/courses同步返回,无任务和轮询。使用 API Key 或受支持的 OAuth Bearer 凭证;没有 Path 或 Query 参数。
输入参数
| 参数 | 位置 | 类型 | 必填 | 默认值 | 范围与说明 |
|---|---|---|---|---|---|
| Authorization | Header | string | 是 | — | Bearer YOUR_API_KEY |
| Content-Type | Header | string | 是 | application/json | application/json |
| url | JSON body | string | 是 | — | 完整 HTTPS 频道链接、@handle 或 UC 开头的频道 ID;支持 @handle、channel、c 和 user 路径,无需先查询 ID,不单独收费。 pattern: ^(?:@[^\s/?#]+|UC[A-Za-z0-9_-]{22}|https://(?:www.|m.)?youtube.com/(?:@[^\s/?#]+|channel/UC[A-Za-z0-9_-]{22}|(?:c|user)/[^\s/?#]+)/?(?:[?#][^\s]*)?)$ minLength: 1 |
| cursor | JSON body | string | 否 | — | 首次不传;后续原样传入 data.result.next_cursor,不自行构造偏移。 maxLength: 16000 |
列表仅返回业务条目,不公开原始 response 或条目 data。条目可包含 channel/channelId、description 和 subscriberCountText;评论可包含字符串 author、authorChannelId、publishedTimeText、likeCountText 和 reply_cursor。可选字段允许 null、空值和缺失。旧版保存响应可能使用 author 对象、channel 对象、publishedTime 或 likeCount;不能要求新结果必须包含旧字段。
输出字段
| 字段 | 类型 | 说明 |
|---|---|---|
| code | string | 成功为 ok,失败为公开错误码 |
| message | string | 状态说明 |
| data.result | object / null | 公开业务结果;空值与缺失按实际结果保留 |
| data.creditsUsed | integer | 当前配置对应的实际扣费;空结果为 0 |
| data.remainingCredits | number | 结算后余额 |
| data.result.next_cursor | null | 下一页游标,原样传入 cursor |
| data.result.hasMore | boolean | 是否还有结果;同时需要有效且不同的 next_cursor |
| data.result.items | array | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].type | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].id | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].title | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].url | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].thumbnailUrl | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].videoCountText | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].channel | string / object / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].channelId | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].description | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].subscriberCountText | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].author | string / object / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].authorChannelId | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].publishedTimeText | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].likeCountText | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
| data.result.items[].videoId | string / null | 对应类型条目可能返回;仅按实际值保留,不保证存在。 |
频道列表统一返回 items、next_cursor 和 hasMore;课程条目 type 为 course,播放列表条目为 playlist。频道未提供对应内容标签时返回 HTTP 502 / request_failed,不扣费;这与 HTTP 200 的成功空列表不同。
列表长度为本页实际记录数,不代表全部记录总数;不提供固定页大小。仅在 hasMore 为 true 且 next_cursor 非空并不同于当前游标时继续;回复首次使用 reply_cursor,后续使用 next_cursor,二者用途不同。
请求示例
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/channel/courses' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/@daojie"}'真实响应示例
以下为历史版本采集的真实样本,可能包含旧字段命名;本次未重新采集或改写样本。
下列示例来自真实请求;仅省略实时 data.creditsUsed 与 data.remainingCredits。媒体和字幕 URL 可能已过期。
{
"code": "ok",
"message": "ok",
"data": {
"result": {
"next_cursor": null,
"hasMore": false,
"items": [
{
"type": "course",
"id": "PLxVm5249zXQaqzl7MW7Gx0Y3d_AzLP8mi",
"title": "谷歌分析全教程",
"url": "https://www.youtube.com/playlist?list=PLxVm5249zXQaqzl7MW7Gx0Y3d_AzLP8mi",
"thumbnailUrl": "https://i.ytimg.com/vi/2dnOEFVHMI0/hqdefault.jpg?sqp=-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDQZ7cf6lsByXT1SwDzxUD3aYL9zA",
"videoCountText": "7 videos"
}
]
}
}
}计费与状态码
…
每个接口独立读取数据库价格;仅非空成功结果收费,空结果和失败免费,每页单独结算。可选标题、描述缺失不影响有效记录。媒体接口无视频与字幕时为空。
| HTTP | 含义 |
|---|---|
| 200 | 查询完成,可能为空 |
| 400 | JSON 或参数不合法 |
| 401 | 鉴权失败 |
| 402 | 积分不足 |
| 429 | 请求过于频繁,遵循 Retry-After |
| 502 | 数据请求失败 |
| 503 | 接口或价格尚未配置 |