# Douyin Live Chat Scraper - Record Live Stream Comments (`hgservices/douyin-live-chat-scraper`) Actor

Record the live chat of Douyin (抖音) live streams in real time: every comment with user name, sec_uid and time, plus optional likes, viewer joins, follows and viewer counts. Record several rooms at once for up to 4 hours. Paste live or profile links. No login.

- **URL**: https://apify.com/hgservices/douyin-live-chat-scraper.md
- **Developed by:** [Harish Garg](https://apify.com/hgservices) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.60 / 1,000 live messages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Douyin Live Chat Scraper — Record Live Stream Comments (抖音直播弹幕)

Record the **live chat of Douyin (抖音) live streams** in real time. Paste a live link or a creator's profile link, choose how long to record, and get **every chat comment (直播弹幕) with the viewer's name, `sec_uid` and time**. You can also save **likes, viewers who join, new follows and the room's viewer count** over time.

No Douyin account, no login, no cookies and no coding. Record several live rooms at the same time. Export the comments to **JSON, CSV, Excel or HTML**, connect them to your app through the **Apify API**, or ask an AI assistant such as **Claude** or **ChatGPT** to record a stream for you.

### What does the Douyin Live Chat Scraper do?

- 💬 **Real-time live chat recording.** Every comment that viewers type in the live room (直播间评论), as it happens.
- 👤 **Who said it.** The viewer's name, `sec_uid` (profile link) and public Douyin ID (抖音号) for each message.
- ❤️ **More than chat, if you want it.** Like taps with the room's like total, viewers who join, new follows with the streamer's follower count, and viewer counts every few seconds.
- 📺 **Several rooms at once.** The Actor records all the rooms in your list at the same time.
- ⏱️ **You choose the length.** Record from 1 minute to 4 hours. The recording stops by itself when the stream ends.
- 🔗 **Live links or profile links.** A profile link finds the creator's current live room.
- 📥 **Data while you wait.** New messages go into the dataset every few seconds, so you can read them before the recording ends.
- ✅ **Clear errors.** A creator who is not live, a video link or a link from another site gets a row that tells you what is wrong.

### What data can you extract from Douyin live chat?

Each row in the dataset is one live message. The room fields are on every row. The other fields depend on the message type.

| Field | Message types | Description |
|------|------|-------------|
| `sourceInput` | all | The input value exactly as you gave it |
| `webRid` | all | The room ID, the number in `live.douyin.com/<webRid>` |
| `roomId` | all | Douyin's ID of this live session |
| `liveUrl` | all | Link to the live room |
| `roomTitle` | all | Title of the live room when the recording started |
| `streamerName` | all | Display name of the streamer |
| `type` | all | `chat`, `like`, `member` (viewer joined), `follow` or `viewers` |
| `messageId` | all | Douyin's ID of the message |
| `time` | all | When the message was sent (ISO 8601, UTC). For likes, joins and follows, this is the receive time. |
| `receivedAt` | all | When the Actor received the message (ISO 8601, UTC) |
| `userName` | chat, like, member, follow | Display name of the viewer |
| `userSecUid` | chat, like, member, follow | The viewer's `sec_uid`. Open `https://www.douyin.com/user/<sec_uid>` to see the profile. |
| `userDouyinId` | chat, like, member, follow | The viewer's public Douyin ID (抖音号) |
| `content` | chat | Text of the chat comment |
| `likeCount` | like | Likes in this tap burst |
| `totalLikes` | like | Total likes of the live session so far |
| `followerCount` | follow | The streamer's follower count after the follow |
| `viewersNow` | viewers | Viewers online now |
| `totalViewers` | viewers | All viewers of the live session so far |
| `totalViewersText` | viewers | Douyin's rounded text for total viewers, for example `10万+` |
| `error` | error rows only | Why the Actor did not record this input |

### Input

| Field | Required | Default | Description |
|------|------|------|-------------|
| `liveUrls` | Yes | — | A list of the live rooms to record. The rooms must be live when the run starts. |
| `messageTypes` | No | `["chat"]` | The message types to save: `chat`, `like`, `member`, `follow`, `viewers`. |
| `durationMinutes` | No | `10` | How long to record each room, from 1 to 240 minutes. |

`liveUrls` accepts these formats:

- a live link: `https://live.douyin.com/905562644497`
- the room ID at the end of a live link: `905562644497`
- a creator profile link: `https://www.douyin.com/user/MS4wLjABAAAA...`
- a `v.douyin.com` share link from the Douyin app

If two inputs point to the same room, the Actor records the room one time.

#### Input example

```json
{
    "liveUrls": [
        "https://live.douyin.com/905562644497",
        "https://www.douyin.com/user/MS4wLjABAAAAKOi-BaFkm6OLjBN3m2NvsWKnwB-DFa5DakSGR18k8lhUzuep_6ZOYpp6L13Tft7H"
    ],
    "messageTypes": ["chat", "follow", "viewers"],
    "durationMinutes": 30
}
```

### Output example

A chat comment:

```json
{
    "sourceInput": "https://live.douyin.com/905562644497",
    "webRid": "905562644497",
    "roomId": "7695939745064045338",
    "liveUrl": "https://live.douyin.com/905562644497",
    "roomTitle": "很讨厌我吗",
    "streamerName": "崽崽（世一带土）",
    "type": "chat",
    "messageId": "7695951565064237106",
    "time": "2026-10-13T01:02:36+00:00",
    "userName": "艾利",
    "userSecUid": "MS4wLjABAAAAKOi-BaFkm6OLjBN3m2NvsWKnwB-DFa5DakSGR18k8lhUzuep_6ZOYpp6L13Tft7H",
    "userDouyinId": "59885714471",
    "content": "@灰水 小伙爱点评",
    "receivedAt": "2026-10-13T01:02:40+00:00"
}
```

The rows for the other message types have the same room fields. These examples show only the fields that change.

A like:

```json
{
    "type": "like",
    "time": "2026-10-13T01:03:12+00:00",
    "userName": "艾利",
    "userSecUid": "MS4wLjABAAAAKOi-BaFkm6OLjBN3m2NvsWKnwB-DFa5DakSGR18k8lhUzuep_6ZOYpp6L13Tft7H",
    "userDouyinId": "59885714471",
    "likeCount": 3,
    "totalLikes": 22419
}
```

A follow:

```json
{
    "type": "follow",
    "time": "2026-10-13T01:04:05+00:00",
    "userName": "艾利",
    "userSecUid": "MS4wLjABAAAAKOi-BaFkm6OLjBN3m2NvsWKnwB-DFa5DakSGR18k8lhUzuep_6ZOYpp6L13Tft7H",
    "userDouyinId": "59885714471",
    "followerCount": 170192
}
```

A viewer count:

```json
{
    "type": "viewers",
    "time": "2026-10-13T01:02:34+00:00",
    "viewersNow": 1739,
    "totalViewers": 224077,
    "totalViewersText": "10万+"
}
```

An input that the Actor could not record:

```json
{
    "sourceInput": "855061693523",
    "webRid": "855061693523",
    "streamerName": "小林同学",
    "error": "This room or creator is not live now, so there is no chat to record. Run it again during a live stream."
}
```

### How to use the Douyin Live Chat Scraper

You can run the Actor in four ways: in Apify Console, through the Apify API, with the Apify API clients for JavaScript and Python, or from an AI assistant through the Apify MCP server.

#### In Apify Console (no code)

1. Open the Actor and click **Try for free**. Sign in to Apify, or make a free account.
2. Paste one or more live links, room IDs or profile links into **Live links, room IDs or profile links**. The rooms must be live.
3. Select the **Message types**. The default is chat comments only.
4. Set the **Recording time (minutes)**. The default is 10.
5. Click **Start**.
6. Open the **Output** tab to see the messages while the recording runs.
7. When the run ends, click **Export** to download the data as JSON, CSV, Excel, XML or HTML.

To record a creator every day, save your input as a **task** and add a **schedule** to it.

For long recordings, make sure that the run timeout is longer than the recording time. You can set it in **Run options → Timeout** before you click **Start**.

#### With the Apify API (HTTP)

Get your API token from **Settings → API & Integrations** in Apify Console. Replace `YOUR_API_TOKEN` in the examples with your token.

**Short recordings (up to 4 minutes).** This request starts the run, waits for it to end and gives you the messages in one response. A request of this type can wait for a maximum of 300 seconds.

```bash
curl -X POST "https://api.apify.com/v2/acts/hgservices~douyin-live-chat-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "liveUrls": ["https://live.douyin.com/905562644497"],
    "messageTypes": ["chat"],
    "durationMinutes": 3
  }'
```

**Longer recordings.** Start the run. The response gives you the run ID (`data.id`) and the dataset ID (`data.defaultDatasetId`).

```bash
curl -X POST "https://api.apify.com/v2/acts/hgservices~douyin-live-chat-scraper/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "liveUrls": ["https://live.douyin.com/905562644497"],
    "messageTypes": ["chat", "viewers"],
    "durationMinutes": 60
  }'
```

Check the run status. The `status` field changes to `SUCCEEDED` when the recording is done.

```bash
curl "https://api.apify.com/v2/actor-runs/RUN_ID?token=YOUR_API_TOKEN"
```

Get the messages. You can do this during the run and after it. Change `format` to `csv`, `xlsx` or `html` to get a different file type.

```bash
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?format=json&token=YOUR_API_TOKEN"
```

To get a message when the recording is done, add a **webhook** on the Actor's **Integrations** tab.

#### With the JavaScript / Node.js client

Install the client:

```bash
npm install apify-client
```

Record 10 minutes of chat and print each comment:

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('hgservices/douyin-live-chat-scraper').call({
    liveUrls: ['https://live.douyin.com/905562644497'],
    messageTypes: ['chat'],
    durationMinutes: 10,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) {
    if (item.error) {
        console.log(`${item.sourceInput}: ${item.error}`);
    } else {
        console.log(item.time, item.userName, item.content);
    }
}
```

#### With the Python client

Install the client:

```bash
pip install apify-client
```

Record 10 minutes of chat and print each comment:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")

run = client.actor("hgservices/douyin-live-chat-scraper").call(run_input={
    "liveUrls": ["https://live.douyin.com/905562644497"],
    "messageTypes": ["chat"],
    "durationMinutes": 10,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item.get("error"):
        print(f'{item["sourceInput"]}: {item["error"]}')
    else:
        print(item["time"], item.get("userName"), item.get("content"))
```

The `call()` method waits until the recording is done. The **API** tab on the Actor page has more examples.

#### With Claude, ChatGPT and other AI assistants (MCP)

The Actor is available through the **Apify MCP server**. Connect the server to your AI assistant one time. Then ask for a recording in plain language.

Use this server URL. It gives your assistant access to this Actor:

```text
https://mcp.apify.com?tools=hgservices/douyin-live-chat-scraper
```

**Claude (claude.ai and Claude Desktop)**

1. Open **Settings → Connectors**.
2. Click **Add custom connector**.
3. Paste the server URL above.
4. Sign in to Apify when Claude asks you to.

**Claude Code**

Run this command, then type `/mcp` in Claude Code to sign in to Apify:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=hgservices/douyin-live-chat-scraper"
```

**ChatGPT**

1. Open **Settings → Apps & Connectors**.
2. Turn on **Developer mode** in the advanced settings.
3. Create a connector with the server URL above.
4. Sign in to Apify when ChatGPT asks you to.

**Cursor, VS Code, Windsurf and other MCP clients**

Add the server URL above as a remote MCP server in your client's settings. You can also use the configurator at [mcp.apify.com](https://mcp.apify.com) to make the settings for your client.

**Example prompts**

- *"Record 5 minutes of chat from https://live.douyin.com/905562644497 and tell me what the viewers talk about."*
- *"Record the chat and viewer counts of this creator for 10 minutes: https://www.douyin.com/user/MS4wLjABAAAA... Then show how the viewer count changed."*
- *"Record 5 minutes of chat from these two live rooms and list the 10 most active viewers in each room."*

### Integrations

Send the live chat data to the tools you already use with Apify integrations: **Google Sheets, Google Drive, Slack, Make, Zapier, n8n, Airbyte, GitHub** and webhooks.

To record creators when they go live, use the [Douyin Live Scraper](https://apify.com/hgservices/douyin-live-room-scraper) on a schedule to check their live status. Then start this Actor for the creators who are live.

### Use cases

- **Live commerce research (直播带货).** Read what viewers ask about products and prices during live shopping streams.
- **Audience and sentiment analysis.** Collect real-time comments for NLP, topic and sentiment models.
- **Streamer analytics.** Measure chat activity, joins, follows and viewer counts during a stream.
- **Brand monitoring.** Record what viewers say when a brand or product appears in a stream.
- **Competitor research.** Compare the audience activity of competing streamers and brands.
- **Academic and moderation research.** Study chat behavior in large Chinese live rooms.

### Tips for the best results

- **Start the run while the creator is live.** A room that is not live gets an error row. Use the [Douyin Live Scraper](https://apify.com/hgservices/douyin-live-room-scraper) to check first.
- **Select only the types you need.** In a big room, likes, joins and viewer counts can be many times more rows than chat.
- **Big rooms are busy.** A room with 20,000 or more viewers can send several chat messages each second.
- **Record a full show.** Set a long recording time. The Actor stops by itself when the stream ends.

### FAQ

**Does it record gifts?**
No. Douyin does not show gift messages to viewers who are not logged in, so gifts are not available.

**Can I record a stream that has already ended?**
No. Douyin does not keep the chat of past streams. Record the room while it is live.

**Do I need a Douyin account?**
No. The Actor works without an account, a password or cookies.

**How long can one recording be?**
Up to 240 minutes (4 hours) for each run. For a longer stream, start a second run.

**Why did I get a row that says no messages arrived?**
The room was live, but nobody sent a message of the selected types during the recording. Record longer, or select more message types.

**Can I record TikTok LIVE with this Actor?**
No. This Actor works with Douyin, the Chinese version of TikTok, only.

### Other Douyin scrapers

- [Douyin Live Scraper](https://apify.com/hgservices/douyin-live-room-scraper) — check if creators are live, with viewers, likes and stream links.
- [Douyin Trending Live Rooms Scraper](https://apify.com/hgservices/douyin-trending-live-rooms-scraper) — find the most popular live rooms now.
- [Douyin Danmaku Scraper](https://apify.com/hgservices/douyin-danmaku-scraper) — get the bullet comments (弹幕) of Douyin videos.
- [Douyin Comments Scraper](https://apify.com/hgservices/douyin-comments-scraper) — get the comments under Douyin videos.
- [Douyin Hot Search Scraper](https://apify.com/hgservices/douyin-hot-search-scraper) — get Douyin's trending topics and hot lists.

### Is it legal to scrape Douyin live chat?

This Actor collects only **publicly available** data that any viewer of the live room can see. You are responsible for how you use the data. Obey Douyin's terms of service and the laws that apply to you, such as GDPR. Chat messages can contain personal data, so process them lawfully.

### Feedback and support

Did you find a problem, or do you need a new field? Open an issue on the **Issues** tab.

# Actor input Schema

## `liveUrls` (type: `array`):

Douyin live links (https://live.douyin.com/905562644497), the number at the end of a live link, creator profile links (https://www.douyin.com/user/MS4wLjABAAAA...) or v.douyin.com share links. The room must be live when the run starts. All rooms are recorded at the same time.

## `messageTypes` (type: `array`):

Which live messages to save. Chat = the comments viewers type. Likes = like taps (with the room's like total). Joins = viewers who enter the room. Follows = viewers who follow the streamer during the stream. Viewer counts = the room's online viewer count, sent every few seconds.

## `durationMinutes` (type: `integer`):

How long to record each room. The recording stops earlier when the live stream ends.

## Actor input object example

```json
{
  "liveUrls": [
    "https://live.douyin.com/905562644497"
  ],
  "messageTypes": [
    "chat"
  ],
  "durationMinutes": 10
}
```

# Actor output Schema

## `messages` (type: `string`):

One item per message: room (ID, link, title, streamer), message type (chat, like, member, follow, viewers), message ID, time, user (name, sec_uid, Douyin ID), chat text, like count and room like total, follower count, viewer counts, and the time the Actor received it.

# 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 = {
    "liveUrls": [
        "https://live.douyin.com/905562644497"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hgservices/douyin-live-chat-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 = { "liveUrls": ["https://live.douyin.com/905562644497"] }

# Run the Actor and wait for it to finish
run = client.actor("hgservices/douyin-live-chat-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 '{
  "liveUrls": [
    "https://live.douyin.com/905562644497"
  ]
}' |
apify call hgservices/douyin-live-chat-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hgservices/douyin-live-chat-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/n4PzWNB68DR14Y6Jc/builds/hd31yEOwB7LwwzCW5/openapi.json
