# 微博 评论 API (weibo.comments)

- Canonical page: https://everyinfra.com/weibo-api/comments
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "weibo", "action": "comments", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 50 per call
- Mode: sync; add "mode": "async" for slow tasks

微博评论按单条微博的 `url` 读取它下面的一级评论，每条带正文、点赞数、发布时间、评论者昵称、ID 和头像，以及这条评论所属的微博 ID `post_id` 和链接 `post_url`。它回答「网友对这条微博怎么说」，常用于舆情监测、品牌口碑分析和热点事件的公众情绪抽样。

`url` 建议用 /detail/ 加纯数字微博 ID 的链接，或者直接填数字 ID；含字母短码的链接不能用。评论下的回复要用评论回复单独读。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=weibo&action=comments

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | comments 建议使用 /detail/纯数字帖子ID 的链接，或在 url 中直接填数字帖子 ID；含字母的微博短码链接不能用。 |
| limit | integer (1–50) | no | 20 | 这次调用最多返回的条数，整数，1–50；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_name | 作者昵称（显示名）。 |
| author_avatar_url | 作者头像。 |
| post_id | 微博 ID。 |
| post_url | 微博链接。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "weibo",
  "action": "comments",
  "params": {
    "url": "https://weibo.com/1659899634/5326504200510190"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "weibo",
        "action": "comments",
        "params": {
            "url": "https://weibo.com/1659899634/5326504200510190",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "weibo",
  "action": "comments",
  "results": [
    {
      "id": …,
      "text": …,
      "like_count": …,
      "author_id": …,
      "author_name": …,
      "author_avatar_url": …,
      "post_id": …,
      "post_url": …,
      "posted_at": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 为什么传微博链接读不到评论？

多半是链接里用了字母短码。这里只认纯数字微博 ID：用 m.weibo.cn/detail/ 加数字 ID 的链接，或直接填数字 ID；微博用户内容和关键词搜索返回行里的微博 ID 都是纯数字，可以直接用。

### 怎么读到评论下面的回复？

把这条评论的 `id` 交给微博评论回复，就能读到它下面的回复，还能看到回复者的 IP 属地。先按 `like_count` 挑出热评再读，调用次数更省。

### 批量读多条微博的评论时怎么区分？

每条评论都带 `post_id` 和 `post_url`，标明它属于哪条微博。把多条微博的评论合在一张表里分析时，按 `post_id` 分组即可，不用自己另记来源。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=weibo
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
