# 微博评论怎么全部获取

传微博的数字 ID，用 `data.next` 每页约 20 条往下翻。10 页是 10 次调用、$0.02，不用登录微博，也不用处理 432 报错。

更新于 2026-11-22

## 翻完全部评论

`status_id` 填数字 mid。weibo.com 链接里通常是 base62 短码（比如 `Q9xyzAbcd`），换算方法见我们的问答页。下一页是 17 位的 `max_id`，按字符串返回，避免被四舍五入，原样传回即可。

[微博评论](https://xtikapi.com/zh/apis/weibo/comments/list): `GET /v1/weibo/comments/list`, $0.002 / 次

```bash
curl "https://xtikapi.com/v1/weibo/comments/list?status_id=5366312755008200" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python
import requests

URL = "https://xtikapi.com/v1/weibo/comments/list"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

params = {"status_id": "5366312755008200"}
items = []
for _ in range(10):  # one call per page
    for attempt in range(3):  # 5xx errors are not charged: retry
        response = requests.get(URL, params=params, headers=HEADERS, timeout=60)
        if response.status_code < 500:
            break
    response.raise_for_status()
    data = response.json()["data"]
    items += data["items"]
    if not data.get("next"):  # null on the last page
        break
    params.update(data["next"])

print(len(items), "items")
```

```javascript
const URL = "https://xtikapi.com/v1/weibo/comments/list";
const HEADERS = { Authorization: "Bearer YOUR_API_KEY" };

let params = {"status_id":"5366312755008200"};
const items = [];
for (let page = 0; page < 10; page++) {
  let response;
  for (let attempt = 0; attempt < 3; attempt++) {
    // 5xx errors are not charged: retry
    response = await fetch(`${URL}?${new URLSearchParams(params)}`, { headers: HEADERS });
    if (response.status < 500) break;
  }
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const { data } = await response.json();
  items.push(...data.items);
  if (!data.next) break; // null on the last page
  params = { ...params, ...data.next };
}
console.log(items.length, "items");
```

录制的真实返回（列表只保留前两条）：

```json
{
  "data": {
    "items": [
      {
        "id": "8330913613217597",
        "text": "Example text",
        "author": {
          "id": "1284083871",
          "username": "example_user",
          "name": "Example name",
          "avatar": "https://example.com/image.jpg",
          "followers": 61,
          "description": "Example text"
        },
        "createdAt": "2026-11-18T21:30:54.000Z",
        "replyCount": 3
      },
      {
        "id": "8330979591036408",
        "text": "Example text",
        "author": {
          "id": "0257671969",
          "username": "example_user",
          "name": "Example name",
          "avatar": "https://example.com/image.jpg",
          "followers": 12063,
          "description": "Example text"
        },
        "createdAt": "2026-11-19T01:12:56.000Z",
        "replyCount": 1
      }
    ],
    "has_more": true,
    "next": {
      "max_id": "13897360026835247"
    }
  },
  "meta": {
    "request_id": "example",
    "endpoint": "weibo.comments.list",
    "normalized": true,
    "unavailable": [
      "likeCount"
    ],
    "billing": {
      "charged": true,
      "amount": 0.002,
      "balance": 4.98
    }
  }
}
```

## 这个例子花多少钱

| 步骤 | 调用次数 | 单价 | 小计 |
| --- | --- | --- | --- |
| 评论，10 页、每页约 20 条 | 10 | $0.002 | $0.02 |
| 合计 | 10 | | $0.02 |

## 要注意的地方

- 2026-11-22 实测第一页 22 条、第二页 20 条。
- 实测第二页有 1 条第一页出现过，按 `id` 去重。
- 评论下面的回复用 `weibo.comment_replies.list` 取。
- 代码里把 `max_id` 当字符串处理：转成 JavaScript 数字会丢最后一位。

## 用到的接口

- [微博评论](https://xtikapi.com/zh/apis/weibo/comments/list): $0.002 / 次

## 微博的更多内容

- [weibo-crawler 常见报错排查：Expecting value、共爬取 0 条、数据不全、query_list 与评论失效](https://xtikapi.com/zh/answers/weibo-crawler-errors-and-fixes)
- [微博评论下面的回复（楼中楼）怎么抓](https://xtikapi.com/zh/answers/weibo-comment-replies-export)
- [微博话题（#话题#）下的微博怎么全部抓下来](https://xtikapi.com/zh/answers/weibo-topic-posts)
- [微博的转发列表怎么获取](https://xtikapi.com/zh/answers/weibo-reposts-list-export)
- [微博评论怎么批量导出](https://xtikapi.com/zh/answers/weibo-comments-export)
- [微博 mid 和链接里的短串怎么互转](https://xtikapi.com/zh/answers/weibo-mid-to-bid)

## 常见问题

### 用 XTikAPI 做这件事要花多少钱？

按本文的例子是 10 次调用，共 $0.02。失败和超时不收费；验证过邮箱的新账号送 $0.50 试用额度。

### 为什么 max_id 是字符串？

它有 17 位，超过了 JavaScript 和 JSON 数字能精确表示的范围。当数字用最后一位会变，翻到的就是错的页，所以全程保持字符串。

---

XTikAPI: one API key for public social media data, prepaid per call. [HTML version](https://xtikapi.com/zh/guides/weibo-post-comments) · [llms.txt](https://xtikapi.com/llms.txt) · [OpenAPI](https://xtikapi.com/openapi.json)
