# 微博 账号搜索 API (weibo.user_search)

- Canonical page: https://everyinfra.com/weibo-api/user_search
- Endpoint: POST /api/v1/social with {"platform": "weibo", "action": "user_search", "params": {...}}
- Price: $0.000806 per call ($0.81 per 1,000 requests); failed and empty results are not charged
- Returns: list, one page of up to 20 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

微博账号搜索按 `keyword` 找账号，可以填昵称（如 人民日报），也可以填关键词，每行带 `user_id`、显示名、主页链接、简介、粉丝数和关注数、是否认证、认证说明 `verified_reason` 和头像。它回答「这个名字或这个词对应哪些微博账号」，适合核对一个账号的身份，或者用关键词筛一批候选博主。

第一页常常只有最匹配的一两个账号，每页人数不固定，所以别用条数判断有没有下一页，要看响应里有没有 `next_page_token`。`user_id` 是后续能力的入口，读账号资料、读用户内容都从它接着查。`follower_count` 为 null 表示不公开，不等于 0。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 按昵称或关键词找微博账号，例如 人民日报；返回的 user_id 可接着查 profile、user_posts。 |
| page_token | not declared | no | not declared | 翻页令牌。第一页不传；之后把上一页响应里的 next_page_token 原样传回取下一页，其余参数不变。每页人数不固定（第一页常只有最匹配的一两个账号），每页算一次调用；翻到底时响应里没有 next_page_token。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| user_id | 用户在原平台的唯一 ID。 |
| display_name | 显示名，可能与 username 不同。 |
| url | 该记录在原平台上的可访问链接。 |
| bio | 个人简介，账号自己填写的文本。可能含换行和 emoji。 |
| follower_count | 粉丝数。null 表示不公开，不等于 0。 |
| following_count | 关注数。null 表示不公开，不等于 0。 |
| is_verified | 是否为平台认证账号（蓝V等）。null 表示无法判定。 |
| verified_reason | 认证说明。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| next_page_token | 翻页令牌（user_search、user_posts、topic_search、user_post_search）：作为下一次请求的 page_token 原样传回取下一页；同一页每行的值相同，响应顶层也有同一个 next_page_token。没有该字段即到底。 |
| 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": "user_search",
  "params": {
    "keyword": "科技"
  }
}'
```

```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": "user_search",
        "params": {
            "keyword": "科技",
        },
    },
    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": "user_search",
  "results": [
    {
      "user_id": …,
      "display_name": …,
      "url": …,
      "bio": …,
      "follower_count": …,
      "following_count": …,
      "is_verified": …,
      "verified_reason": …,
      "avatar_url": …,
      "next_page_token": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 搜到的 `user_id` 能拿去做什么？

它是数字 UID，可以直接填进微博的用户内容，读这个账号发的微博，也可以填进在用户微博里搜索，在这个账号里找关键词，还可以接着读账号资料。用户内容和在用户微博里搜索都不收昵称，所以昵称要先在这一页换成 `user_id`。

### 怎么确认搜到的是官方账号？

先看 `is_verified` 有没有加 V，再读 `verified_reason` 里的认证说明。再对照 `bio`、`display_name` 和主页链接。`is_verified` 读到 null 说明判定不了，这种账号要靠简介和链接再核一遍。

### 为什么第一页只有一两个账号？

第一页常常只有最匹配的一两个账号，这不代表搜不到更多。每页人数本来就不固定，要看更多就用 `next_page_token` 翻页，直到响应里不再有这个令牌。每翻一页算一次调用，所以只需要最匹配的账号时，读第一页就停。

## 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
