# 豆瓣 关键词搜索 API (douban.search)

- Canonical page: [https://everyinfra.com/douban-api/search](https://everyinfra.com/douban-api/search?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "douban", "action": "search", "params": {...}}
- Price: $0.001389 per call ($1.39 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

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 豆瓣条目名称或主题搜索词，用于发现电影、图书、音乐条目；不是全文搜索长评或小组帖子。 |
| search_type | enum: all / book / movie / music | no | not declared | 条目类型只接受 all（全部）、movie（电影）、book（图书）或 music（音乐），省略时默认 all。type 同时存在时优先 type；其他显式值会在公开 API 参数校验阶段返回 422。 |
| type | enum: all / book / movie / music | no | not declared | search_type 的优先输入，取 all / movie / book / music。它筛选条目类型，不是 reviews 长评与 comments 短评的切换，后者由 action 决定。 |
| limit | integer (1–50) | no | 20 | 这次调用最多返回的条数，整数，1–50；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| subject_type | 条目类型（电影/书/音乐）。 |
| year | 年份。 |
| director | 导演。 |
| cast | 主演。 |
| author | 作者。 |
| artist | 音乐人。 |
| rating | 评分。**分制随平台而异**，同一行的 `rating_scale` 给出该平台满分 (多数是 5，Booking/豆瓣/爱奇艺/NAVER 是 10)。跨平台比较前必须先按 rating_scale 换算。直接比数字会得出反的结论。 |
| rating_scale | 上一列 `rating` 的满分。5 表示五星制、10 表示十分制。只在该行有 rating 时出现。 |
| rating_count | 参与评分的人数。null 表示不公开，不等于 0。 |
| cover_url | 封面。 |
| 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": "douban",
  "action": "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": "douban",
        "action": "search",
        "params": {
            "keyword": "星际穿越",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-11-07T14:47:42Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "douban",
  "action": "search",
  "results": [
    {
      "id": "1889243",
      "url": "https://movie.douban.com/subject/1889243/",
      "title": "星际穿越",
      "subject_type": "movie",
      "year": "2014",
      "director": "克里斯托弗·诺兰",
      "cast": [
        "马修·麦康纳",
        "安妮·海瑟薇",
        "杰西卡·查斯坦"
      ],
      "rating": 9.4,
      "rating_count": 2238616,
      "cover_url": "https://img3.doubanio.com/view/photo/m_ratio_poster/public/p2614988097.jpg",
      "platform": "douban",
      "rating_scale": 10
    },
    {
      "id": "35239063",
      "url": "https://movie.douban.com/subject/35239063/",
      "title": "星际穿越2：虫洞",
      "subject_type": "movie",
      "year": "2016",
      "director": "Danil Andreev",
      "rating_count": 0,
      "cover_url": "https://img3.doubanio.com/view/photo/m_ratio_poster/public/p2624299677.jpg",
      "platform": "douban"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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