# Douyin 抖音 Video Comments & Replies Scraper (`arjun_code/douyin-comments-scraper`) Actor

Extract public Douyin comments and replies from video URLs or IDs. Export text, timestamps, likes, image links, and thread IDs. 输入抖音视频链接、精选链接或 ID，采集公开评论与回复，保留评论串关系，支持导出 JSON 或 CSV，用于舆情监测和用户反馈分析。

- **URL**: https://apify.com/arjun_code/douyin-comments-scraper.md
- **Developed by:** [ArjunAI Data](https://apify.com/arjun_code) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.49 / 1,000 top-level comments

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

输入抖音视频链接、精选链接或视频 ID，采集公开视频的顶层评论和回复，并导出 JSON 或 CSV。每条回复保留所属评论串的 ID，便于追踪讨论、监测舆情和分析用户反馈。

Export public Douyin video comments and replies for social listening, customer feedback, and content research. Each reply keeps its thread ID so you can group it with the original comment. Export the full dataset as JSON or CSV.

🚀 Start / 快速开始 · 📥 Inputs / 参数 · 📊 Sample data / 样例 · 🤖 AI Agent / MCP

[English guide](#english)

### 🚀 抖音评论采集快速开始

1. 在 **Douyin videos** 填写一个或多个抖音视频链接、含 `modal_id` 的精选链接或视频 ID。
2. 默认每个视频最多保存 50 条顶层评论。开启 **Include replies** 后，回复也计入 **Maximum results per video** 的上限。
3. 在 **Comments and replies** 查看结果或导出完整数据集。在 **Run summary** 查看每个视频的保存数量和状态。

#### 📥 参数

| 参数 | 默认值 | 说明 |
| --- | --- | --- |
| `videos` | 必填 | 抖音视频链接、精选链接或视频 ID 的列表。同一个视频重复输入时只查询一次。 |
| `maxResultsPerVideo` | `50` | 每个视频最多保存的条数，顶层评论和回复合计。设为 `0` 表示不限条数，读取数据源可返回的分页；实际条数可能少于抖音页面显示的总数。 |
| `includeReplies` | `false` | 开启后先保存顶层评论，再处理它的回复。每条保存的回复都占一个结果名额。 |

旧版本输入中的 `maxCommentsPerVideo` 请换成 `maxResultsPerVideo`。

#### 结果与评论串

`type` 区分顶层评论（`comment`）与回复（`reply`）。回复的 `rootCommentId` 对应顶层评论的 `cid`；`replyToCommentId` 是直接回复对象的 ID，如数据源未提供，则使用顶层评论 ID。`replyCommentTotal` 仅出现在顶层评论中，是数据源报告的回复数，不代表本次实际抓取的回复数。

完整 JSON 在数据源提供时还包含发布时间、点赞数、公开作者信息、@ 提及和图片链接。`ipLabel` 是抖音显示的属地标签，并非 IP 地址。如果评论只有图片，`text` 可能为空；Actor 不下载图片。

运行汇总（`OUTPUT`）按视频提供 `commentsCollected`（顶层评论数）、`repliesCollected`（回复数）和 `resultsCollected`（合计）。`partial` 表示请求的部分数据未能取得；正常达到条数上限不算失败。达到费用上限时会标记 `chargeLimitReached`，已保存的结果仍可使用。

### English

1. Enter one or more public Douyin video URLs, Jingxuan links with a `modal_id`, or video IDs.
2. Leave **Include replies** off to save up to 50 top-level comments per video by default. Turn it on to include replies within the same per-video limit.
3. Review or export results under **Comments and replies**. Check **Run summary** for each video's counts and status.

#### 📥 Input

| Field | Default | What it does |
| --- | --- | --- |
| `videos` | Required | Douyin video URLs, Jingxuan links, or video IDs. Duplicate inputs for the same video are skipped. |
| `maxResultsPerVideo` | `50` | Caps saved top-level comments and replies **combined**, per video. `0` reads all available pages; the source may return fewer results than the count shown on Douyin. |
| `includeReplies` | `false` | Saves each top-level comment before its replies. Every saved reply counts toward the limit. |

If you used an earlier version, replace `maxCommentsPerVideo` with `maxResultsPerVideo`.

#### Results and thread IDs

`type` is `comment` or `reply`. Match a reply's `rootCommentId` to the top-level comment's `cid`. `replyToCommentId` identifies the immediate target when available; otherwise it falls back to the root. `replyCommentTotal` is the source's reported reply count, not the number collected.

Full JSON rows include timestamps, likes, public author details, mentions, and image links when available. `ipLabel` is Douyin's location label, not an IP address. Image-only comments can have an empty `text`; the Actor links to images rather than downloading them.

The run summary (`OUTPUT`) reports `commentsCollected`, `repliesCollected`, and `resultsCollected` per video. `partial` means some requested data could not be retrieved. Reaching the result limit is normal; reaching the spending limit produces `chargeLimitReached`. Already saved rows remain available.

### 📊 Sample data / 输入与结果示例

Enable replies and collect up to 50 combined rows. 开启回复，单个视频最多保存 50 条评论和回复。

```json
{
  "videos": ["https://www.douyin.com/video/7678544693033962787"],
  "maxResultsPerVideo": 50,
  "includeReplies": true
}
```

The excerpt below shows selected fields from a real run that saved 29 comments and 21 replies. 以下是真实云端运行的字段节选：29 条顶层评论 + 21 条回复 = 50 条。

```json
[
  {
    "type": "comment",
    "cid": "7680133379090105147",
    "awemeId": "7678544693033962787",
    "text": "博卡拉与奇达旺真的值的一游，自然风光与当地宗教文化完美结合",
    "diggCount": 1,
    "replyCommentTotal": 1
  },
  {
    "type": "reply",
    "cid": "7682778824722924314",
    "awemeId": "7678544693033962787",
    "rootCommentId": "7680133379090105147",
    "replyToCommentId": "7680133379090105147",
    "diggCount": 0
  }
]
```

### 💳 Pricing / 计费

| Saved result / 计费项 | Event / 事件名 | Price / 费率 |
| --- | --- | ---: |
| Top-level comment / 顶层评论 | `douyin-comment` | $0.00149 per row / 条（$1.49 / 1,000） |
| Reply / 回复 | `douyin-reply` | $0.00249 per row / 条（$2.49 / 1,000） |
| Actor Start / 启动 | `apify-actor-start` | $0.00005 per start unit / 启动计费单位 |

评论和回复合计限制条数，但按上表分别计费。上述真实运行的 Apify 事件金额为 **$0.09555**，含一个启动计费单位。输入无效、重复或未保存结果时不收结果费；启动费另计。可用 **Maximum charge** 设置单次运行的费用上限。

The cap counts both row types, but the Actor charges each saved row at its own rate. The example above recorded **$0.09555 in Apify event charges**, including one start unit. Invalid or duplicate inputs, and lookups with no saved rows, incur no result fee; the start event is separate. Use **Maximum charge** to set a spending limit.

### 🔌 API / API 调用

使用 Apify API Token 向 [Run Actor 接口](https://docs.apify.com/api/v2/actors-runs-post)提交与上方相同的输入。

Send the same input to the [Run Actor endpoint](https://docs.apify.com/api/v2/actors-runs-post) with an Apify API token.

```bash
curl -X POST "https://api.apify.com/v2/actors/arjun_code~douyin-comments-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"videos":["https://www.douyin.com/video/7678544693033962787"],"maxResultsPerVideo":50,"includeReplies":true}'
```

用返回的运行 ID [查询状态](https://docs.apify.com/api/v2/actor-run-get)。运行结束后，`output.results` 指向完整数据集，`output.summary` 指向运行汇总。访问私有运行和存储时需使用有权限的 Token。

Use the returned run ID to [check its status](https://docs.apify.com/api/v2/actor-run-get). When it finishes, follow `output.results` for the Dataset and `output.summary` for the run summary. Use an authorized token for private runs and storage.

### 🤖 AI Agent / MCP

#### Connect / 连接 Apify MCP

Add the hosted Apify MCP server to a client that supports remote **Streamable HTTP**. The `tools` parameter selects this Actor for the client:

在支持远程 **Streamable HTTP** 的 MCP 客户端添加 Apify 服务。`tools` 参数用于加载这个抖音 Actor：

```json
{
  "mcpServers": {
    "douyin-comments": {
      "url": "https://mcp.apify.com?tools=arjun_code/douyin-comments-scraper"
    }
  }
}
```

Sign in with Apify OAuth. If your client uses headers instead, configure `Authorization: Bearer <APIFY_TOKEN>` through its secret settings. The connected account must be allowed to run the Actor and read its results. See the [Apify MCP setup guide](https://docs.apify.com/mcp) for client-specific instructions.

使用 Apify OAuth 授权；若客户端使用请求头，可在其凭证设置中配置 `Authorization: Bearer <APIFY_TOKEN>`。授权账号需要有权限运行此 Actor 并读取结果。不同客户端的配置方式见 [Apify MCP 指南](https://docs.apify.com/mcp)。

#### Reusable prompt / 可复制提示词

> Run `arjun_code/douyin-comments-scraper` once. Use `videos: ["https://www.douyin.com/video/7678544693033962787"]`, `maxResultsPerVideo: 50`, and `includeReplies: true`. Return `cid`, `type`, `text`, `diggCount`, and, on reply rows, `rootCommentId` from that run. If you receive only a run ID, check that run and read its Dataset instead of starting another run.

> 运行一次 `arjun_code/douyin-comments-scraper`。输入 `videos: ["https://www.douyin.com/video/7678544693033962787"]`、`maxResultsPerVideo: 50`、`includeReplies: true`。返回本次运行的 `cid`、`type`、`text`、`diggCount`，回复行再返回 `rootCommentId`。若只返回运行 ID，请查询同一次运行并读取它的数据集，不要重新运行。

When the client returns IDs rather than rows, use `get-actor-run` to check the run and `get-dataset-items` with its `defaultDatasetId` to read the saved rows. To inspect status details, use `get-key-value-store-record` with its `defaultKeyValueStoreId` and the key `OUTPUT`. MCP runs follow the same pricing as Console or API runs.

若客户端返回 ID 而非数据行，先用 `get-actor-run` 查看运行状态，再把 `defaultDatasetId` 传给 `get-dataset-items` 读取数据。需要状态详情时，用 `get-key-value-store-record` 读取 `defaultKeyValueStoreId` 下的 `OUTPUT`。通过 MCP 运行与 Console 或 API 运行采用同一计费规则。

### 🔗 Related Actors / 相关 Actors

- [YouTube Comments Scraper](https://apify.com/arjun_code/youtube-comments-scraper) — Export comments and replies from YouTube videos and Shorts. 用于采集 YouTube 视频及 Shorts 的评论与回复，适合跨平台比较用户反馈。
- [Bilibili Video and Creator Details Scraper](https://apify.com/arjun_code/bilibili-details-scraper) — Look up Bilibili video metrics and UP creator profiles from URLs or IDs. 按链接或 ID 补充 B 站视频指标和 UP 主资料。

### 💬 FAQ and support / 常见问题与支持

#### No results or partial results? / 没有结果或结果不完整？

Check **Run summary** before retrying. For `noComments`, confirm the video and its comments are publicly visible. If the status is `partial` or `requestFailed`, review the message and retry only the affected video if needed. A retry starts a new run.

重试前先看 **Run summary**。如果是 `noComments`，确认视频及评论可公开查看；如果是 `partial` 或 `requestFailed`，先看原因，再按需只重试受影响的视频。重试会创建新运行。

#### Need help? / 需要帮助？

Use the Actor’s **Issues** tab or the contact details on [ArjunAI Data’s profile](https://apify.com/arjun_code). Include the run ID and input with any sensitive details removed. Do not share your API token.

可在 Actor 的 **Issues** 标签页反馈，或通过 [ArjunAI Data](https://apify.com/arjun_code) 主页联系维护者。请提供运行 ID 和脱敏后的输入，不要分享 API Token。

本工具由第三方独立开发，与抖音官方无关联。 This is an independent tool, not affiliated with Douyin.

# Actor input Schema

## `videos` (type: `array`):

Enter video URLs, Jingxuan URLs with a modal_id, or video IDs.

## `maxResultsPerVideo` (type: `integer`):

Maximum number of top-level comments and replies combined. If Include replies is off, only top-level comments are collected. Set 0 to collect all available results.

## `includeReplies` (type: `boolean`):

Include replies to top-level comments. Each reply is saved as its own linked row and counts toward the maximum results per video.

## Actor input object example

```json
{
  "videos": [
    "https://www.douyin.com/video/7678544693033962787"
  ],
  "maxResultsPerVideo": 50,
  "includeReplies": false
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset with one row per saved top-level comment or reply.

## `summary` (type: `string`):

Results, counts, and status for each input video, including partial results or a reached spending limit.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "videos": [
        "https://www.douyin.com/video/7678544693033962787"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arjun_code/douyin-comments-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "videos": ["https://www.douyin.com/video/7678544693033962787"] }

# Run the Actor and wait for it to finish
run = client.actor("arjun_code/douyin-comments-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "videos": [
    "https://www.douyin.com/video/7678544693033962787"
  ]
}' |
apify call arjun_code/douyin-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arjun_code/douyin-comments-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8WHOkC5dPNobI0vZ5/builds/R2qMznMJDBhlra3va/openapi.json
