# TikTok 评论 API (tiktok.comments)

- Canonical page: https://everyinfra.com/tiktok-api/comments
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "tiktok", "action": "comments", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 20, max 200 per call
- Mode: sync; add "mode": "async" for slow tasks

TikTok 评论按视频 `url` 读取这条视频下的评论。每行带正文 `text`、作者、点赞数 `like_count`、回复数 `reply_count` 和发布时间 `posted_at`。它回答「观众在这条视频下说了什么」，适合做口碑抽样，也适合找出作者点赞或置顶的评论。

回复和顶层评论一样占一行：`is_reply` 为真的行是回复，`reply_to_id` 指向它回复的那条评论。`liked_by_author` 和 `pinned_by_author` 分别标出被作者点赞、被作者置顶的评论。同一位观众的多条评论按 `author_id` 归并，`author_username` 用来拼主页链接。文稿那一页读视频自己说的话，这一页读观众说的话。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | video / comments / transcript 的具体 TikTok 视频链接；comments 按视频取评论，每条顶层评论最多附带两条回复，不保证完整对话树。 |
| limit | integer (1–200) | no | 20 | 这次调用最多返回的条数，整数，1–200；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_id | 作者在原平台的唯一 ID。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| reply_count | 回复数，通常用于评论的子回复。null 表示不公开。 |
| reply_to_id | 被回复评论 ID。 |
| is_reply | 是否为回复。 |
| liked_by_author | 评论是否被作者点赞。 |
| pinned_by_author | 评论是否被作者置顶。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| 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": "comments",
  "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": "comments",
        "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; the list keeps the first 2 of 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "tiktok",
  "action": "comments",
  "results": [
    {
      "id": "•••",
      "text": "keep in mind he’s dating a 23 year old.",
      "author_username": "•••",
      "author_id": "•••",
      "like_count": 1220,
      "reply_count": 15,
      "is_reply": false,
      "liked_by_author": false,
      "pinned_by_author": false,
      "posted_at": "2025-04-03T05:43:23+00:00",
      "platform": "tiktok"
    },
    {
      "id": "•••",
      "text": "Can’t sing bands make em dance after losing 7 million 😂",
      "author_username": "•••",
      "author_id": "•••",
      "like_count": 144,
      "reply_count": 0,
      "is_reply": false,
      "liked_by_author": false,
      "pinned_by_author": false,
      "posted_at": "2025-04-04T15:21:07+00:00",
      "platform": "tiktok"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 评论下的回复能读全吗？

不能保证。每条顶层评论最多附带两条回复，所以不保证完整对话树，回复很多的评论只能看到其中两条。要把已有的回复挂回原评论，用 `is_reply` 和 `reply_to_id` 对应。

### `like_count` 是 null 算 0 个赞吗？

不算。null 表示该平台或该接口没有公开这项数据，`reply_count` 同理。统计平均点赞前先把 null 的行剔除，免得把没公开的数据当成零。

### 怎么找出作者互动过的评论？

看 `liked_by_author` 和 `pinned_by_author`：前者为真是评论被作者点赞，后者为真是被作者置顶。先挑出这两类，再按 `like_count` 排序，能快速看到作者认可的观点。

## 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
