# Douyin Video & Comment Scraper (`axlymxp/douyin-video-scraper`) Actor

Scrape Douyin (抖音) videos by URL or ID: description, author, likes, comments, shares, collects, music, hashtags, cover and playable video URL, duration — plus optional comments and related videos. No login required. Pay only for results.

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

## Pricing

from $5.00 / 1,000 dataset items

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

## Douyin Video & Comment Scraper (抖音)

Get clean, structured data for any **Douyin video** from its URL or ID — the
description, the creator, full engagement stats, the music, hashtags, the cover
image and a direct video URL, plus **optional comments and related videos**. No
Douyin account, no app, no manual copy-paste.

Douyin is China's TikTok (ByteDance), with ~750M daily users. Its data is hard to
reach from outside the app and its API is request-signed. This actor signs
requests itself in pure Python and, whenever Douyin's edge rejects that, retries
the same call from inside a stealth browser that runs Douyin's own signer — so
you get reliable structured JSON without paying for a browser on every request.

### Who it's for

- **Brand & agency teams** — pull competitor videos, engagement, and hashtags.
- **Creators & MCN analysts** — benchmark performance across videos.
- **Researchers & trend analysts** — study Chinese short-video content at scale.
- **Data teams / AI apps** — feed structured Douyin video data into pipelines.

### Output fields

| Field | Description |
|---|---|
| `aweme_id` | Video ID |
| `desc` | Caption / description |
| `create_time` | Publish time (unix seconds) |
| `duration_ms` | Video length in milliseconds |
| `url` | Canonical Douyin video URL |
| `author` | `{ uid, sec_uid, unique_id, nickname }` |
| `stats` | `{ digg_count, comment_count, share_count, collect_count, play_count }` |
| `music` | `{ id, title, author }` |
| `hashtags` | List of hashtag names |
| `cover` | Cover image URL |
| `play_url` | Direct video URL |
| `width` / `height` | Video dimensions |
| `images` | Image list for photo/note posts |
| `comments` | (optional) top-level comments: text, likes, reply count, user, location |
| `relatedVideos` | (optional) videos Douyin recommends alongside this one |

### Input

| Field | Type | Notes |
|---|---|---|
| `videoUrls` | array | Video/note URLs or share links |
| `videoIds` | array | Bare numeric aweme IDs |
| `includeComments` | bool | Attach top-level comments |
| `maxCommentsPerVideo` | int | Cap comments per video (default 50) |
| `includeRelated` | bool | Attach related videos |
| `maxRelated` | int | Cap related per video (default 10) |
| `maxItems` | int | Cap total videos |
| `transport` | enum | `auto` (default: Python first, browser fallback), `python`, `browser` |
| `proxyConfiguration` | proxy | **Residential proxy recommended** |

### Example input

```json
{
  "videoUrls": [{ "url": "https://www.douyin.com/video/7682817863706627391" }],
  "includeComments": true,
  "maxCommentsPerVideo": 20,
  "includeRelated": true,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### Example output (abridged)

```json
{
  "aweme_id": "7682817863706627391",
  "desc": "特工夫妻深陷柏林死局… #柏林 #电影解说",
  "author": { "nickname": "心影说", "sec_uid": "MS4wLjABAA..." },
  "stats": { "digg_count": 8019, "comment_count": 79, "share_count": 634, "collect_count": 2720 },
  "duration_ms": 1041510,
  "hashtags": ["柏林", "电影解说"],
  "cover": "https://p3-pc-sign.douyinpic.com/...",
  "comments": [ { "text": "柏林谍变", "digg_count": 3, "ip_label": "天津" } ]
}
```

### Scheduling & webhooks

Schedule the actor to re-scrape a set of videos and track engagement over time, or
attach a webhook to push each run's rows into your database or Google Sheet.

### Use with AI / MCP

Output is clean JSON — ideal as a tool for an AI agent analyzing Douyin content.
Call the actor from the Apify MCP server or point your assistant at its dataset.

### FAQ

**Do I need a Douyin login?** No. The actor scrapes public video data with its own
anonymous, signed session.

**Why a residential proxy?** Douyin's edge is IP-sensitive; a residential proxy
makes detail + comment fetching reliable. Datacenter IPs are often soft-blocked.

**What does `transport` do?** Leave it on `auto`. Requests are signed in pure
Python (fast, cheap); if Douyin's edge rejects a request, the actor starts a
stealth browser and repeats it there. `python` never starts a browser (cheapest,
but intermittently blocked); `browser` uses the browser for everything (slowest,
most robust). The actor also solves Douyin's proof-of-work interstitial itself.

**Which URLs work?** `www.douyin.com/video/<id>`, `/note/<id>`, `?modal_id=<id>`,
and share links (`v.douyin.com/...`, `iesdouyin.com/share/video/...`).

**Keyword search?** Douyin's web search is login-walled, so this actor works by
video URL/ID. Use the Douyin Hot Search Tracker for trending terms.

**Is this legal?** The actor reads publicly visible video data. You are responsible
for using the output in line with Douyin's terms and your local laws.

# Actor input Schema

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

Douyin video/note URLs or share links (www.douyin.com/video/..., /note/..., ?modal\_id=..., v.douyin.com/xxx, iesdouyin.com/share/video/...).

## `videoIds` (type: `array`):

Bare numeric aweme IDs (alternative to URLs).

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

Fetch top-level comments for each video (adds a `comments` array to each row).

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

Cap on comments fetched per video when 'Include comments' is on.

## `includeRelated` (type: `boolean`):

Attach a list of videos Douyin recommends alongside each video.

## `maxRelated` (type: `integer`):

Cap on related videos attached per video when 'Include related' is on.

## `maxItems` (type: `integer`):

Optional cap on the total number of videos scraped.

## `transport` (type: `string`):

How requests are signed. <b>auto</b> (recommended): fast pure-Python signing first, falling back to a stealth browser whenever Douyin's edge rejects a request. <b>python</b>: never start a browser (cheapest, but Douyin intermittently blocks it). <b>browser</b>: browser only (slowest, most robust).

## `proxyConfiguration` (type: `object`):

Proxy settings. A residential proxy is strongly recommended for reliable Douyin access.

## Actor input object example

```json
{
  "videoUrls": [
    {
      "url": "https://www.douyin.com/video/7682817863706627391"
    }
  ],
  "videoIds": [
    "7682817863706627391"
  ],
  "includeComments": false,
  "maxCommentsPerVideo": 50,
  "includeRelated": false,
  "maxRelated": 10,
  "maxItems": 100,
  "transport": "auto",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `videos` (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 = {
    "videoUrls": [
        {
            "url": "https://www.douyin.com/video/7682817863706627391"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("axlymxp/douyin-video-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 = { "videoUrls": [{ "url": "https://www.douyin.com/video/7682817863706627391" }] }

# Run the Actor and wait for it to finish
run = client.actor("axlymxp/douyin-video-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 '{
  "videoUrls": [
    {
      "url": "https://www.douyin.com/video/7682817863706627391"
    }
  ]
}' |
apify call axlymxp/douyin-video-scraper --silent --output-dataset

```

## MCP server setup

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