# 如何获取公众号历史文章列表

用 2 个接口：微信公众号文章详情 → 微信公众号文章列表。下面的示例一共 4 次调用，合计 $0.0800；失败的调用不收费。

拿到一个公众号发过的文章，从新到旧：标题、摘要、链接、发布时间，一页一页往前翻。起点只要这个号的任意一篇文章链接。

## 一步一步做

### 第 1 步：微信公众号文章详情

先用这个号的任意一篇文章链接取文章详情。返回里除了标题和正文，还有公众号的信息：`author.id` 就是它的原始编号（`gh_` 开头），下一步要用。已经有 `gh_` 编号的，这一步可以跳过。（[微信公众号文章详情](https://dataxapi.com/zh/apis/wechat_mp/articles/get/)，$0.0200 / 一次）

cURL

```bash
curl -G "https://api.dataxapi.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 $DATAXAPI_API_KEY"
```

Python

```python
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_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"])
```

TypeScript

```typescript
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_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);
```

命令行

```bash
dataxapi call wechat_mp.articles.get 'url=https://mp.weixin.qq.com/s?__biz=MjM5MjAxNDM4MA==&mid=2667038683&idx=1&sn=0422127e651acd7f6cf6ef7e1cff04bc'
```

录制的返回：取自 2026-10-12 19:03 UTC 录下的真实返回。名字、正文和编号是示例，链接也是，都不是录到的原文（页面不展示任何人的个人信息）；数字是原样。长列表做了截断。请求号、游标和余额是示意。

```jsonc
{
  "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-12T19:03:48.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"
    }
  }
}
```

### 第 2 步：微信公众号文章列表

用这个 `gh_` 编号取文章列表，从新到旧。要往前翻，把这一页返回的 `page.next_cursor` 作为下一次调用的 `cursor`，直到 `page.has_more` 为 false。（[微信公众号文章列表](https://dataxapi.com/zh/apis/wechat_mp/accounts/articles/list/)，$0.0200 / 一次）

cURL

```bash
curl -G "https://api.dataxapi.com/v1/wechat_mp/accounts/articles/list" \
  --data-urlencode "id=gh_13c97ab93ce8" \
  -H "Authorization: Bearer $DATAXAPI_API_KEY"
```

Python

```python
from dataxapi import DataXAPI

dx = DataXAPI()  # reads DATAXAPI_API_KEY
result = dx.wechat_mp.accounts.articles.list(id="gh_13c97ab93ce8")
print(result["data"]["items"])
```

TypeScript

```typescript
import { DataXAPI } from "@dataxapi/sdk";

const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.wechat_mp.accounts.articles.list({ id: "gh_13c97ab93ce8" });
console.log(result.data.items);
```

命令行

```bash
dataxapi call wechat_mp.accounts.articles.list id=gh_13c97ab93ce8
```

录制的返回：取自 2026-10-12 19:02 UTC 录下的真实返回。名字、正文和编号是示例，链接也是，都不是录到的原文（页面不展示任何人的个人信息）；数字是原样。长列表做了截断。请求号、游标和余额是示意。

```jsonc
{
  "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"
    }
  }
}
```

## 示例花多少钱

取一篇文章详情找到公众号，再翻三页文章列表

| 接口 | 调用次数 | 单价 | 小计 |
| --- | --- | --- | --- |
| [微信公众号文章详情](https://dataxapi.com/zh/apis/wechat_mp/articles/get/) | 1 | $0.0200 | $0.0200 |
| [微信公众号文章列表](https://dataxapi.com/zh/apis/wechat_mp/accounts/articles/list/) | 3 | $0.0200 | $0.0600 |
| 合计 | 4 |  | $0.0800 |

价格是生成本页时的现行价格。失败的调用、不存在的对象都不收费。

## 在 AI 里做（MCP）

把 DataXAPI 接进你的 AI 客户端，只要接一次。之后直接说要什么，代理自己找到这些接口、看好价格，用你的余额调用。

这样说：这是一篇公众号文章的链接。用 DataXAPI 找到发这篇文章的公众号，列出它最近 30 篇文章的标题、发布时间和链接。

代理发给 call 工具的参数：

```json
{
  "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>"
}
```

[了解 MCP 服务](https://dataxapi.com/zh/mcp/)

## 用 Skill 做

“竞品账号监测”这个 Skill 把这件事做成了现成的任务，带花费上限。 “对手这周发了什么、哪条起来了？” 它的示例运行：2 次调用，最多 $0.0040。 [竞品账号监测](https://dataxapi.com/zh/skills/competitors/)

## 要知道的

- 每页约 10 篇，最多 20 篇。游标一小时内有效，过期了从第一页重新翻。
- 列表里的 `text` 是摘要，不是全文，也没有阅读、点赞这些数。全文用文章详情接口取，互动数用文章互动数据接口取，都按文章的 `url` 调。
- 文章的 `id` 由长链接里的 `__biz`、`mid`、`idx` 拼成；取单篇文章的接口要传 `url`，不能传这个 `id`。
- 返回空列表的一页照常计费；没有这个 `gh_` 编号的公众号会返回 `not_found`，不计费。

## 用到的接口

- [微信公众号文章详情](https://dataxapi.com/zh/apis/wechat_mp/articles/get/)
- [微信公众号文章列表](https://dataxapi.com/zh/apis/wechat_mp/accounts/articles/list/)

## 微信公众号的更多内容

- [微信公众号 API](https://dataxapi.com/zh/apis/wechat_mp/)
- [如何获取公众号文章阅读数和点赞数](https://dataxapi.com/zh/guides/wechat-article-reads-and-likes/)
- [如何获取视频号视频评论](https://dataxapi.com/zh/guides/wechat-channels-video-comments/)
- [公众号文章能用 API 读取吗？](https://dataxapi.com/zh/answers/is-there-an-api-for-wechat-official-account-articles/)
- [视频号数据怎么获取？](https://dataxapi.com/zh/answers/how-to-get-wechat-channels-data/)

---

目录修订号 c48ce454ae6c4c65。 [网页版](https://dataxapi.com/zh/guides/wechat-official-account-articles/)
