# TikTok 视频文稿 API (tiktok.transcript)

- Canonical page: https://everyinfra.com/tiktok-api/transcript
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "tiktok", "action": "transcript", "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

TikTok 视频文稿按视频 `url` 返回一个对象：`text` 是提取出的文稿全文，`segments` 是带时间戳的字幕分段，`has_transcript` 标出这条视频有没有字幕可以提取，`url` 是视频的可访问链接。它回答「这条视频里说了什么」，适合在不看视频的情况下做内容归类、摘录引语或检索关键词。`text` 已去除 HTML 标签，全文返回、不截断。

先看 `has_transcript`：它为假时说明这条视频没有字幕可提取，文稿读不到。观众的反应不在这一页，要读评论请换评论那一页，那里返回列表，单次最多 200 条。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | video / comments / transcript 的具体 TikTok 视频链接；comments 按视频取评论，每条顶层评论最多附带两条回复，不保证完整对话树。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| segments | 字幕分段（带时间戳的文本）。 |
| has_transcript | 是否有字幕可提取。 |
| 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": "tiktok",
  "action": "transcript",
  "params": {
    "url": "https://www.tiktok.com/@stoolpresidente/video/7488736374602927402"
  }
}'
```

```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": "tiktok",
        "action": "transcript",
        "params": {
            "url": "https://www.tiktok.com/@stoolpresidente/video/7488736374602927402",
        },
    },
    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": "tiktok",
  "action": "transcript",
  "results": {
    "id": "7488736374602927402",
    "url": "https://www.tiktok.com/@stoolpresidente/video/7488736374602927402",
    "text": "Bagels to make him dance. Bagels to make him dance. Bagels to make him dance. Bagels to make him dance. Bagels to make him dance.",
    "segments": [
      {
        "start": "00:00:00.380",
        "end": "00:00:03.600",
        "text": "Bagels to make him dance. Bagels to make him dance."
      },
      {
        "start": "00:00:03.700",
        "end": "00:00:06.760",
        "text": "Bagels to make him dance. Bagels to make him dance."
      },
      {
        "start": "00:00:06.900",
        "end": "00:00:08.400",
        "text": "Bagels to make him dance."
      }
    ],
    "has_transcript": true,
    "platform": "tiktok"
  },
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 每条视频都能拿到文稿吗？

不一定，只有带字幕、能提取的视频才有文稿，结果里的 `has_transcript` 会标出这一点。不用事先猜，调用后看这个字段即可。批量处理一组视频时，先按它把有文稿和没文稿的分开，只对有文稿的那批取 `text` 和 `segments`。

### `text` 和 `segments` 用哪个？

只要内容就用 `text`，它是整条视频的文稿全文。需要逐句引用、或者想知道某句话出现在视频哪个时刻，才用 `segments`，它把字幕切成一段段带时间戳的文本。

### 文稿和评论怎么配合着读？

两页都只要视频链接 `url`：先读文稿，弄清视频本身讲了什么，再读评论，看观众怎么回应。文稿返回单个对象，评论返回列表；评论那一页还有作者点赞、置顶、回复关系等标记，文稿这一页没有。

## Also

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