接口说明

YouTube Post API 获取 YouTube 帖子详情及附带的作者、媒体和评论等数据。

使用 Pangolinfo API Key 调用,返回结构化 JSON 数据。

请求URL

POST https://scrapeapi.pangolinfo.com/api/v1/social/youtube-post

请求头

参数名参数值类型说明
Content-Typeapplication/jsonstring数据格式
AuthorizationBearer xxxstring认证凭证

采集最长约75秒,客户端超时建议设为90秒。

请求参数

参数必填类型说明
targetYesstring帖子链接 (支持短链); 也可直接传视频 id (如 dQw4w9WgXcQ)
optionsNoobject仅处理下列开放参数;未列出的字段忽略,内部参数不可覆盖。

options 参数说明

参数必填类型说明
includeFormatsNoboolean额外返回画质 / 编码 / 音轨列表 post.formats; 直链约 6 小时过期且绑定出口 IP; 默认 false

仅处理本页列出的请求参数,其他字段忽略。分页游标原样传回,不编码、解码或转换格式。

附带一页评论,不主动获取评论回复。

响应值

返回值类型说明
codeinteger状态码,0 表示成功
messagestring响应信息,成功时为 ok
pointCostnumber本次请求实际消耗的积点
dataobject返回数据,结构见下表
metaobject请求标识及耗时(毫秒)
billingobject计费条数、单价及规则版本

返回参数 data 说明

返回值类型说明
typestringType
可用值: [“post”]
posterobject作者
postobjectPost
commentsobject[]顶层评论 (回复挂在 replys 下)
paginationobject评论分页

data.poster 字段说明

返回值类型说明
nicknamestring | null频道名
avatarstring | null视频首张缩略图 (兼容旧键; 接口不给频道头像)
profileUrlstring | null频道 @handle 链接
channelIdstring | null频道 id
handlestring | null@handle
channelUrlstring | null频道 id 链接

data.post 字段说明

返回值类型说明
titlestring | null标题
captionTextstring | null简介
publishedAtobject | null发布时间 (text 为带时区的 ISO)
viewsnumber播放数
likesnumber点赞数
commentsCountnumber评论数
videoIdstring视频 id
urlstring视频链接 (Shorts 为 /shorts/ 链接)
isShortboolean是否 Shorts
durationSecnumber | null时长 (秒)
uploadDatestring | null上传时间
categorystring | null分类
keywordsstring[]标签
thumbnailsobject[]缩略图各尺寸
isLiveContentboolean是否直播内容
isLiveNowboolean是否正在直播
liveStartTimestampstring | null直播开始时间
liveEndTimestampstring | null直播结束时间
isPrivateboolean是否私享
isUnlistedboolean是否不公开 (仅链接可见)
isFamilySafeboolean是否适合家庭
allowRatingsboolean是否允许点赞
playabilityStatusstring | null播放状态 (匿名网页端常为 UNPLAYABLE, 不影响采集)
availableCountriesCountnumber | null可播放的国家 / 地区数
chaptersobject[]章节; 没有为空
relatedobject[]相关推荐视频
formatsobject[]画质 / 编码 / 音轨列表; 只有 options.includeFormats 才有

data.post.publishedAt 字段说明

返回值类型说明
textstring | null上游原始时间文本
valuenumber | null解析后的毫秒时间戳; 解析失败为 null

data.post.thumbnails[] 字段说明

返回值类型说明
urlstringUrl
widthnumber宽
heightnumber高

data.post.chapters[] 字段说明

返回值类型说明
titlestring | null章节标题
startMsnumber开始毫秒
thumbnailstring | null章节缩略图

data.post.related[] 字段说明

返回值类型说明
workIdstring | null作品 id (视频 id / 播放列表 id)
videoIdstring | null视频 id; 播放列表为 null
workTypestring作品类型
可用值: [“video”, “short”, “playlist”, “lockup”]
kindstring同 workType
可用值: [“video”, “short”, “playlist”, “lockup”]
urlstring | null链接
titlestring | null标题
thumbnailstring | null封面 (最大尺寸)
coverstring | null封面 (同 thumbnail)
viewsnumber | null播放数 (由文案解析, 如 1.2M → 1200000)
publishTimestring | null发布时间文案, 如 7 days ago; Shorts 没有
durationTextstring | null时长文案, 如 9:18; Shorts 没有
durationSecnumber | null时长 (秒); Shorts 没有
playlistIdstring | null播放列表 id; 视频为 null
contentIdstring | null上游内容 id
contentTypestring | null上游内容类型, 如 LOCKUP_CONTENT_TYPE_VIDEO
channelIdstring | null所属频道 id (推荐视频才有; 频道自己的作品为 null)
channelHandlestring | null所属频道 @handle
channelNamestring | null所属频道名 (推荐视频的第一行文案; 直播预告可能是 “12 waiting”)
accessibilityTextstring | null仅 Shorts: 无障碍描述

