# 抖音 弹幕 API (douyin.danmaku)

- Canonical page: [https://everyinfra.com/douyin-api/danmaku](https://everyinfra.com/douyin-api/danmaku?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "douyin", "action": "danmaku", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list
- 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=douyin&action=danmaku

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 要取弹幕的那条抖音视频：纯数字视频 ID、视频链接（https://www.douyin.com/video/<视频ID>）、v.douyin.com 短链，或整段带短链的分享口令都行。 |
| page_token | not declared | no | not declared | 翻页令牌。不传是第 1 页；之后把上一页响应里的 next_page_token 原样传回取下一页，其余参数不变。令牌 24 小时内有效；翻到底时没有 next_page_token。一页是视频里最长 32 秒的一段，从头翻到没有 next_page_token 就是整条视频的弹幕。 |
| limit | integer (1–) | no | not declared | 这次调用最多返回的条数，整数，至少为 1；不传按默认值，实际返回可能少于这个数。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| video_id | 视频 ID：comments 是评论所属的视频，post_history 是查的那条视频。 |
| video_time | 这条弹幕出现在视频的什么位置（danmaku），mm:ss。 |
| video_time_seconds | 这条弹幕出现在视频的第几秒（danmaku），带小数。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| author_uid | 作者（评论里是评论者）的数字用户 ID；author_id 是 secUid，两者是同一个人的两种 ID。 |
| is_ad | 是否是广告：作品行是广告作品，danmaku 行是这条弹幕是不是广告。 |
| danmaku_count | 整条视频一共多少条弹幕（danmaku），每行相同。 |
| 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": "douyin",
  "action": "danmaku",
  "params": {
    "url": "https://www.douyin.com/video/7633646113853104116"
  }
}'
```

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

## Response example

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

```text
{
  "id": "req_…",
  "platform": "douyin",
  "action": "danmaku",
  "results": [
    {
      "id": "•••",
      "text": "好厉害",
      "video_id": "7633646113853104116",
      "video_time": "00:00",
      "video_time_seconds": 0,
      "like_count": 0,
      "author_uid": "•••",
      "is_ad": false,
      "danmaku_count": 868,
      "platform": "douyin"
    },
    {
      "id": "•••",
      "text": "小学生想吃",
      "video_id": "7633646113853104116",
      "video_time": "00:00",
      "video_time_seconds": 0,
      "like_count": 0,
      "author_uid": "•••",
      "is_ad": false,
      "danmaku_count": 868,
      "platform": "douyin"
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": 824,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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