# B站 字幕 API (bilibili.subtitles)

- Canonical page: https://everyinfra.com/bilibili-api/subtitles
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "bilibili", "action": "subtitles", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: single object
- 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=subtitles

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | B 站视频完整链接，建议 https://www.bilibili.com/video/<BV号>。comments 查评论区，danmaku 查第一分 P 的播放弹幕，subtitles 查语音转写；三者不是同一种文字数据。danmaku 需要能从链接里提取 BV 号。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| video_id | 视频 BV 号。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| author_name | 作者昵称（显示名）。 |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| duration_sec | platform-native meaning |
| language | 内容语言代码（如 zh、en），由平台判定，可能不准。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |
| segments | platform-native meaning |

## 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": "subtitles",
  "params": {
    "url": "https://www.bilibili.com/video/BV1o84y1V7EY"
  }
}'
```

```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": "subtitles",
        "params": {
            "url": "https://www.bilibili.com/video/BV1o84y1V7EY",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "bilibili",
  "action": "subtitles",
  "results": {
    "title": "【60集】儿童英文演讲视频，34个主题，小作文绝佳素材，每集30s短小精悍！主题包括：介绍自己、介绍家庭成员、介绍朋友、天气、梦想的工作、学校生活、学习计划、房 p01 English Speech _ All About Me",
    "author_name": "•••",
    "duration_seconds": 20,
    "language": "English",
    "text": "Everyone, nice to meet you. Let me introduce myself. My name is Julie Anderson. I'm nine years old. I'm from South Africa. I like pancakes and hot dogs. I like yellow. I like cats. Now you know more about me. I hope we can be friends.",
    "platform": "bilibili",
    "segments": [
      {
        "start": "00:00:00.830",
        "end": "00:00:10.660",
        "text": "Everyone, nice to meet you. Let me introduce myself. My name is Julie Anderson. I'm nine years old. I'm from South Africa."
      },
      {
        "start": "00:00:11.359",
        "end": "00:00:19.910",
        "text": "I like pancakes and hot dogs. I like yellow. I like cats. Now you know more about me. I hope we can be friends."
      }
    ]
  },
  "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
