YouTube 社区帖子详情 API
YouTube 社区帖子详情 API,支持真实 JSON 示例与在线测试;空结果和失败免费。
YouTube 社区帖子详情 API 查询公开业务数据,支持 URL 优先输入、真实 JSON 示例与在线测试。
打开产品页与 API Tester接口与鉴权
POST https://api.goanyapi.com/api/v1/youtube/post/detail同步返回,无任务和轮询。使用 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 |
| post_url | JSON body | string | 是 | — | 完整 HTTPS 帖子链接(/post/帖子ID)或帖子 ID;与 url 指向的频道匹配。 先使用相同 Bearer 鉴权调用 POST /api/v1/youtube/channel/posts,JSON 请求体见下方获取步骤,从 data.result.items[].id 读取参数。获取与目标请求分别按各自配置计费,空结果和失败免费。 pattern: ^(?:Ug[A-Za-z0-9_-]{8,200}|https://(?:www.|m.)?youtube.com/post/Ug[A-Za-z0-9_-]{8,200}/?(?:[?#][^\s]*)?)$ minLength: 1 |
获取依赖参数
先使用相同的 Bearer 鉴权请求 POST /api/v1/youtube/channel/posts
| JSON body 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | string | Yes | 完整 HTTPS 频道链接、@handle 或 UC 开头的频道 ID;支持 @handle、channel、c 和 user 路径,无需先查询 ID,不单独收费。 |
| cursor | string | No | 首次不传;后续原样传入 data.result.next_cursor,不自行构造偏移。 |
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/channel/posts' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/@daojie"}'读取 data.result.items[].id,填写 post_url(也可输入完整帖子 URL);url 继续填写同一频道 URL。 获取参数和目标查询分别按各自数据库配置计费;空结果和失败免费。参数获取成功后不会自动提交目标查询。
输出字段
| 字段 | 类型 | 说明 |
|---|---|---|
| code | string | 成功为 ok,失败为公开错误码 |
| message | string | 状态说明 |
| data.result | object / null | 公开业务结果;空值与缺失按实际结果保留 |
| data.creditsUsed | integer | 当前配置对应的实际扣费;空结果为 0 |
| data.remainingCredits | number | 结算后余额 |
| data.result.items | array | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].type | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].id | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].title | null | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].content | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author | object | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.name | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.channelId | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.thumbnails | array | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.thumbnails[].url | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.thumbnails[].width | number | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].author.thumbnails[].height | number | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].publishedTime | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].likeCount | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].images | array | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].images[].url | string | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].images[].width | number | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
| data.result.items[].images[].height | number | 实际业务字段;可为空或缺失,文本计数不是精确整数 |
本接口不支持分页,不接受 cursor。列表长度是本次实际返回条数,不是全部记录总数。
请求示例
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/post/detail' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/@MrBeast","post_url":"https://www.youtube.com/post/UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR"}'真实响应示例
下列示例来自真实请求;仅省略实时 data.creditsUsed 与 data.remainingCredits。媒体和字幕 URL 可能已过期。
{
"code": "ok",
"message": "ok",
"data": {
"result": {
"items": [
{
"type": "post",
"id": "UgkxIkDHJ9iW7XmjtMbke3Ud7rEiV5jSHDnR",
"title": null,
"content": "Hunger Games In Real Life drops on Saturday!\nWe designed custom suits that detect when they’re hit by magnetic foam weapons 👀",
"author": {
"name": "MrBeast",
"channelId": "UCX6OQ3DkcsbYNE6H8uQQuVA",
"thumbnails": [
{
"url": "//yt3.googleusercontent.com/nxYrc_1_2f77DoBadyxMTmv7ZpRZapHR5jbuYe7PlPd5cIRJxtNNEYyOC0ZsxaDyJJzXrnJiuDE=s32-c-k-c0x00ffffff-no-rj-mo",
"width": 32,
"height": 32
},
{
"url": "//yt3.googleusercontent.com/nxYrc_1_2f77DoBadyxMTmv7ZpRZapHR5jbuYe7PlPd5cIRJxtNNEYyOC0ZsxaDyJJzXrnJiuDE=s48-c-k-c0x00ffffff-no-rj-mo",
"width": 48,
"height": 48
},
{
"url": "//yt3.googleusercontent.com/nxYrc_1_2f77DoBadyxMTmv7ZpRZapHR5jbuYe7PlPd5cIRJxtNNEYyOC0ZsxaDyJJzXrnJiuDE=s76-c-k-c0x00ffffff-no-rj-mo",
"width": 76,
"height": 76
}
]
},
"publishedTime": "9 days ago",
"likeCount": "306K",
"images": [
{
"url": "https://yt3.ggpht.com/-nihmRU8RGnrkkYNC73Y_eRRp03ReHeIdKSE8oqRy-HOu0dfZ-7Y5ND61lI9CS3Thlec0shis6WGXQ=s640-c-fcrop64=1,00001000ffffefff-rw-nd-v1",
"width": 640,
"height": 640
},
{
"url": "https://yt3.ggpht.com/g2LFXicy-wjSH-5pvMPnOnp0YHZXO0VaOzf8Y9yws0OFoH2yQjx_1abszLqWNv6f7BoJ3VnXmB6S=s640-c-fcrop64=1,00001000ffffefff-rw-nd-v1",
"width": 640,
"height": 640
}
]
}
]
}
}
}计费与状态码
…
每个接口独立读取数据库价格;仅非空成功结果收费,空结果和失败免费,每页单独结算。可选标题、描述缺失不影响有效记录。媒体接口无视频与字幕时为空。
| HTTP | 含义 |
|---|---|
| 200 | 查询完成,可能为空 |
| 400 | JSON 或参数不合法 |
| 401 | 鉴权失败 |
| 402 | 积分不足 |
| 429 | 请求过于频繁,遵循 Retry-After |
| 502 | 数据请求失败 |
| 503 | 接口或价格尚未配置 |