接口说明

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

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

请求URL

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

请求头

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

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

请求参数

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

options 参数说明

参数必填类型说明
includeCommunityNoboolean拉子版块卡片, 默认 true

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

附带评论限一页;需要继续获取评论时调用对应评论接口。

普通模式最多附带一层回复,不额外展开折叠线程。独立回复模式沿用回复接口的默认层级。

响应值

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

返回参数 data 说明

返回值类型说明
typestringType
可用值: [“post”]
posterobject作者
communityobject | null子版块摘要; 拉取失败为 null
postobject | nullPost
commentsobject[]评论 (顶层 + 页内嵌套回复)
othersany[]恒为空 (兼容旧键)
paginationobject评论分页

data.poster 字段说明

返回值类型说明
nicknamestring | null作者用户名
avatarnull恒为 null
profileUrlstring | null作者主页
idstring | null作者 id (t2_)

data.community 字段说明

返回值类型说明
urlstring子版块链接
namestring子版块名
descstring | null简介
weeklyVisitorsnumber | null周访客数
weeklyContributionsnumber | null周贡献数 (发帖 + 评论)
subredditIdstring | null子版块 id (t5_)

data.post 字段说明

返回值类型说明
titlestring | null标题
captionTextstring正文 (Markdown); 链接帖为空串
publishedAtobject | null发布时间 (text 为 ISO)
likesnumber | null得分 (赞 - 踩)
commentsCountnumber | null评论数
videoobject | nullReddit 托管视频; 非视频帖为 null
redditPostIdstring帖子 id (t3_)
id36string | null帖子短 id (链接里那段)
urlstring | null帖子链接
linkUrlstring | null帖子指向的链接 (自帖为帖子本身)
domainstring | null链接域名 (自帖为 self.<子版块>)
subredditstring | null子版块名
flairstring | null帖子标签 (flair)
upsnumber | null赞数
upvoteRationumber | null好评率 (0 ~ 1)
numCrosspostsnumber | null被交叉转发次数
editedAtobject | null最后编辑时间; 没编辑过 text / value 为 null
isSelfboolean是否自帖 (纯文字)
isVideoboolean是否视频帖
over18boolean是否 NSFW
spoilerboolean是否剧透
stickiedboolean是否置顶
lockedboolean是否锁定 (禁止评论)
archivedboolean是否已归档 (不能投票 / 评论)
distinguishedstring | null特殊身份标记: moderator / admin; 普通为 null
postHintstring | null内容类型提示: self / link / image / hosted:video …
thumbnailstring | null缩略图
previewImagestring | null预览大图
redditVideoobject | null视频原始信息; 非视频帖为 null
galleryobject[]图集帖的图片; 非图集为空

data.post.publishedAt 字段说明

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

data.post.video 字段说明

返回值类型说明
srcstring | null视频地址 (HLS 优先)
previewstring | null预览图
posterstring | null封面

data.post.editedAt 字段说明

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

data.post.redditVideo 字段说明

返回值类型说明
hlsUrlstringHLS 地址
fallbackUrlstringMP4 地址 (无声)
dashUrlstringDASH 地址
widthnumber宽
heightnumber高
durationnumber时长 (秒)

data.post.gallery[] 字段说明

返回值类型说明
urlstring图片链接
widthnumber | null宽
heightnumber | null高
captionstring | null图注

data.comments[] 字段说明

返回值类型说明
timeobject | null评论时间 (text 为 ISO)
contentstring | null评论内容 (纯文本)
scorenumber | null得分
avatarnull恒为 null (匿名拿不到)
nicknamestring | null评论者用户名
profileUrlstring | null评论者主页
idstring评论 id (t1_); 回复模式传 options.commentId 用它
parentIdstring | null父级 id: 顶层评论为帖子 id (t3_), 回复为父评论 id (t1_)
depthnumber层级: 0 顶层, 1 一级回复, 2 …
replyCountnumber回复总数 (含未展开的)
urlstring | null评论链接
replysobject[]页内附带的回复,按层嵌套;普通模式最多一层回复,独立回复模式沿用回复接口的层级。

data.comments[].time 字段说明

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

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

返回值类型说明
timeobject | null评论时间 (text 为 ISO)
contentstring | null评论内容 (纯文本)
scorenumber | null得分
avatarnull恒为 null (匿名拿不到)
nicknamestring | null评论者用户名
profileUrlstring | null评论者主页
idstring评论 id (t1_); 回复模式传 options.commentId 用它
parentIdstring | null父级 id: 顶层评论为帖子 id (t3_), 回复为父评论 id (t1_)
depthnumber层级: 0 顶层, 1 一级回复, 2 …
replyCountnumber回复总数 (含未展开的)
urlstring | null评论链接
replysobject[]下一层回复

