如何获取公众号历史文章列表
用 2 个接口:微信公众号文章详情 → 微信公众号文章列表。下面的示例一共 4 次调用,合计 $0.0800;失败的调用不收费。
拿到一个公众号发过的文章,从新到旧:标题、摘要、链接、发布时间,一页一页往前翻。起点只要这个号的任意一篇文章链接。
第 1 步:微信公众号文章详情
先用这个号的任意一篇文章链接取文章详情。返回里除了标题和正文,还有公众号的信息:author.id 就是它的原始编号(gh_ 开头),下一步要用。已经有 gh_ 编号的,这一步可以跳过。
curl -G "https://onefeedapi.com/v1/wechat_mp/articles/get" \ --data-urlencode "url=https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc" \ -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi from onefeedapi import OneFeedAPI dx = OneFeedAPI() # reads ONEFEED_API_KEY result = dx.wechat_mp.articles.get(url="https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc") print(result["data"]["item"])
// npm i @onefeedapi/sdk import { OneFeedAPI } from "@onefeedapi/sdk"; const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY const result = await dx.wechat_mp.articles.get({ url: "https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc" }); console.log(result.data.item);
onefeedapi call wechat_mp.articles.get 'url=https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc'{
"code": "ok",
"request_id": "ea6d90ba-c743-4de0-b6ee-bf22a76e2d0f",
"data": {
"item": {
"id": "2667741100_1",
"url": "https://mp.weixin.qq.com/s/FeLlyCmjO-KbG27_xPHWlw",
"type": "article",
"title": "周末露营入门指南:一篇讲清楚",
"text": "周末露营这件事,越简单越好",
"published_at": "2026-10-10T09:13:21.000Z",
"author": {
"id": "gh_fd3bca9a4315",
"username": "aya_living",
"name": "认真生活的阿雅",
"avatar_url": "https://wx.qlogo.cn/mmhead/TP60gpehOQj0c0q4rzcuTqqksajtafmfdf2AzWc3/132"
}
}
},
"warnings": [],
"meta": {
"capability": "wechat_mp.articles.get",
"result_status": "complete",
"fetched_at": "2026-10-29T09:45:30.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"lang": "capability",
"author.verified": "capability",
"author.followers": "capability",
"metrics": "capability",
"images": "capability",
"hashtags": "platform",
"mentions": "platform",
"is_pinned": "capability",
"post_id": "platform",
"parent_id": "platform",
"root_id": "platform"
},
"billing": {
"amount": "0.02",
"currency": "USD",
"balance_after": "9.98"
}
}
}取自 2026-10-29 09:45 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。
微信公众号文章详情 · $0.0200 / 一次 · 参数、字段和报错见接口页 →
第 2 步:微信公众号文章列表
用这个 gh_ 编号取文章列表,从新到旧。要往前翻,把这一页返回的 page.next_cursor 作为下一次调用的 cursor,直到 page.has_more 为 false。
curl -G "https://onefeedapi.com/v1/wechat_mp/accounts/articles/list" \ --data-urlencode "id=gh_13c97ab93ce8" \ -H "Authorization: Bearer $ONEFEED_API_KEY"
# pip install onefeedapi from onefeedapi import OneFeedAPI dx = OneFeedAPI() # reads ONEFEED_API_KEY result = dx.wechat_mp.accounts.articles.list(id="gh_13c97ab93ce8") print(result["data"]["items"])
// npm i @onefeedapi/sdk import { OneFeedAPI } from "@onefeedapi/sdk"; const dx = new OneFeedAPI(); // reads ONEFEED_API_KEY const result = await dx.wechat_mp.accounts.articles.list({ id: "gh_13c97ab93ce8" }); console.log(result.data.items);
onefeedapi call wechat_mp.accounts.articles.list id=gh_13c97ab93ce8
{
"code": "ok",
"request_id": "882b7d3d-9a50-48d1-ba28-513bec440e40",
"data": {
"items": [
{
"id": "2651350693_1",
"url": "https://mp.weixin.qq.com/s/yEmemDFnwYkjLklz1HGeGz",
"type": "article",
"title": "实测一个月周末露营,结论有点意外",
"text": null,
"published_at": "2026-10-12T13:35:48.000Z",
"author": { "id": "gh_baa95f56a86c" }
},
// … 另有 9 条
]
},
"page": {
"next_cursor": "c1.c3D9oI16A0J5E0SMD5JU_mAesJzXbexIUP2nOHbv",
"cursor_expires_at": "2026-10-12T20:02:58.000Z",
"has_more": true,
"returned": 10
},
"warnings": [],
"meta": {
"capability": "wechat_mp.accounts.articles.list",
"result_status": "complete",
"fetched_at": "2026-10-12T19:02:58.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"lang": "capability",
"author.username": "capability",
"author.name": "capability",
"author.avatar_url": "capability",
"author.verified": "capability",
"author.followers": "capability",
"metrics": "capability",
"images": "capability",
"hashtags": "platform",
"mentions": "platform",
"is_pinned": "capability",
"post_id": "platform",
"parent_id": "platform",
"root_id": "platform"
},
"billing": {
"amount": "0.02",
"currency": "USD",
"balance_after": "9.98"
}
}
}取自 2026-10-12 19:02 UTC 录下的真实返回。名字、正文和编号是示例,链接也是,都不是录到的原文(页面不展示任何人的个人信息);数字是原样。长列表做了截断。请求号、游标和余额是示意。
微信公众号文章列表 · $0.0200 / 一次 · 参数、字段和报错见接口页 →
示例花多少钱
取一篇文章详情找到公众号,再翻三页文章列表
价格是生成本页时的现行价格。失败的调用不收费。
在 AI 里做(MCP)
把 OneFeedAPI 接进你的 AI 客户端,只要接一次。之后直接说要什么,代理自己找到这些接口、看好价格,用你的余额调用。
{
"capability": "wechat_mp.articles.get",
"url": "https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc",
"idempotency_key": "<a new UUID>"
}用 Skill 做
要知道的
- 只要一篇文章的正文?把文章链接交给文章详情接口(上面第 1 步),一次调用就拿到标题、正文全文和公众号信息,不用先取列表。
- 每页约 10 篇,最多 20 篇。游标一小时内有效,过期了从第一页重新翻。
- 也有更多的时候:一页是若干次推送里的全部文章,实测有过一页 63 篇。
- 列表里的
text是摘要,不是全文,也没有阅读、点赞这些数。全文用文章详情接口取,互动数用文章互动数据接口取,都按文章的url调。 - 文章的
id由长链接里的__biz、mid、idx拼成;取单篇文章的接口要传url,不能传这个id。 - 没有这个
gh_编号的公众号会返回not_found,不计费。
完整脚本
上面这件事写成一个能直接跑的脚本:Python,用 SDK,Key 从 ONEFEED_API_KEY 读。它写出一个 CSV 文件,最后打印调了几次、取到几条、扣了多少。
# pip install onefeedapi # export ONEFEED_API_KEY=dx_... (your key) import csv from decimal import Decimal from onefeedapi import OneFeedAPI dx = OneFeedAPI() calls, fetched, charged = 0, 0, Decimal("0") def run(capability, params): """One call; counts it and what it was charged.""" global calls, charged result = dx.call(capability, params) calls += 1 charged += Decimal(str(result["meta"]["billing"]["amount"])) return result ARTICLE_URL = "https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc" PAGES = 3 # 1. One article of the account: its author.id is the account's original ID (gh_...). article = run("wechat_mp.articles.get", {"url": ARTICLE_URL})["data"]["item"] account = article["author"]["id"] # 2. The account's articles, newest first, page after page. rows, cursor = [], None for _ in range(PAGES): page = run("wechat_mp.accounts.articles.list", {"id": account, **({"cursor": cursor} if cursor else {})}) for item in page["data"]["items"]: rows.append([item.get("published_at"), item.get("title"), item.get("url")]) cursor = page["page"]["next_cursor"] if not page["page"]["has_more"]: break fetched = len(rows) with open("articles.csv", "w", newline="", encoding="utf-8") as file: csv.writer(file).writerows([["published_at", "title", "url"], *rows]) print(f"calls: {calls}, items: {fetched}, charged: ${charged}")
2026-10-29 真实跑过一次:调用 4 次,写出 30 行,扣费 $0.0800。失败的调用不收费。