WeChat-Media-Platform-V2-API

获取公众号文章列表/Get WeChat MP Account Articles

Changed on

[中文]

用途:

  • 传 gh_username,返回公众号历史发文(文章 tab)的单页列表。
  • 手动翻页:首页 offset 留空 → 从响应取 next_offset(base64 游标)→ 下次请求放进 offset 取下一页;is_end 为真即末页。
  • 价格:0.01$/次
  • ⏱️ 由于微信服务器原因,本接口响应较慢,请将客户端请求超时(timeout)设置为 30 秒;timeout 设置过小会造成已扣费但收不到响应的情况。

参数:

  • username: 公众号 gh_username(gh_…)。示例 gh_363b924965e9
  • page_size: 可选,默认 20。⚠️ 微信当前忽略该参数 —— 返回条数由公众号自身决定,实测取 1 与取 40 结果完全相同。翻页请用 offset / 响应里的 next_offset。
  • offset: 可选,翻页游标(base64),首页留空;翻页时传上一页响应的 next_offset。示例 CAMQChiS5KfRBiAKOJLkp9EGQABIAVgAYABwAQ==
  • item_show_type: 可选,内容栏目(对应公众号主页的「文章 / 视频 / 音频」分栏)。留空 / 0=文章(默认)、5=视频、7=音频、8=贴图。默认不传=文章,行为不变。
  • raw: 可选,默认 True。True=原始;False=精简解析。

返回:

  • 公众号文章列表(单页)及翻页游标

提示:offset 是 base64 游标(含 +/=),统一走 POST body。本接口只取单页、不自动翻页。

响应结构与 JSON Path:

raw=false(精简解析,snake_case):

  • 公众号 username: $.data.biz_username
  • 是否末页(0/1): $.data.is_end
  • 本页返回文章数: $.data.count
  • 下一页游标(翻页回传 offset;末页为 null): $.data.next_offset
  • 文章列表: $.data.articles[]
  • 单篇(N 为下标):
    • 文章 appmsgid: $.data.articles[N].app_msg_id
    • 标题: $.data.articles[N].title
    • 摘要: $.data.articles[N].digest
    • 链接: $.data.articles[N].url
    • 封面: $.data.articles[N].cover(多比例 $.data.articles[N].covers)
    • 发布 / 更新时间戳: $.data.articles[N].create_time / .update_time
    • 群发内位置 / 类型: $.data.articles[N].idx / .msg_type / .item_show_type
    • 图文数 / 付费标志: $.data.articles[N].pic_count / .is_paid / .is_pay_subscribe

raw=true(原始,本接口默认):

  • data 顶层字段与精简版一致(biz_username / is_end / count / next_offset),但 articles[] 为完整原始群发条目(camelCase 嵌套):
    • 单条: $.data.articles[N].appMsg(含 baseInfo / detailInfo)、$.data.articles[N].baseInfo(msgId / msgType / dateTime / status)
    • 图文正文在 $.data.articles[N].appMsg.detailInfo(一次群发可含多篇:头条 / 次条)
    • 翻页同样用顶层 next_offset 回传 offset。做列表展示建议直接用 raw=false,路径更干净。

[English]

Purpose:

  • Pass a gh_username to get a single page of the account's historical posts (article tab).
  • Manual paging: leave offset empty for the first page → take next_offset (base64 cursor) from the response → pass it as offset in the next request; is_end truthy means the last page.
  • 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.

Parameters:

  • username: Official account gh_username (gh_…). E.g. gh_363b924965e9
  • page_size: Optional, default 20. NOTE: WeChat currently ignores this parameter — the count is decided by the account itself (1 and 40 return identically). Paginate with offset / next_offset.
  • offset: Optional pagination cursor (base64), leave empty for the first page; for the next page pass next_offset from the previous response. E.g. CAMQChiS5KfRBiAKOJLkp9EGQABIAVgAYABwAQ==
  • item_show_type: Optional content tab (matches the "Articles / Videos / Audios" tabs on the account homepage). Empty / 0=articles (default), 5=videos, 7=audios, 8=image-text posts. Omitting it = articles, behavior unchanged.
  • raw: Optional, default True. True=raw; False=simplified parsing.

Return:

  • Single page of articles with pagination cursor

Tip: offset is a base64 cursor (contains +/=), hence POST body. This endpoint fetches a single page only and does not auto-paginate.

Response structure & JSON Path:

raw=false (simplified, snake_case):

  • Account username: $.data.biz_username
  • Is last page (0/1): $.data.is_end
  • Articles returned on this page: $.data.count
  • Next-page cursor (pass back as offset; null at the last page): $.data.next_offset
  • Article list: $.data.articles[]
  • Single article (N is the index):
    • Article appmsgid: $.data.articles[N].app_msg_id
    • Title: $.data.articles[N].title
    • Digest: $.data.articles[N].digest
    • URL: $.data.articles[N].url
    • Cover: $.data.articles[N].cover (multi-ratio $.data.articles[N].covers)
    • Publish / update timestamps: $.data.articles[N].create_time / .update_time
    • Position / type within the batch: $.data.articles[N].idx / .msg_type / .item_show_type
    • Image count / paid flags: $.data.articles[N].pic_count / .is_paid / .is_pay_subscribe

raw=true (raw, default for this endpoint):

  • data top-level fields match the simplified version (biz_username / is_end / count / next_offset), but articles[] are full raw batch entries (nested camelCase):
    • Per entry: $.data.articles[N].appMsg (with baseInfo / detailInfo), $.data.articles[N].baseInfo (msgId / msgType / dateTime / status)
    • Article bodies are in $.data.articles[N].appMsg.detailInfo (one batch may contain multiple articles: headline / secondary)
    • Pagination also uses top-level next_offset passed back as offset. For list display, prefer raw=false for cleaner paths.
post/api/v1/wechat_mp/v2/fetch_account_articles

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

usernamestring required

公众号 username。三种形态都支持:gh_…、gh_…@app(关联小程序的账号)、以及自定义微信号(如 nikejdi)。取自文章详情接口响应的 $.data.content.user_name/Official account username. Three forms are supported: gh_…, gh_…@app (mini-program-linked accounts) and custom WeChat IDs (e.g. nikejdi). Taken from $.data.content.user_name of the article detail endpoints

page_sizeinteger

每页数量(默认 20)。⚠️ 微信当前忽略该参数:返回条数由公众号自身决定,实测取 1 与取 40 结果完全相同;翻页请用 offset / next_offset/Articles per page (default 20). NOTE: WeChat currently ignores this parameter — the count is decided by the account itself; paginate with offset / next_offset

offsetstring nullable

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

item_show_typeinteger nullable

内容栏目:留空/0=文章(默认)、5=视频、7=音频、8=贴图/Content tab: empty/0=articles (default), 5=videos, 7=audios, 8=image-text posts

rawboolean

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

Example request

{
  "username": "gh_363b924965e9"
}

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

    • warning

      changed the pattern of the request property from ^gh_[A-Za-z0-9_]+$ to ^[0-9A-Za-z][-_0-9A-Za-z]{1,63}(@[0-9A-Za-z]{1,16})?$

    • info

      the request property's max was increased from 20.00 to 100.00

    • info

      the request property's maxLength was increased from 64 to 80

    • info

      the request property's min was decreased from 10.00 to 1.00