# Douyin Scraper (`coregent/douyin-scraper`) Actor

Scrape Douyin (抖音) videos by keyword, creator, hashtag or URL: likes, comments, shares, music, hashtags and IP region, plus optional creator details, play counts and comments. No login or cookies.

- **URL**: https://apify.com/coregent/douyin-scraper.md
- **Developed by:** [Delowar Munna](https://apify.com/coregent) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 1 monthly users, 96.8% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 video results

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 Scraper

![Douyin Scraper](https://raw.githubusercontent.com/coregentdevspace/douyin-scraper-assets/main/thumbnail-douyin-scraper.png)

Scrape public **Douyin (抖音)** videos by **keyword, creator, hashtag or video URL**, all into one dataset with one
schema. Every video row has likes, comments, shares, saves, downloads, hashtags, mentions, music, the IP region
Douyin shows for the post (not on hashtag-feed videos), and the creator's name, Douyin ID and profile link.

Optional extras, each off by default and charged only when you turn it on:

- **Creator details**: followers, following, total likes, post count, bio, IP region and verification.
- **Play counts**: view counts. Douyin hides these in most listings, so this is an extra lookup per video.
- **Comments**: top-level comments per video, as separate rows.

No Douyin account, login, cookies or browser needed.

### What you can scrape

| Input | Example | What you get |
|---|---|---|
| **Keywords** | `咖啡`, `露营`, `iPhone` | Search results, with sort (relevance, most liked, newest), publish-time and length filters |
| **Creators** | `https://www.douyin.com/user/MS4wLjABAAAA…`, a `sec_uid`, or a Douyin ID (抖音号) | The creator's posts, newest first, with an optional oldest-date cutoff and pinned-post skip |
| **Hashtags** | `露营` or `#露营`, or `https://www.douyin.com/hashtag/<id>` | Videos from the hashtag's feed |
| **Video URLs** | `https://www.douyin.com/video/<id>`, `https://v.douyin.com/…` share links, share text, or video IDs | One row per video |

Mix them freely in one run. A video found by several sources is delivered (and charged) once. One run takes up
to 100 keywords, 100 creators, 100 hashtags and 1,000 video URLs; split bigger lists across runs.

### How many results

**Max videos (whole run)** is the total for the run, split evenly across your sources unless you set **Max videos
per source**. Comments don't count toward it.

Run it with no input and it does a short demo: a 咖啡 search with 10 videos.

### Input examples

**Search, most liked in the last week**

```json
{
    "keywords": ["咖啡"],
    "sortBy": "most_liked",
    "publishedWithin": "week",
    "maxResults": 50
}
```

**Creators since a date, with their profile details**

```json
{
    "creators": ["https://www.douyin.com/user/MS4wLjABAAAAz1lOStxwzCZF5cJ3h8Sa2FPQ_8_l_vQdpdKEm1oEF_k"],
    "oldestPostDate": "30 days",
    "skipPinned": true,
    "includeCreatorDetails": true,
    "maxResults": 100
}
```

**Hashtag with play counts**

```json
{
    "hashtags": ["露营"],
    "includePlayCounts": true,
    "maxResults": 100
}
```

**Keyword and hashtag together, with every extra** (the input behind the screenshots and sample rows below)

```json
{
    "keywords": ["咖啡"],
    "hashtags": ["露营"],
    "videoUrls": ["https://www.douyin.com/video/7000000000000000000"],
    "maxResults": 10,
    "maxResultsPerSource": 5,
    "includeCreatorDetails": true,
    "includePlayCounts": true,
    "includeComments": true,
    "maxCommentsPerVideo": 1
}
```

The video ID in it doesn't exist, which shows how an unavailable video becomes a free error row.

**Comments on specific videos**

```json
{
    "videoUrls": ["https://www.douyin.com/video/7553178216526073134"],
    "includeComments": true,
    "maxCommentsPerVideo": 100
}
```

### Output

Each row has a `recordType`: `video`, `comment` or `error`. The Console shows them in tabs: **Videos**, **Hashtags &
music**, **Creators**, **Comments** and **Errors**.

#### Videos

![Videos tab](https://raw.githubusercontent.com/coregentdevspace/douyin-scraper-assets/main/douyin-scraper-output-videos-table-view.png)

#### Hashtags & music

![Hashtags & music tab](https://raw.githubusercontent.com/coregentdevspace/douyin-scraper-assets/main/douyin-scraper-output-hashtags-n-music-table-view.png)

#### Creators

![Creators tab](https://raw.githubusercontent.com/coregentdevspace/douyin-scraper-assets/main/douyin-scraper-output-creators-table-view.png)

#### Sample rows

From the run above. The media links are shortened; they are signed links that expire.

**Video row**, with creator details and play counts on. The Videos, Hashtags & music and Creators tabs all show
fields from this row:

```json
{
    "recordType": "video",
    "videoId": "7553178216526073134",
    "videoUrl": "https://www.douyin.com/video/7553178216526073134",
    "type": "video",
    "description": "咖啡到底健不健康？每天喝是“续命”还是“伤身”？ #咖啡的好处 #咖啡日常 #喝咖啡主打一个养生 #长期喝咖啡对身体的影响 #咖啡不断加加加加到厌倦",
    "title": "咖啡到底健不健康？每天喝是“续命”还是“伤身”？",
    "createdAt": "2025-09-23T10:00:00.000Z",
    "durationSeconds": 219,
    "ipRegion": "北京",
    "hashtags": ["咖啡的好处", "咖啡日常", "喝咖啡主打一个养生", "长期喝咖啡对身体的影响", "咖啡不断加加加加到厌倦"],
    "mentions": [],
    "likeCount": 75810,
    "commentCount": 6268,
    "shareCount": 49632,
    "collectCount": 21436,
    "downloadCount": 2098,
    "playCount": 4778716,
    "isPinned": false,
    "coverUrl": "https://p11-sign.douyinpic.com/tos-cn-p-0015/…",
    "videoPlayUrl": "https://v3-search.douyinvod.com/…",
    "imageUrls": [],
    "musicId": "7553178297912478510",
    "musicTitle": "@薄世宁医生创作的原声",
    "musicAuthor": "薄世宁医生",
    "musicIsOriginal": false,
    "authorId": "61238059783",
    "authorSecUid": "MS4wLjABAAAAz1lOStxwzCZF5cJ3h8Sa2FPQ_8_l_vQdpdKEm1oEF_k",
    "authorDouyinId": "boshining",
    "authorNickname": "薄世宁医生",
    "authorProfileUrl": "https://www.douyin.com/user/MS4wLjABAAAAz1lOStxwzCZF5cJ3h8Sa2FPQ_8_l_vQdpdKEm1oEF_k",
    "author": {
        "id": "61238059783",
        "secUid": "MS4wLjABAAAAz1lOStxwzCZF5cJ3h8Sa2FPQ_8_l_vQdpdKEm1oEF_k",
        "douyinId": "boshining",
        "nickname": "薄世宁医生",
        "bio": "工作在临床一线第25年的ICU医生；…",
        "followerCount": 6555377,
        "followingCount": 198,
        "totalLikes": 64675473,
        "postCount": 299,
        "ipRegion": "北京",
        "verified": false,
        "verificationText": null,
        "avatarUrl": "https://p3.douyinpic.com/aweme/1080x1080/aweme-avatar/…",
        "profileUrl": "https://www.douyin.com/user/MS4wLjABAAAAz1lOStxwzCZF5cJ3h8Sa2FPQ_8_l_vQdpdKEm1oEF_k"
    },
    "source": { "type": "keyword", "value": "咖啡", "position": 1 },
    "scrapedAt": "2026-11-06T02:54:17.778Z"
}
```

Without **Include play counts**, `playCount` is `null`; without **Include creator details**, `author` is `null`.

**Comment row** (Comments tab):

```json
{
    "recordType": "comment",
    "commentId": "7645931630120960805",
    "videoId": "7553178216526073134",
    "videoUrl": "https://www.douyin.com/video/7553178216526073134",
    "text": "@抖音求真 总结一下",
    "createdAt": "2026-05-31T05:59:43.000Z",
    "likeCount": 125,
    "replyCount": 6,
    "ipRegion": "天津",
    "isLikedByAuthor": false,
    "authorId": "53273686090",
    "authorSecUid": "MS4wLjABAAAARRDvBTfseex0HV4cWhO8ONOscFQ_SBpdxdeDql2fuI0",
    "authorNickname": "玩心大潮玩",
    "authorDouyinId": "740lll886",
    "authorProfileUrl": "https://www.douyin.com/user/MS4wLjABAAAARRDvBTfseex0HV4cWhO8ONOscFQ_SBpdxdeDql2fuI0",
    "scrapedAt": "2026-11-06T02:54:37.872Z"
}
```

**Error row** (Errors tab):

```json
{
    "recordType": "error",
    "errorCode": "deleted-or-unavailable",
    "errorMessage": "Douyin returned no video (reason 8: deleted-or-unavailable).",
    "sourceType": "video",
    "input": "https://www.douyin.com/video/7000000000000000000",
    "scrapedAt": "2026-11-06T02:54:16.117Z"
}
```

Error codes: `invalid-input`, `no-results`, `video-not-found`, `deleted-or-unavailable`, `private`,
`partially-visible`, `creator-not-found`, `hashtag-not-found` and `source-failed`. Error rows are never charged.

A run summary (counts, what stopped the run, and what was charged) is saved as `RUN_SUMMARY` in the run's key-value
store.

### Pricing

Pay per event: you pay for each video delivered, plus each extra you turn on (creator details once per creator per
run, play counts per video, comments per comment). Error rows, duplicates and skipped videos are free, and there is
no start fee. See the **Pricing** tab for current rates. This README deliberately doesn't quote figures.

If you set a spending limit on a run, the Actor stops when it is reached and keeps everything already paid for.

### FAQ

**Why is `playCount` empty?**
Douyin no longer shows view counts in search, creator or hashtag listings. Turn on **Include play counts** to fill it.
Without it the field is `null`, never a misleading 0.

**What is a `sec_uid`?**
Douyin's stable creator ID, the long `MS4wLjAB…` part of a profile URL. A Douyin ID (抖音号) can change, the
`sec_uid` doesn't. Creator inputs work best as profile URLs.

**Why is `ipRegion` empty on some videos?**
Douyin's hashtag feed doesn't include the post's IP region, so hashtag videos have `ipRegion: null`. Keyword, creator
and video-URL results include it.

**Why doesn't `followerCount` appear without creator details?**
Douyin's video data doesn't include the creator's real follower count, so it takes a profile lookup.

**Do the media links last?**
`coverUrl`, `videoPlayUrl` and `imageUrls` are signed Douyin CDN links that expire after a while. Download what you
need soon after the run.

**Does it get transcripts?**
No. Douyin videos carry no caption track this Actor can read.

**Why are comments slow?**
Douyin serves comments about 20 at a time, and each page takes several seconds or more. Keep **Max comments per
video** to what you need.

### Data and privacy

This Actor collects only what Douyin shows publicly to any visitor: no private accounts, messages, phone numbers or
email addresses. Some fields are personal data (creator and commenter names, IP region). You are responsible for
having a lawful basis to process them and for following the laws that apply to you, including China's Personal
Information Protection Law (PIPL), the GDPR where relevant, and Douyin's terms.

This Actor is not affiliated with, endorsed by or sponsored by Douyin or ByteDance.

# Actor input Schema

## `keywords` (type: `array`):

Search Douyin for these terms, in Chinese or English (e.g. 咖啡, 露营, iPhone). Each keyword is one source. If you give no keyword, creator, hashtag or video URL at all, the Actor runs a short demo search for 咖啡. Up to 100 per run.

## `creators` (type: `array`):

Creator profile URLs (https://www.douyin.com/user/MS4wLjAB…), sec_uid values, or Douyin IDs (抖音号). A profile URL is the most reliable; a Douyin ID needs an extra search to find the creator. Up to 100 per run.

## `hashtags` (type: `array`):

Hashtag names, with or without # (e.g. 露营), or hashtag URLs (https://www.douyin.com/hashtag/<id>). Up to 100 per run.

## `videoUrls` (type: `array`):

Video URLs (https://www.douyin.com/video/<id>), short share links (https://v.douyin.com/…), share text containing such a link, or video IDs. Up to 1,000 per run.

## `maxResults` (type: `integer`):

The total number of video rows for the whole run, across all sources. Split evenly across sources unless you set a per-source limit. Comments do not count toward this limit.

## `maxResultsPerSource` (type: `integer`):

Optional. The most videos from any one keyword, creator or hashtag. Leave empty to split the run's limit evenly across sources.

## `sortBy` (type: `string`):

How keyword search results are ordered.

## `publishedWithin` (type: `string`):

Only keyword results published within this period.

## `duration` (type: `string`):

Only keyword results of this length.

## `oldestPostDate` (type: `string`):

Stop reading a creator's posts at the first one older than this. A date (YYYY-MM-DD) or a period such as "30 days" or "2 weeks".

## `skipPinned` (type: `boolean`):

Leave out posts the creator pinned to the top of their profile.

## `includeCreatorDetails` (type: `boolean`):

Add each creator's profile to their videos: followers, following, total likes, post count, bio, IP region and verification. Fetched and charged once per creator per run. Without it, video rows still carry the creator's name, Douyin ID and profile URL.

## `includePlayCounts` (type: `boolean`):

Fill playCount (views). Douyin hides view counts in most listings, so this is an extra lookup per video. Without it, playCount is empty (null), never 0.

## `includeComments` (type: `boolean`):

Add top-level comments for each video as separate rows (recordType "comment"). Comments are slow to load: allow about 20 seconds per 20 comments.

## `maxCommentsPerVideo` (type: `integer`):

With "Include comments" on: the most comments per video.

## `skipVideoIds` (type: `array`):

Video IDs or URLs to leave out, for example the ones a previous run already collected.

## `deduplicate` (type: `boolean`):

Deliver (and charge) a video only once, even when several keywords, creators or hashtags return it.

## Actor input object example

```json
{
  "keywords": [
    "咖啡"
  ],
  "creators": [],
  "hashtags": [],
  "videoUrls": [],
  "maxResults": 10,
  "sortBy": "relevance",
  "publishedWithin": "any",
  "duration": "any",
  "skipPinned": false,
  "includeCreatorDetails": false,
  "includePlayCounts": false,
  "includeComments": false,
  "maxCommentsPerVideo": 20,
  "skipVideoIds": [],
  "deduplicate": true
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `content` (type: `string`):

No description

## `creators` (type: `string`):

No description

## `comments` (type: `string`):

No description

## `errors` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# 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 = {
    "keywords": [
        "咖啡"
    ],
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("coregent/douyin-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 = {
    "keywords": ["咖啡"],
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("coregent/douyin-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 '{
  "keywords": [
    "咖啡"
  ],
  "maxResults": 10
}' |
apify call coregent/douyin-scraper --silent --output-dataset

```

## MCP server setup

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