data.post.formats[] 字段说明

返回值类型说明
itagnumber格式编号
mimeTypestring | nullMIME 类型, 如 video/mp4
codecsstring | null编码, 如 avc1.42001E, mp4a.40.2
hasVideoboolean是否含视频
hasAudioboolean是否含音频
qualityLabelstring | null清晰度, 如 1080p; 纯音频为 null
widthnumber | null宽
heightnumber | null高
fpsnumber | null帧率
bitratenumber | null码率
contentLengthnumber | null文件大小 (字节)
audioQualitystring | null音质: AUDIO_QUALITY_LOW / MEDIUM …
audioSampleRatenumber | null采样率
audioChannelsnumber | null声道数
audioTrackobject | null多音轨视频的音轨; 单音轨为 null
urlstring | null直链 (约 6 小时过期, 绑定出口 IP)

data.comments[] 字段说明

返回值类型说明
timeTextobject评论时间 (注意键是 timestamp 不是 value)
contentstring | null评论内容
likeCountnumber | null点赞数
replyCountnumber | null回复数
avatarstring | null评论者头像
nicknamestring | null评论者显示名 (@handle)
profileUrlstring | null评论者频道链接
commentIdstring评论 id; 回复模式传 options.commentId 用它
parentIdstring | null父评论 id; 顶层为 null
authorChannelIdstring | null评论者频道 id
authorIsVerifiedboolean评论者是否认证
authorIsCreatorboolean是否视频作者本人
authorIsArtistboolean是否官方艺人频道
replyLevelnumber | null层级: 0 顶层, 1 回复
timestampsobject[]正文里提到的视频时间点
replyCursorstring | null回复首页游标: 回复模式传 options.cursor (与 commentId 一起); 无回复为 null
replysobject[]附带的一级回复;视频详情不主动展开回复,普通评论模式每条评论最多自动附带200条回复。

data.comments[].timeText 字段说明

返回值类型说明
textstring | null相对时间原文, 如 “6 years ago (edited)“
timestampnumber | null按相对时间推算的毫秒时间戳 (近似值)

data.comments[].timestamps[] 字段说明

返回值类型说明
textstring原文, 如 1:23
secondsnumber秒数

data.comments[].replys[] 字段说明

返回值类型说明
timeTextobject评论时间 (注意键是 timestamp 不是 value)
contentstring | null评论内容
likeCountnumber | null点赞数
replyCountnumber | null回复数
avatarstring | null评论者头像
nicknamestring | null评论者显示名 (@handle)
profileUrlstring | null评论者频道链接
commentIdstring评论 id; 回复模式传 options.commentId 用它
parentIdstring | null父评论 id; 顶层为 null
authorChannelIdstring | null评论者频道 id
authorIsVerifiedboolean评论者是否认证
authorIsCreatorboolean是否视频作者本人
authorIsArtistboolean是否官方艺人频道
replyLevelnumber | null层级: 0 顶层, 1 回复
timestampsobject[]正文里提到的视频时间点
replyCursorstring | null回复首页游标: 回复模式传 options.cursor (与 commentId 一起); 无回复为 null
replysany[]不再向下展开, 恒为空

data.pagination 字段说明

返回值类型说明
commentsobjectComments

data.pagination.comments 字段说明

返回值类型说明
cursorstring | null下一页游标 (带排序前缀 top: / new:), 传回 options.cursor 续取
hasMoreboolean是否还有更多

请求示例

curl --request POST \
  --url https://scrapeapi.pangolinfo.com/api/v1/social/youtube-post \
  --header 'Authorization: Bearer YOUR_PANGOLINFO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}'

返回示例

下例截取实际响应中的首条列表记录,长文本与链接作了缩写;pointCost 为该次完整响应的实际费用。完整字段结构可在在线调试页查看。

