WeChat-Media-Platform-V2-API

获取公众号文章详情/Get WeChat MP Article Detail

Changed on

[中文]

用途:

  • 传文章 URL,返回文章正文 / 标题 / 作者 / 封面 / 发布时间 / 合集信息等。
  • 无论 raw 取值,嵌套的 content JSON 串都会被解析成对象(结构归一化),raw 只控制外层字段的投影范围。
  • 价格:0.01$/次
  • ⏱️ 由于微信服务器原因,本接口响应较慢,请将客户端请求超时(timeout)设置为 30 秒;timeout 设置过小会造成已扣费但收不到响应的情况。
  • ⚠️ 大整数 ID 精度:响应中的 comment_id / msgId 等为 64 位大整数,超出 JavaScript 安全整数范围(2^53-1)。请始终以字符串方式接收 / 传递这类 ID(解析 JSON 用 json-bigint 或按文本取值),勿让其经过 JS Number。Swagger UI 文档页对超大整数会末位舍入显示,属正常现象,不影响接口实际返回的数据。

参数:

  • url: 公众号文章链接(https://mp.weixin.qq.com/s/… 或带 __biz 的长链)。示例 https://mp.weixin.qq.com/s/TSNQKkRpN1qbKsT7BvzqIw
  • raw: 可选,默认 True。True=原始响应;False=精简投影。

返回:

  • 文章详情(正文 / 标题 / 作者 / 封面 / 发布时间 / 合集信息)

响应结构与 JSON Path:

raw=false(精简投影):

  • data 顶层仅 4 个字段,文章正文聚合在 content:
    • $.data.url: 文章 URL
    • $.data.bizUin: 公众号 bizUin(int)
    • $.data.itemIdx: 图文位置序号
    • $.data.content: 已解析的正文对象,常用路径:
      • $.data.content.title: 标题
      • $.data.content.nick_name / $.data.content.user_name: 公众号名 / gh_username
      • $.data.content.author: 作者
      • $.data.content.desc: 摘要
      • $.data.content.create_time: 发布时间("2025-03-05 12:22" 文本)
      • $.data.content.ori_create_time: 发布时间戳(int 秒)
      • $.data.content.cdn_url: 封面图
      • $.data.content.comment_id: 评论 id(喂评论接口的内部 id)
      • $.data.content.appmsgalbuminfo: 所属合集(album_id / title / 上下篇链接)
      • $.data.content.content_text: 正文 HTML 转出的纯文字

raw=true(原始):

  • data 为完整 item(含 raw=false 的全部字段,外加模板 / 缓存 / 时间等元信息):
    • $.data.url / $.data.bizUin / $.data.itemIdx: 同精简模式
    • $.data.msgId: 图文消息 id
    • $.data.lastModifyTime: 最后修改时间戳
    • $.data.tmplVersion / $.data.tmplVersions[]: H5 模板版本
    • $.data.clientCacheTime: 客户端缓存秒数
    • $.data.content.*: 与 raw=false 的 content 同结构(同样含 content_text)

[English]

Purpose:

  • Pass an article URL to get the article body / title / author / cover / publish time / album info.
  • Regardless of raw, the nested content JSON string is always parsed into an object (structure normalized); raw only controls the projection scope of outer fields.
  • 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 comment_id / msgId 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/… or long URL with __biz). E.g. https://mp.weixin.qq.com/s/TSNQKkRpN1qbKsT7BvzqIw
  • raw: Optional, default True. True=raw response; False=simplified projection.

Return:

  • Article detail (body / title / author / cover / publish time / album info)

Response structure & JSON Path:

raw=false (simplified projection):

  • data has only 4 top-level fields; the article body is aggregated in content:
    • $.data.url: article URL
    • $.data.bizUin: official account bizUin (int)
    • $.data.itemIdx: article position index
    • $.data.content: parsed body object, common paths:
      • $.data.content.title: title
      • $.data.content.nick_name / $.data.content.user_name: account name / gh_username
      • $.data.content.author: author
      • $.data.content.desc: digest
      • $.data.content.create_time: publish time (text like "2025-03-05 12:22")
      • $.data.content.ori_create_time: publish timestamp (int seconds)
      • $.data.content.cdn_url: cover image
      • $.data.content.comment_id: comment id (internal id fed into comment endpoints)
      • $.data.content.appmsgalbuminfo: album info (album_id / title / prev & next links)
      • $.data.content.content_text: plain text extracted from the body HTML

raw=true (raw):

  • data is the full item (all fields of raw=false, plus template / cache / time metadata):
    • $.data.url / $.data.bizUin / $.data.itemIdx: same as simplified mode
    • $.data.msgId: message id
    • $.data.lastModifyTime: last modified timestamp
    • $.data.tmplVersion / $.data.tmplVersions[]: H5 template versions
    • $.data.clientCacheTime: client cache seconds
    • $.data.content.*: same structure as content of raw=false (also includes content_text)
post/api/v1/wechat_mp/v2/fetch_article_detail

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

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