Facebook
Facebook Comments API
获取 Facebook 评论数据,支持接口列出的分页、排序或筛选参数。
接口说明
Facebook Comments API 获取 Facebook 评论数据,支持接口列出的分页、排序或筛选参数。
使用 Pangolinfo API Key 调用,返回结构化 JSON 数据。
请求URL
请求头
| 参数名 | 参数值 | 类型 | 说明 |
|---|---|---|---|
| Content-Type | application/json | string | 数据格式 |
| Authorization | Bearer xxx | string | 认证凭证 |
采集最长约75秒,客户端超时建议设为90秒。
请求参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
| target | Yes | string | 帖子链接(不支持直接传 id) |
| options | No | object | 仅处理下列开放参数;未列出的字段忽略,内部参数不可覆盖。 |
options 参数说明
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
| maxPages | No | integer | 本次请求翻几页,默认 1,最大 5,按实际返回条数计费,更多数据用返回的游标续取 默认值: 1 最小值: 1 最大值: 5 |
| cursor | No | string | null | 续取评论: 上次输出的 pagination.comments.cursor; 回复模式: 评论输出的 replyCursor, 或上次输出的 pagination.cursor; 首页不给时只在帖子首屏评论里查找 |
| sort | No | string | 评论排序: top (热门, 默认) / new (最新);可选值:top / new 可用值: [“top”, “new”] |
| commentId | No | string | 回复模式: 主评论 id (评论输出的 id) |
仅处理本页列出的请求参数,其他字段忽略。分页游标原样传回,不编码、解码或转换格式。
每次默认1页,最多5页;页数必须为正整数,超过5按5处理。
提供非空commentId进入独立回复模式,按返回的直接回复计费;Facebook同时计入返回的嵌套回复。按本页cursor说明续取。
响应值
| 返回值 | 类型 | 说明 |
|---|---|---|
| code | integer | 状态码,0 表示成功 |
| message | string | 响应信息,成功时为 ok |
| pointCost | number | 本次请求实际消耗的积点 |
| data | object | 返回数据,结构见下表 |
| meta | object | 请求标识及耗时(毫秒) |
| billing | object | 计费条数、单价及规则版本 |
返回参数 data 说明
| 返回值 | 类型 | 说明 |
|---|---|---|
| type | string | comments = 评论模式; replies = 回复模式 (传了 options.commentId) 可用值: [“comments”, “replies”] |
| commentsCount | number | null | 评论模式: 评论总数 |
| comments | object[] | 评论模式: 评论, 与 facebook-post 同形 |
| commentId | string | 回复模式: 父评论 id |
| replies | object[] | 回复模式: 回复, 与评论同形 |
| pagination | object | 评论模式: {comments: {cursor, hasMore}}; 回复模式: {cursor, hasMore} |
data.comments[] 字段说明
| 返回值 | 类型 | 说明 |
|---|---|---|
| avatar | string | null | 评论者头像 |
| nickname | string | null | 评论者名字 |
| profileUrl | string | null | 评论者主页 |
| timeText | object | null | 评论时间 (text 为 ISO) |
| content | string | null | 评论内容 |
| mood | number | null | 评论的回应 (点赞) 数; 0 时为 null |
| id | string | null | 评论 id (base64); 回复模式传 options.commentId 用它 |
| legacyId | string | null | 评论数字 id |
| authorId | string | null | 评论者 id (可能是 pfbid 加密 id) |
| authorType | string | null | 评论者类型: User / Page |
| replyCount | number | 回复数 |
| url | string | null | 评论链接 |
| depth | number | 层级: 0 顶层, 1 回复 |
| parentId | string | null | 父评论 id; 顶层为 null |
| replyCursor | string | null | 回复首页游标: 回复模式传 options.cursor (与 commentId 一起); 无回复为 null, 有时效 |
data.comments[].timeText 字段说明
| 返回值 | 类型 | 说明 |
|---|---|---|
| text | string | null | 上游原始时间文本 |
| value | number | null | 解析后的毫秒时间戳; 解析失败为 null |
data.replies[] 字段说明
| 返回值 | 类型 | 说明 |
|---|---|---|
| avatar | string | null | 评论者头像 |
| nickname | string | null | 评论者名字 |
| profileUrl | string | null | 评论者主页 |
| timeText | object | null | 评论时间 (text 为 ISO) |
| content | string | null | 评论内容 |
| mood | number | null | 评论的回应 (点赞) 数; 0 时为 null |
| id | string | null | 评论 id (base64); 回复模式传 options.commentId 用它 |
| legacyId | string | null | 评论数字 id |
| authorId | string | null | 评论者 id (可能是 pfbid 加密 id) |
| authorType | string | null | 评论者类型: User / Page |
| replyCount | number | 回复数 |
| url | string | null | 评论链接 |
| depth | number | 层级: 0 顶层, 1 回复 |
| parentId | string | null | 父评论 id; 顶层为 null |
| replyCursor | string | null | 回复首页游标: 回复模式传 options.cursor (与 commentId 一起); 无回复为 null, 有时效 |
请求示例
返回示例
下例截取实际响应中的首条列表记录,长文本与链接作了缩写;pointCost 为该次完整响应的实际费用。完整字段结构可在在线调试页查看。
积点消耗说明
每条一级评论及返回的嵌套回复消耗0.8积点;独立回复模式也计入返回的嵌套回复。
空结果、失败响应不扣费。同一响应中相同 ID 只计一次,独立调用和续页分别计费。详见 社媒评论 API 计费说明。