{
  "code": 0,
  "message": "ok",
  "pointCost": 0.8,
  "data": {
    "type": "post",
    "poster": {
      "nickname": "Rick Astley",
      "avatar": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLDd2KtelLHaNSXrI9_5K-NvTscKNw",
      "profileUrl": "https://www.youtube.com/@RickAstleyYT",
      "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "handle": "@RickAstleyYT",
      "channelUrl": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"
    },
    "post": {
      "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
      "captionText": "The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Autobiography 📚 OUT NOW! \nFollow this link to get your copy and listen to Rick’...",
      "publishedAt": {
        "text": "2009-10-24T23:57:33-07:00",
        "value": 1256453853000
      },
      "views": 1834211816,
      "likes": 19493697,
      "commentsCount": 2400000,
      "videoId": "dQw4w9WgXcQ",
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "isShort": false,
      "durationSec": 213,
      "uploadDate": "2009-10-24T23:57:33-07:00",
      "category": "Music",
      "keywords": [
        "rick astley"
      ],
      "thumbnails": [
        {
          "url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLDd2KtelLHaNSXrI9_5K-NvTscKNw",
          "width": 168,
          "height": 94
        }
      ],
      "isLiveContent": false,
      "isLiveNow": false,
      "liveStartTimestamp": null,
      "liveEndTimestamp": null,
      "isPrivate": false,
      "isUnlisted": false,
      "isFamilySafe": true,
      "allowRatings": true,
      "playabilityStatus": "UNPLAYABLE",
      "availableCountriesCount": 249,
      "chapters": [],
      "related": [
        {
          "workId": "yPYZpwSpKmA",
          "videoId": "yPYZpwSpKmA",
          "playlistId": null,
          "contentId": "yPYZpwSpKmA",
          "contentType": "LOCKUP_CONTENT_TYPE_VIDEO",
          "workType": "video",
          "kind": "video",
          "url": "https://www.youtube.com/watch?v=yPYZpwSpKmA",
          "title": "Rick Astley - Together Forever (Official Video) [4K Remaster]",
          "thumbnail": "https://i.ytimg.com/vi/yPYZpwSpKmA/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD6igKYt99JwlgbMCpf5I2GwXNVow",
          "cover": "https://i.ytimg.com/vi/yPYZpwSpKmA/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD6igKYt99JwlgbMCpf5I2GwXNVow",
          "views": 208000000,
          "publishTime": "17y ago",
          "durationText": "3:24",
          "durationSec": 204,
          "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
          "channelHandle": null,
          "channelName": "Rick Astley"
        }
      ]
    },
    "comments": [
      {
        "timeText": {
          "text": "6 years ago (edited)",
          "timestamp": 1604738263706
        },
        "content": "I Rick rolled my entire French class because we had to study a city in France and make a quiz about it as well as a presentation, I decided to make a Kahoot ...",
        "likeCount": 107000,
        "replyCount": 677,
        "avatar": "https://yt3.ggpht.com/ytc/AIdro_kDD-FhIbth2qcBbI9VGxR41dJa0kE3kN9iVlGzNgRU_g=s88-c-k-c0x00ffffff-no-rj",
        "nickname": "@grustache4569",
        "profileUrl": "https://www.youtube.com/channel/UCKrzgYonJnMd0Dk7zQXjYXw",
        "replys": [],
        "commentId": "UgzKYksqeQ5gA3t0g0F4AaABAg",
        "parentId": null,
        "authorChannelId": "UCKrzgYonJnMd0Dk7zQXjYXw",
        "authorIsVerified": false,
        "authorIsCreator": false,
        "authorIsArtist": false,
        "replyLevel": 0,
        "timestamps": [],
        "replyCursor": "Eg0SC2RRdzR3OVdnWGNRGAYygwEaUBIaVWd6S1lrc3FlUTVnQTN0MGcwRjRBYUFCQWciAggAKhhVQ3VBWEZrZ3N3MUw3eGFDZm5kNUpKT3cyC2RRdzR3OVdnWGNRQAFICoIBAggBQi9jb21tZW50LXJlcGxpZ..."
      }
    ],
    "pagination": {
      "comments": {
        "cursor": "top:Eg0SC2RRdzR3OVdnWGNRGAYyWCIxIgtkUXc0dzlXZ1hjUTAAeAKqAhpVZ3pLWWtzcWVRNWdBM3QwZzBGNEFhQUJBZ_ADATABQiFlbmdhZ2VtZW50LXBhbmVsLWNvbW1lbnRzLXNlY3Rpb24%3D",
        "hasMore": true
      }
    }
  },
  "meta": {
    "requestId": "pg-audit-r1-youtube-post-1793954255669594900",
    "durationMs": 6816
  },
  "billing": {
    "unitPrice": 0.8,
    "ruleVersion": "social-primary-v2",
    "billedCount": 1,
    "pointCost": 0.8
  }
}

积点消耗说明

每条帖子、视频或商家主体消耗 0.8 积点,附带评论、回复和作者资料免费。

空结果、失败响应不扣费。同一响应中相同 ID 只计一次,独立调用和续页分别计费。详见 社媒评论 API 计费说明。

在线调试