# B站 综合搜索 API (bilibili.general_search)

- Canonical page: [https://everyinfra.com/bilibili-api/general_search](https://everyinfra.com/bilibili-api/general_search?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "bilibili", "action": "general_search", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls 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

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | 搜索词。结果和 B 站网页搜索的「综合」一栏一样混排，每行的 type 写明是哪一种：video 视频、user 用户、bangumi 番剧、movie 影视、live 直播间。只要视频用 search，只要用户用 user_search。 |
| page_token | not declared | no | not declared | 翻页令牌。第一页不传；之后把上一页响应里的 next_page_token 原样传回取下一页，其余参数不变。第一页约 20 个视频，另带相关的用户、番剧、影视，会多出几行；往后每页只有视频、最多 20 条。每页算一次调用；limit 不起作用。令牌 24 小时内有效，翻到底时响应里没有 next_page_token。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| type | 记录类型，取值随能力而定（如 video / image / text）。 |
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| duration_sec | platform-native meaning |
| duration_text | 时长的展示文本（如 12:34）。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| danmaku_count | 弹幕数。**B站特有的互动指标，与评论数并列看活跃度**。 |
| favorite_count | 收藏数。 |
| coin_count | 投币数。B站的付费级好评，比点赞含金量高。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| thumbnail_url | 缩略图链接，分辨率低于 image_url。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| category | 分类名称，取值为原平台的分类体系，未做跨平台归一。 |
| author_name | 作者昵称（显示名）。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_url | 作者在原平台的主页链接。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| tags | 标签数组。无标签时为空数组，不是 null。 |
| user_id | 用户在原平台的唯一 ID。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| bio | 个人简介，账号自己填写的文本。可能含换行和 emoji。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| level | 用户等级（0–6）。 |
| follower_count | 粉丝数。null 表示不公开，不等于 0。 |
| video_count | 视频数。 |
| is_verified | 是否为平台认证账号（蓝V等）。null 表示无法判定。 |
| verified_type | 认证类型（user_search、general_search 的用户行）：personal 个人认证、organization 机构认证；没认证时没有。 |
| verified_title | 认证头衔（如「知名UP主」）。 |
| is_live | 这个用户现在是不是在直播（user_search、general_search 的用户行）；不在直播时可能没有这个字段。 |
| live_room_id | 用户的直播间号（user_search、general_search 的用户行）；没开过直播间时没有。 |
| is_senior_member | 是不是硬核会员（user_search、general_search 的用户行）；不是时没有这个字段。 |
| recent_video_ids | 这个用户最近几个视频的 BV 号（user_search、general_search 的用户行），数组，可作为 video 的 url 传入。 |
| episode_count | 集数（general_search 的番剧、影视行）。 |
| rating | 评分。**分制随平台而异**，同一行的 `rating_scale` 给出该平台满分 (多数是 5，Booking/豆瓣/爱奇艺/NAVER 是 10)。跨平台比较前必须先按 rating_scale 换算。直接比数字会得出反的结论。 |
| rating_scale | 评分的满分（general_search 的番剧、影视行），B 站是 10。 |

## 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": "bilibili",
  "action": "general_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": "bilibili",
        "action": "general_search",
        "params": {
            "keyword": "编程",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

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

```text
{
  "id": "req_…",
  "platform": "bilibili",
  "action": "general_search",
  "results": [
    {
      "type": "video",
      "id": "BV1rpWjevEip",
      "url": "https://www.bilibili.com/video/BV1rpWjevEip",
      "title": "【全748集】目前B站最全最细的Python零基础全套教程，2026最新版，包含所有干货！七天就能从小白到大神！少走99%的弯路！存下吧！很难找全的！",
      "text": "【视频配套籽料、开发环境搭建安装包教程、电子书+问题解答请看 ”置顶平论” 自取哦】\r\n本套教程从零开始讲解，手把手教学，包含基础语法、进阶语法、爬虫、自动化办公、数据分析\r\n无论是新手小白，还是有一定编码经验的选手，皆可学习\r\n如果视频对你有用的话请 一键三连【长按点赞】支持一下UP哦，拜托，这对我真的很重要！",
      "duration_seconds": 143894,
      "duration_text": "39:58:14",
      "view_count": 21931770,
      "like_count": 605744,
      "comment_count": 373418,
      "danmaku_count": 137244,
      "favorite_count": 927710,
      "thumbnail_url": "https://i2.hdslb.com/bfs/archive/a979056b1a32012cdd00d48fbc3732d253e30620.jpg",
      "posted_at": "2024-08-22T14:59:18+00:00",
      "category": "计算机技术",
      "author_name": "P•••程",
      "author_id": "•••",
      "author_url": "https://space.bilibili.com/•••",
      "platform": "bilibili",
      "tags": [
        "程序员",
        "Python教程",
        "Python入门零基础"
      ],
      "duration_sec": 143894
    },
    {
      "type": "video",
      "id": "BV12J411X7tY",
      "url": "https://www.bilibili.com/video/BV12J411X7tY",
      "title": "少儿编程scratch3.0基础入门（大龙老师）",
      "text": "这个教程是简单的基础入门课，想要系统的，完整的学习scratch请选择《新版scratch从入门到精通系统课》，点击评论区置顶链接进入课程，了解详情。",
      "duration_seconds": 11349,
      "duration_text": "3:09:09",
      "view_count": 1373367,
      "like_count": 15518,
      "comment_count": 2142,
      "danmaku_count": 9959,
      "favorite_count": 46757,
      "thumbnail_url": "https://i2.hdslb.com/bfs/archive/45a0b5a218de8fff3b7f4cf02e130179b1be470c.jpg",
      "posted_at": "2019-11-27T10:20:37+00:00",
      "category": "校园学习",
      "author_name": "大•••程",
      "author_id": "•••",
      "author_url": "https://space.bilibili.com/•••",
      "platform": "bilibili",
      "tags": [
        "scratch",
        "少儿编程",
        "原创"
      ],
      "duration_sec": 11349
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 17,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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