API 文档wechat_mpComments获取公众号评论的二级回复
获取公众号评论的二级回复
接口用途
- 返回某条一级评论下的二级回复。
- 链路:先调 fetch_article_comments 取到每条评论的 content_id,再把它喂给本接口。
- 价格:0.01$/次
- ⏱️ 由于微信服务器原因,本接口响应较慢,请将客户端请求超时(timeout)设置为 30 秒;timeout 设置过小会造成已扣费但收不到响应的情况。
- ⚠️ 大整数 ID 精度:响应中的 content_id / reply_id 等为 64 位大整数,超出 JavaScript 安全整数范围(2^53-1)。请始终以**字符串**方式接收 / 传递这类 ID(解析 JSON 用 json-bigint 或按文本取值),勿让其经过 JS Number。Swagger UI 文档页对超大整数会末位舍入显示,属正常现象,不影响接口实际返回的数据。
- 💡 **提速**:传 comment_id 可让数据服务跳过整篇文章的抓取解析,实测本接口从 15.10s 降到 6.91s / 评论接口从 8.28s 降到 6.13s。该值取自 /fetch_article_detail 或 /fetch_article_detail_h5 响应的 $.data.content.comment_id,拿它是零成本的
POST
/openapi/api/v1/wechat_mp/v2/fetch_comment_replies价格:价格暂不可用 · 实际扣费按免费额度及账户折扣结算
鉴权
所有 API 请求都需要 Bearer 项目 Token,请在 Authorization 请求头中传入
Authorization header
Authorization: Bearer YOUR_API_TOKEN请求参数
- url: 公众号文章链接(https://mp.weixin.qq.com/s/…)。示例 http://mp.weixin.qq.com/s?__biz=Mzk3NTA0MzM5NA==&mid=2247483745&idx=1&sn=3f34e768cf457a501038991ed30be1f4#rd
- content_id: 可选(纯数字)。目标一级评论的 content_id,取自 fetch_article_comments 响应的 $.data.comments[N].content_id;**不传则自动取第一条有回复的评论**。示例 12109128638545265979
- offset: 可选,默认 0(>=0)。回复翻页偏移;首页 0,has_more=true 时传上次返回的 next_offset 取下一页。
- ⚠️ 数据服务已移除 all_pages 自动翻页:它一次计费最多打 30 个数据服务请求,且自动翻页模式**不返回** has_more / next_offset,调用方无从发现结果被截断(实测 400 条回复只给回前 300)。翻页统一用 offset / next_offset 驱动,与 /fetch_article_comments 的游标契约一致。
- raw: 可选,默认 True。True=完整原始回复对象;False=精简回复。
| 参数名 | 位置 / 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| url | body / string | 是 |
| http://mp.weixin.qq.com/s?__biz=Mzk3NTA0MzM5NA==&mid=2247483745&idx=1&sn=3f34e768cf457a501038991ed30be1f4#rd |
| content_id | body / string | null | 否 |
| 12109128638545265979 |
| offset | body / integer | 否 |
| |
| comment_id | body / string | null | 否 |
| |
| raw | body / boolean | 否 |
|
调用示例
curl -X POST "https://api.trmesh.com/openapi/api/v1/wechat_mp/v2/fetch_comment_replies" \ -H "Authorization: Bearer sdc_your_project_token"
返回字段
- 二级回复列表及翻页信息
- > 注意:本接口 raw=true 与 raw=false 的**外层结构一致**,差异仅在 replies[] 每个元素的字段粒度(精简视图 vs 完整原始对象)。
公共响应外层
响应状态、请求标识和数据等公共字段
| 字段名 | 类型 | 说明 | 示例 |
|---|---|---|---|
| code | integer |
| |
| request_id | string | null |
| |
| message | string |
| |
| message_zh | string |
| |
| support | string |
| |
| time | string |
| |
| time_stamp | integer |
| |
| time_zone | string |
| |
| docs | string | null |
| |
| cache_message | string | null |
| |
| cache_message_zh | string | null |
| |
| cache_url | string | null |
| |
| router | string |
| |
| params | unknown |
| |
| data | unknown | null |
|
错误码与限流说明
除了成功返回,这里也说明鉴权失败、限流和数据服务异常时的标准行为
| 状态码 | 含义 | 说明 |
|---|---|---|
| 200 | 成功 | 请求处理完成,返回标准结果包裹。 |
| 401 | 未授权 | 缺少令牌、令牌无效或登录状态已失效。 |
| 429 | 触发限流 | 请求速率超过令牌、用户或套餐的限制。 |
| 502 | 服务暂不可用 | 网关未获取到可用结果,建议稍后重试。 |