WeChat-Media-Platform-V2-API

获取公众号文章评论/Get WeChat MP Article Comments

Changed on

[中文]

用途:

  • 获取公众号文章评论(单页,buffer 游标翻页),返回文章的一页精选评论。
  • 翻页:首页 buffer 留空 → 取响应的 buffer → 下次请求传回 buffer 取下一页;has_more 为 false 即到末页。
  • 逐条评论的二级回复请用 fetch_comment_replies(传评论的 content_id)。
  • 价格:0.01$/次
  • ⏱️ 由于微信服务器原因,本接口响应较慢,请将客户端请求超时(timeout)设置为 30 秒;timeout 设置过小会造成已扣费但收不到响应的情况。
  • ⚠️ 大整数 ID 精度:响应中的 content_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,拿它是零成本的。

参数:

  • url: 公众号文章链接(https://mp.weixin.qq.com/s/…)。示例 https://mp.weixin.qq.com/s/TSNQKkRpN1qbKsT7BvzqIw
  • buffer: 可选,默认空。翻页游标,首页留空;翻页传上一页响应的 buffer。
  • raw: 可选,默认 True。True=完整原始评论对象;False=精简评论视图。

返回:

  • 单页评论列表及翻页游标

响应结构与 JSON Path:

raw=false(精简视图):

  • data 外层为本页汇总,comments[] 为精简评论:
    • $.data.appmsgid: 图文消息 id
    • $.data.elected_total: 精选评论总数
    • $.data.total_count: 评论总数
    • $.data.buffer: 下一页游标(翻页回传 buffer;末页为空串)
    • $.data.has_more: 是否还有下一页
    • $.data.comment_id: 文章评论标识(内部用)
    • $.data.comments[N].content_id: 评论 id(喂 fetch_comment_replies 的 content_id)
    • $.data.comments[N].nick_name: 评论者昵称
    • $.data.comments[N].content: 评论内容
    • $.data.comments[N].like_num: 点赞数
    • $.data.comments[N].create_time: 评论时间戳
    • $.data.comments[N].ip_wording: IP 归属地(province_name / city_name 等)
    • $.data.comments[N].is_elected / is_top: 是否精选 / 置顶
    • $.data.comments[N].reply_total: 二级回复总数
    • $.data.comments[N].replies[]: 二级回复预览(精简,见 fetch_comment_replies)

raw=true(原始):

  • data 外层同上(appmsgid / elected_total / total_count / buffer / has_more / comment_id),comments[] 为完整原始评论对象,字段更全(snake_case):
    • $.data.comments[N].content_id: 评论 id(同精简模式,仍是喂 fetch_comment_replies 的值)
    • $.data.comments[N].content / nick_name / like_num / create_time / ip_wording / is_elected / is_top: 与 raw=false 同名同义
    • 原始模式额外字段: $.data.comments[N].id(楼层序号)/ openid / identity_type / logo_url(头像)/ like_status / is_from_me / $.data.comments[N].reply_new(含 reply_total_cnt / reply_list,对应精简模式的 reply_total / replies)

[English]

Purpose:

  • Get WeChat MP article comments (single page, buffer cursor pagination); returns one page of featured comments.
  • Pagination: leave buffer empty for the first page → take buffer from the response → pass it back in the next request; has_more false means the last page.
  • For second-level replies of a specific comment, use fetch_comment_replies (pass the comment's content_id).
  • Price: $0.01 per request
  • ⏱️ Due to WeChat server latency, this endpoint responds slowly; please set your client request timeout to 30 seconds — a timeout that is too small may result in being billed without receiving the response.
  • ⚠️ Large-integer ID precision: IDs such as content_id in the response are 64-bit big integers beyond JavaScript's safe-integer range (2^53-1). Always receive / pass such IDs as strings (parse JSON with json-bigint or read them as text), never through JS Number. Swagger UI rounds the trailing digits of huge integers in its docs view — this is expected and does not affect the actual data returned by the API.

Parameters:

  • url: WeChat MP article URL (https://mp.weixin.qq.com/s/…). E.g. https://mp.weixin.qq.com/s/TSNQKkRpN1qbKsT7BvzqIw
  • buffer: Optional, default empty. Pagination cursor; leave empty for the first page, pass buffer from the previous response for the next page.
  • raw: Optional, default True. True=full raw comment objects; False=simplified comment view.

Return:

  • One page of comments with pagination cursor

Response structure & JSON Path:

raw=false (simplified view):

  • data outer level is the page summary; comments[] are simplified comments:
    • $.data.appmsgid: message id
    • $.data.elected_total: total featured comments
    • $.data.total_count: total comments
    • $.data.buffer: next-page cursor (pass back as buffer; empty string at the last page)
    • $.data.has_more: whether there is a next page
    • $.data.comment_id: article comment identifier (internal)
    • $.data.comments[N].content_id: comment id (feed into content_id of fetch_comment_replies)
    • $.data.comments[N].nick_name: commenter nickname
    • $.data.comments[N].content: comment content
    • $.data.comments[N].like_num: like count
    • $.data.comments[N].create_time: comment timestamp
    • $.data.comments[N].ip_wording: IP region (province_name / city_name etc.)
    • $.data.comments[N].is_elected / is_top: featured / pinned flags
    • $.data.comments[N].reply_total: total second-level replies
    • $.data.comments[N].replies[]: reply preview (simplified, see fetch_comment_replies)

raw=true (raw):

  • data outer level same as above (appmsgid / elected_total / total_count / buffer / has_more / comment_id); comments[] are full raw comment objects with more fields (snake_case):
    • $.data.comments[N].content_id: comment id (same as simplified mode, still the value fed into fetch_comment_replies)
    • $.data.comments[N].content / nick_name / like_num / create_time / ip_wording / is_elected / is_top: same names and meanings as raw=false
    • Raw-only extra fields: $.data.comments[N].id (floor number) / openid / identity_type / logo_url (avatar) / like_status / is_from_me / $.data.comments[N].reply_new (with reply_total_cnt / reply_list, corresponding to reply_total / replies of the simplified mode)
post/api/v1/wechat_mp/v2/fetch_article_comments

Request

  • Base URL
    https://api.tikhub.io (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Request body

urlstring required
bufferstring nullable

翻页游标,首页留空;翻页传上一页响应的 buffer/Pagination cursor, leave empty for first page; pass buffer from the previous response

comment_idstring nullable

文章的评论 id(可选,性能捷径):不传时上游要先抓并解析整篇文章 HTML 才能拿到它,约占本接口耗时的一半;已有该值时传进来可显著加快。取自 /fetch_article_detail 或 /fetch_article_detail_h5 响应的 $.data.content.comment_id/Article comment id (optional, performance shortcut): when omitted, upstream must fetch and parse the whole article HTML to obtain it, which accounts for about half of this endpoint's latency

rawboolean

True=原始响应;False=精简解析结构/True=raw response; False=simplified parsed structure

Example request

{
  "url": "https://mp.weixin.qq.com/s/TSNQKkRpN1qbKsT7BvzqIw"
}

Response

Successful Response

codeinteger

HTTP status code | HTTP状态码

request_idstring nullable

Unique request identifier | 唯一请求标识符

messagestring

Response message (EN-US) | 响应消息 (English)

message_zhstring

Response message (ZH-CN) | 响应消息 (中文)

supportstring

Support message | 支持消息

timestring

The time the response was generated | 生成响应的时间

time_stampinteger

The timestamp the response was generated | 生成响应的时间戳

time_zonestring

The timezone of the response time | 响应时间的时区

docsstring nullable

Link to the API Swagger documentation for this endpoint | 此端点的 API Swagger 文档链接

cache_messagestring nullable

Cache message (EN-US) | 缓存消息 (English)

cache_message_zhstring nullable

Cache message (ZH-CN) | 缓存消息 (中文)

cache_urlstring nullable

The URL to access the cached result | 访问缓存结果的 URL

routerstring

The endpoint that generated this response | 生成此响应的端点

paramsunknown
dataunknown

Changes

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the new optional request property