data.pagination 字段说明

返回值类型说明
commentsobjectComments

data.pagination.comments 字段说明

返回值类型说明
cursorstring | null下一页游标, 传回 options.cursor 续取; null + hasMore 表示从头取
hasMoreboolean是否还有更多

请求示例

curl --request POST \
  --url https://scrapeapi.pangolinfo.com/api/v1/social/reddit-post \
  --header 'Authorization: Bearer YOUR_PANGOLINFO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "target": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"
}'

返回示例

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

{
  "code": 0,
  "message": "ok",
  "pointCost": 0.8,
  "data": {
    "type": "post",
    "poster": {
      "nickname": "PresidentObama",
      "avatar": null,
      "profileUrl": "https://www.reddit.com/user/PresidentObama/",
      "id": "t2_8t1cq"
    },
    "community": {
      "url": "https://www.reddit.com/r/IAmA/",
      "name": "IAmA",
      "desc": "I Am A, where the mundane becomes fascinating and the outrageous suddenly seems normal.",
      "weeklyVisitors": 436390,
      "weeklyContributions": 997,
      "subredditId": "t5_2qzb6"
    },
    "post": {
      "title": "I am Barack Obama, President of the United States -- AMA",
      "captionText": "Hi, I’m Barack Obama, President of the United States. Ask me anything. I’ll be taking your questions for half an hour starting at about 4:30 ET.\n\nProof it's ...",
      "publishedAt": {
        "text": "2012-08-29T20:01:36.000Z",
        "value": 1346270496000
      },
      "likes": 216184,
      "commentsCount": 22716,
      "video": null,
      "redditPostId": "t3_z1c9z",
      "id36": "z1c9z",
      "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/",
      "linkUrl": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/",
      "domain": "self.IAmA",
      "subreddit": "IAmA",
      "flair": "",
      "ups": 216184,
      "upvoteRatio": 0.68,
      "numCrossposts": 20,
      "editedAt": {
        "text": "2012-08-29T21:41:43.000Z",
        "value": 1346276503000
      },
      "isSelf": true,
      "isVideo": false,
      "over18": false,
      "spoiler": false,
      "stickied": false,
      "locked": false,
      "archived": true,
      "distinguished": null,
      "postHint": "self",
      "thumbnail": null,
      "previewImage": "https://external-preview.redd.it/KftOKw5o_G5ug7ENkLFbplFDpcApH0MvkQoOQD4nKng.jpg?auto=webp&s=8bb3639e7098b7400dffa84ddcff088561f7c082",
      "redditVideo": null,
      "gallery": []
    },
    "comments": [
      {
        "time": {
          "text": "2012-08-29T20:05:19.000Z",
          "value": 1346270719000
        },
        "content": "How do you balance family life and hobbies with, well, being the POTUS?",
        "score": 1556,
        "avatar": null,
        "nickname": "gobearss",
        "profileUrl": "https://www.reddit.com/user/gobearss/",
        "replys": [
          {
            "time": {
              "text": "2012-08-29T21:04:58.000Z",
              "value": 1346274298000
            },
            "content": "It's hard - truthfully the main thing other than work is just making sure that I'm spending enough time with michelle and the girls. The big advantage I have...",
            "score": 2951,
            "avatar": null,
            "nickname": "PresidentObama",
            "profileUrl": "https://www.reddit.com/user/PresidentObama/",
            "replys": [],
            "id": "t1_c60nmtc",
            "parentId": "t1_c60mmaf",
            "depth": 1,
            "replyCount": 319,
            "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/comment/c60nmtc/"
          }
        ],
        "id": "t1_c60mmaf",
        "parentId": "t3_z1c9z",
        "depth": 0,
        "replyCount": 328,
        "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/comment/c60mmaf/"
      }
    ],
    "others": [],
    "pagination": {
      "comments": {
        "cursor": null,
        "hasMore": true
      }
    }
  },
  "meta": {
    "requestId": "pg-audit-r1-reddit-post-1793954285969851600",
    "durationMs": 8698
  },
  "billing": {
    "unitPrice": 0.8,
    "ruleVersion": "social-primary-v2",
    "billedCount": 1,
    "pointCost": 0.8
  }
}

积点消耗说明

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

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

在线调试