# B站 视频详情 API (bilibili.video)

- Canonical page: https://everyinfra.com/bilibili-api/video
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "bilibili", "action": "video", "params": {...}}
- Price: $0.000556 per call ($0.56 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=video

## 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 |
|---|---|
| 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。 |
| video_streams | 视频流列表（DASH，.m4s，只有画面没有声音，要和音频流合并）：id（清晰度代码）、quality（清晰度名，不登录最高 480P）、codecs（avc1 / hev1 / av01）、width、height、frame_rate、bandwidth、url、backup_urls。链接约 120 分钟后失效，见 streams_expire_at；下载时请求头要带 Referer，见 streams_referer。 |
| audio_streams | 音频流列表（DASH，.m4s，mp4a）：id、codecs、bandwidth、url、backup_urls。失效时间与 Referer 要求同 video_streams。 |
| streams_expire_at | 流地址失效时间（ISO，取各条链接里最早的那个；约在调用后 120 分钟）。过了要重新调用 video 取新地址。 |
| streams_referer | 下载流地址时必须带的请求头 Referer 值（不带会被 403）。 |

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

```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": "video",
        "params": {
            "url": "https://www.bilibili.com/video/BV1DYjA6KEJ7",
        },
    },
    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": "video",
  "results": {
    "id": "BV1DYjA6KEJ7",
    "url": "https://www.bilibili.com/video/BV1DYjA6KEJ7",
    "title": "《原神》「『空月之歌·谐谑』映夏！归乡？千灵节！」前瞻特别节目",
    "text": "《原神》「『空月之歌·谐谑』映夏！归乡？千灵节！」将于2026年7月1日上线。\n感谢各位旅行者的支持与陪伴，我们将为大家带来更多「『空月之歌·谐谑』映夏！归乡？千灵节！」版本的最新消息~\n \n本次兑换码将于2026年6月22日12:00:00失效，记得尽快兑换哦~\n\n《原神》bilibili服下载地址： https://www.biligame.com/detail/?id=103496",
    "duration_seconds": 2583,
    "duration_text": "43:03",
    "view_count": 1722394,
    "like_count": 121499,
    "comment_count": 8653,
    "danmaku_count": 25368,
    "favorite_count": 24496,
    "coin_count": 38171,
    "share_count": 6639,
    "thumbnail_url": "http://i0.hdslb.com/bfs/archive/9839aee8582b365528c3e9f364748e4acb4c2401.jpg",
    "posted_at": "2026-06-18T13:00:00+00:00",
    "category": "",
    "author_name": "•••",
    "author_id": "•••",
    "author_url": "https://space.bilibili.com/•••",
    "platform": "bilibili",
    "tags": [
      "月之八",
      "映夏归乡千灵节",
      "米哈游"
    ]
  },
  "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
