WeChat-Media-Platform-V2-API

获取公众号文章互动数据(H5 版本)/Get WeChat MP Article Stats (H5)

Changed on

[中文]

用途:

  • 传文章 URL,返回评论数 / 精选评论数。与 /fetch_article_stats 是两个独立接口, 各自返回结果,不会自动切换:

    接口能取到建议
    /fetch_article_stats阅读量 / 点赞 / 在看 / 分享 / 收藏 / 评论数(全部指标)需要阅读量等指标时用
    /fetch_article_stats_h5(本接口)仅评论数 / 精选评论数;稳定性更好只要评论数、或上面那条报错时用
  • ⚠️ 阅读量、点赞、在看、分享、收藏这几项本接口取不到,一律返回 null 并列在 $.data.unavailable[],不会用 0 冒充 —— 调用方可据此区分「这篇文章真的是 0」 和「这条路取不到」。需要这些指标请用 /fetch_article_stats。

  • 价格:0.01$/次

  • ⏱️ 请将客户端超时(timeout)设置为 30 秒。

  • ⚠️ 大整数 ID 精度:comment_id / appmsgid 为 64 位大整数,请以字符串方式接收 / 传递。

  • 💡 提速:传 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/…)。
  • raw: 可选,默认 True。True=附带评论接口的原始计数字段;False=仅计数。 两者顶层结构一致,raw 只增减字段。

返回:

  • 评论数 / 精选评论数;其余互动指标为 null 并列在 unavailable[]

响应结构与 JSON Path:

raw=false(计数):

  • $.data.comment_count: 评论总数
  • $.data.elected_comment_count: 精选评论数
  • $.data.read_num / $.data.like_count / $.data.old_like_count / $.data.share_count / $.data.collect_count / $.data.star_num: 本接口恒为 null
  • $.data.unavailable[]: 本接口取不到的字段名清单(与上一行对应)

raw=true(附带原始计数字段):

  • data 顶层同 raw=false,另加:
    • $.data.comment_raw.total_count / $.data.comment_raw.elected_total: 评论接口给的原始计数
    • $.data.comment_raw.comment_id / $.data.comment_raw.appmsgid: 文章的评论 id / 图文 id

[English]

Purpose:

  • Fetch comment counts for a WeChat MP article via the H5 channel.
  • Read count / likes / shares / favorites are not available here: they are returned as null and listed in $.data.unavailable[] (never faked as 0). Use /fetch_article_stats when you need them.
  • Price: 0.01$/request

Parameters:

  • url: WeChat MP article URL.
  • raw: Optional, default True. True = include raw counter fields; False = counts only.

Returns:

  • comment_count / elected_comment_count; other metrics are null and listed in unavailable[]
post/api/v1/wechat_mp/v2/fetch_article_stats_h5

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

公众号文章链接(https://mp.weixin.qq.com/s/… 或带 __biz 的长链)/WeChat MP article URL (https://mp.weixin.qq.com/s/… or long URL with __biz)

rawboolean

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

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

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