# Douyin Search Scraper (`automation-lab/douyin-search-scraper`) Actor

Search Douyin (抖音) by keyword and export unique videos and image posts with captions, hashtags, creator IDs, likes, comments, shares, saves, music and media URLs. No login, cookies or browser.

- **URL**: https://apify.com/automation-lab/douyin-search-scraper.md
- **Developed by:** [Automation Lab](https://apify.com/automation-lab) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 29 total users, 17 monthly users, 99.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.28 / 1,000 post saveds

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 Search Scraper

**Douyin Search Scraper** searches Douyin (抖音, the Chinese version of TikTok) by keyword and exports every unique video and image post it finds: caption, hashtags, publish time, likes, comments, shares, saves, creator IDs and handle, follower count, music, cover and media URLs.

Give it one or more keywords, set an optional publish window, video length and result limit, and get clean rows ready for spreadsheets, BI tools or AI pipelines. No Douyin account, cookies, browser or API key is needed.

### What does Douyin Search Scraper do?

The Actor reads Douyin's public web search (the same results a logged-out visitor sees on so.douyin.com, video tab) and turns each result into one structured row.

- 🔎 **Keyword search** — up to 50 keywords per run, in Chinese, English, brand names or hashtags.
- 🧹 **Cross-keyword deduplication** — a post found by several keywords is saved and charged once.
- 🏷️ **Query provenance** — every row records the keyword that found it, its position in that keyword's results and the filters used.
- 📅 **Incremental cutoff** — `publishedAfter` keeps only posts newer than a date or a relative window ("3 days"), for scheduled monitoring.
- ⏱️ **Filters** — publish window (24 hours, 7 days, 6 months), video length (under 1 min, 1–5 min, over 5 min) and post type (video or image).
- 🚩 **Honest missing-field flags** — `missingFields` names the key data and media fields Douyin did not provide (counts, caption, date, creator handle and followers, media URLs), instead of filling them with zeros.

### Who is it for?

- **Social-listening teams** tracking how Chinese consumers talk about a brand, product or competitor on Douyin.
- **Creative and content researchers** collecting top-performing hooks, captions, hashtags and sounds for a topic.
- **Influencer marketers** finding creators who post about a category and comparing their engagement and follower counts.
- **Market and trend analysts** measuring how much content a keyword attracts in the last day, week or half-year.
- **Data and AI teams** building datasets of Chinese short-video metadata for classification, RAG or trend models.

### Why use this Douyin scraper?

- **Works without login.** It uses Douyin's public guest search; you never hand over an account or cookie.
- **Cheap and light.** Plain HTTP requests, no headless browser, 512 MB of memory.
- **Monitoring-ready.** Deduplication, provenance and a publish cutoff make daily or hourly schedules produce only new, attributable rows.
- **Transparent.** A `RUN_SUMMARY` record shows per-keyword counts, how many posts were skipped as duplicates or by filters, why each keyword stopped, and which posts matched more than one keyword.

### What data can you extract from Douyin?

| Field | Description |
| --- | --- |
| `videoId`, `url`, `postType` | Post ID, public link (`/video/` or `/note/`), and "video" or "image" |
| `title`, `caption`, `hashtags`, `videoTags` | Title, full caption, hashtag names, Douyin category tags |
| `createdAt`, `createTimestamp` | Publish time (ISO 8601 and Unix seconds) |
| `durationSeconds` | Video length (null for image posts) |
| `likes`, `comments`, `shares`, `saves` | Public engagement counters |
| `plays` | Play count — Douyin hides it from guests, so normally null |
| `authorUid`, `authorSecUid`, `authorHandle`, `authorNickname` | Creator IDs, Douyin ID and display name |
| `authorFollowers`, `authorVerification`, `authorSignature`, `authorAvatarUrl`, `authorProfileUrl` | Creator follower count, verification label, bio, avatar and profile link |
| `musicId`, `musicTitle`, `musicAuthor`, `musicIsOriginal`, `musicPlayUrl` | Sound details |
| `coverUrl`, `videoPlayUrl`, `imageUrls`, `width`, `height` | Cover, MP4 stream URL, slide images and video size |
| `isAd` | Whether Douyin marks the post as an ad |
| `keyword`, `searchPosition`, `searchSort`, `searchPublishTime`, `searchDuration` | Provenance: which search found the row and with what settings |
| `missingFields` | Which key fields Douyin did not return for this post: caption, createdAt, likes, comments, shares, saves, plays, authorHandle, authorFollowers, musicPlayUrl, coverUrl, and for videos videoPlayUrl and durationSeconds. Other optional fields (for example title or verification) can be null without being listed. |
| `scrapedAt` | When the row was produced |

### How much does it cost to scrape Douyin search results?

The Actor uses pay-per-event pricing: a small fee per run plus a fee per saved post. Only unique posts that pass your filters are charged; duplicates and filtered-out posts are free.

| Event | Price (Free plan) | Price (Starter / Bronze) |
| --- | --- | --- |
| Run start | $0.005 | $0.005 |
| Post saved | $0.00437 | $0.0038 |

Higher Apify plans pay less per post (Silver $0.002964, Gold and above $0.00228).

Example costs on the Starter plan:

- 30 posts for one keyword: about **$0.12**
- 100 posts for each of 5 keywords (500 posts): about **$1.91**
- A daily schedule of 3 keywords × 50 new posts: about **$0.58 per day**

Apify's free plan includes monthly credit, which covers several hundred posts.

### How to scrape Douyin by keyword

1. Open **Douyin Search Scraper** in Apify Console.
2. Enter your **Search keywords**, for example `口红`, `咖啡` or `华为`.
3. Set **Maximum results per keyword** (default 100).
4. Optionally choose a **Published within** window, **Video length**, **Post type** or **Sort order**.
5. Click **Start** and download the results as JSON, CSV, Excel or HTML, or read them through the API.

### Input parameters

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `keywords` | array | — | 1–50 search terms (required) |
| `maxResultsPerQuery` | integer | 100 | Saved posts per keyword, 1–1000 |
| `sort` | string | `general` | `general` (Douyin ranking), `most_liked` or `latest` (re-ordered, see below) |
| `publishTime` | string | `unlimited` | `one_day`, `one_week`, `half_year` |
| `duration` | string | `unlimited` | `under_1m`, `one_to_five`, `over_5m` |
| `contentType` | string | `all` | `video` or `image` |
| `publishedAfter` | string | — | ISO date/datetime or relative window such as `7 days`, `24 hours` |
| `dedupeAcrossKeywords` | boolean | `true` | Save a post once even if several keywords find it |
| `proxyConfiguration` | object | none | Optional proxy for every request |

Example input:

```json
{
    "keywords": ["口红", "咖啡"],
    "maxResultsPerQuery": 50,
    "publishTime": "one_week",
    "dedupeAcrossKeywords": true
}
```

### Output example

```json
{
    "videoId": "7601448815485469681",
    "url": "https://www.douyin.com/video/7601448815485469681",
    "postType": "video",
    "title": "仅淡颜可见！🌷年度无代餐爱用口红*9️⃣！",
    "caption": "仅淡颜可见！🌷年度无代餐爱用口红*9️⃣！ #口红推荐 #淡颜天菜 #马年新妆新好物 #潮妆研究所 #韩系妆容",
    "hashtags": ["口红推荐", "淡颜天菜", "马年新妆新好物", "潮妆研究所", "韩系妆容"],
    "videoTags": ["时尚", "彩妆", "唇部彩妆"],
    "createdAt": "2026-01-31T09:03:41.000Z",
    "createTimestamp": 1769850221,
    "durationSeconds": 124.4,
    "likes": 5771,
    "comments": 35,
    "shares": 709,
    "saves": 3035,
    "plays": null,
    "authorUid": "69216402115",
    "authorSecUid": "MS4wLjABAAAAiOZqiyWty2-opX8on4l4dXchStMGRnIfyzmPk81YWL8",
    "authorHandle": "Keke48995",
    "authorNickname": "整颗银",
    "authorFollowers": 372726,
    "authorProfileUrl": "https://www.douyin.com/user/MS4wLjABAAAAiOZqiyWty2-opX8on4l4dXchStMGRnIfyzmPk81YWL8",
    "musicId": "7601448811659086598",
    "musicTitle": "@整颗银创作的原声",
    "musicAuthor": "整颗银",
    "musicIsOriginal": false,
    "musicPlayUrl": null,
    "coverUrl": "https://p26-sign.douyinpic.com/tos-cn-p-0015c000-ce/...jpeg?...",
    "videoPlayUrl": "https://v3-dymsearch.douyinvod.com/.../video/tos/cn/...",
    "imageUrls": [],
    "width": 1080,
    "height": 1920,
    "isAd": false,
    "keyword": "口红",
    "searchPosition": 1,
    "searchSort": "general",
    "searchPublishTime": "unlimited",
    "searchDuration": "unlimited",
    "missingFields": ["plays", "musicPlayUrl"],
    "scrapedAt": "2026-11-02T07:29:33.902Z"
}
```

Some fields are shortened here. Avatar and creator bio fields are also included in real rows.

### Tips, limits and how results behave

- **Result depth.** Douyin's guest search stops paging at a different point for each visitor. The Actor resumes from the same position with a new anonymous session, so broad keywords usually reach a few hundred posts. Niche keywords and narrow filters return fewer. `RUN_SUMMARY` shows why each keyword stopped (`limit`, `exhausted`, `request_cap`, `blocked`, `timeout` or `max_charge`).
- **Sorting.** Douyin's guest search has no server-side sort. `most_liked` and `latest` collect up to twice your limit (at most 200 extra posts) in Douyin's relevance order, then output the top posts by likes or by publish time.
- **Filters are double-checked.** The publish window and video length are sent to Douyin and also checked on every post. When both are set together, Douyin filters the date and the Actor filters the length itself.
- **Play counts** are not shown to logged-out visitors, so `plays` is normally null and listed in `missingFields`. Music audio URLs are usually missing from search results too.
- **Media URLs are signed** and expire (video streams within hours). Download files soon after the run if you need them.
- **Search personalisation.** Douyin may show slightly different results from run to run; deduplication works within a run.

### Integrations and workflows

- **Daily brand monitoring:** schedule the Actor with your brand terms, `publishTime: one_day` and `publishedAfter: "24 hours"`, then send new rows to Google Sheets, Slack or a database through Apify integrations.
- **Creator discovery:** search category keywords, sort by `most_liked`, then pass `authorProfileUrl` values to [Douyin Creator Profiles Scraper](https://apify.com/automation-lab/douyin-creator-profiles) for full creator statistics.
- **Trend pipelines:** pull trending topics with [Douyin Hot Search Trends Scraper](https://apify.com/automation-lab/douyin-hot-search-trends) and feed them in as keywords to get the posts behind each trend.
- **Cross-platform research:** compare the same terms on [TikTok Search Scraper](https://apify.com/automation-lab/tiktok-search-scraper) and [Bilibili Scraper](https://apify.com/automation-lab/bilibili-scraper).
- **Webhooks and Make/Zapier/n8n:** trigger downstream steps when a run succeeds.

### Use the Douyin Search Scraper API

**cURL**

```bash
curl -X POST "https://api.apify.com/v2/acts/automation-lab~douyin-search-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"keywords":["口红"],"maxResultsPerQuery":20}'
```

**JavaScript**

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

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('automation-lab/douyin-search-scraper').call({
    keywords: ['口红', '咖啡'],
    maxResultsPerQuery: 50,
    publishTime: 'one_week',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, items[0]);
```

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("automation-lab/douyin-search-scraper").call(run_input={
    "keywords": ["华为"],
    "maxResultsPerQuery": 100,
    "sort": "most_liked",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["likes"], item["url"])
```

### Use with AI agents via MCP

Douyin Search Scraper is available through the Apify MCP server, so Claude, Cursor and other MCP clients can search Douyin for you.

Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/douyin-search-scraper"
```

Claude Desktop, Cursor or VS Code (JSON configuration):

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

Selecting this Actor also exposes the run, dataset and key-value-store helper tools (`get-actor-run`, `get-dataset-items`, `get-key-value-store-record`, `abort-actor-run`). A good agent workflow:

1. Start one run with `call-actor` and keep the returned run ID, status and storage IDs; the call waits at most 45 seconds and may return before the run finishes.
2. If the run is still running, check the same run with `get-actor-run` using short backoff (2, 4, 8 seconds, max 10) up to a stated deadline such as 120 seconds. Set the client request timeout above the server wait. If the client times out, check the known run instead of starting a new one. At the deadline, report the run as still pending with its run ID and stop polling.
3. When it succeeds, read results with `get-dataset-items` using the run's dataset ID, `limit`, `offset` and only the `fields` you need. Keep a total budget across all pages, for example pages of 20 rows, at most 100 rows and 64 KiB of serialized UTF-8 text in the conversation, whichever comes first. Track the source offset so you can continue later. Keep large exports in Apify storage.
4. Check each page's size before it reaches the model. Long captions or creator bios can make one row large; omit or summarize oversized rows and say so. If your MCP client cannot intercept oversized responses, it cannot guarantee a byte limit, so request small pages and few fields.
5. Report what you got: rows returned, the next offset, and whether the result is partial or truncated. If the run failed, timed out or was aborted, any rows already saved are partial results, not a complete search. `RUN_SUMMARY` (via `get-key-value-store-record`) shows each keyword's stop reason.

Example prompts:

- "Search Douyin for 瑞幸咖啡 posts from the last 7 days and list the 10 most-liked with links."
- "Find Douyin creators posting about 露营 and show their follower counts."
- "Which hashtags appear most often in Douyin posts about 新能源汽车?"

### Is it legal to scrape Douyin?

This Actor collects only data that Douyin shows publicly to any logged-out visitor. It does not log in, bypass paywalls or access private accounts. Scraping public data is generally lawful in many jurisdictions, but rules differ by country and by use. Creator names, bios and avatars are personal data; process them only for a legitimate purpose, keep what you need, and follow GDPR, China's PIPL and Douyin's terms where they apply. Do not use the data for spam, harassment or re-publishing creators' content without permission. This Actor is not affiliated with or endorsed by Douyin or ByteDance.

### Data handling and diagnostics

Failed operations send sanitized diagnostic input, exceptions and Actor/build/run IDs to our private GlitchTip service for repair. Secret fields and URL queries are removed; reports are retained for 30 days. Raw Douyin responses and guest cookies are not product output and are kept in memory only for the run. Apify stores your dataset, input and logs under your account's retention settings; delete them in Console when no longer needed. The Actor does not use AI at runtime and does not send scraped data to any AI provider.

### FAQ

**Do I need a Douyin account or cookies?**
No. The Actor uses Douyin's public guest search and creates its own anonymous sessions.

**Why did I get fewer posts than my limit?**
Douyin limits how deep a logged-out visitor can page, and filters shrink the pool. Check `RUN_SUMMARY` → `keywords[].stopReason`. `exhausted` means Douyin returned no more new posts after several fresh sessions; try more specific or related keywords to widen coverage.

**Why is `plays` always null?**
Douyin does not show play counts to logged-out visitors. We leave the field null and list it in `missingFields` rather than reporting a misleading 0.

**The run failed with "Douyin blocked every search attempt". What now?**
This happens rarely when Douyin rejects every anonymous session. Retry later, or set a proxy in **Proxy configuration** (Apify datacenter proxy works).

**Does it download videos?**
It returns the MP4 stream URL, cover URL and slide image URLs. It does not store media files.

**Can I search Douyin users or live streams?**
Not with this Actor; it covers video and image post search. For creator data, use [Douyin Creator Profiles Scraper](https://apify.com/automation-lab/douyin-creator-profiles).

### Related Actors

- [Douyin Creator Profiles Scraper](https://apify.com/automation-lab/douyin-creator-profiles) — follower, like and post counts for creator profile URLs.
- [Douyin Hot Search Trends Scraper](https://apify.com/automation-lab/douyin-hot-search-trends) — the live Douyin hot-search ranking.
- [Douyin Trending Scraper](https://apify.com/automation-lab/douyin-analytics-scraper) — trending topics with heat scores.
- [TikTok Search Scraper](https://apify.com/automation-lab/tiktok-search-scraper) — the same keyword search job on TikTok.
- [Bilibili Scraper](https://apify.com/automation-lab/bilibili-scraper) — Chinese long-form video data.

# Changelog

This Actor's version history is a separate document: https://apify.com/automation-lab/douyin-search-scraper/changelog.md

# Actor input Schema

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

One to 50 search terms, searched one after another on Douyin's public video search. Chinese terms return the most results; English words, brand names and hashtags (for example #旅行) also work. Each keyword is sent to Douyin as written; duplicates and blank lines are removed.

## `maxResultsPerQuery` (type: `integer`):

Maximum number of saved posts for each keyword, from 1 to 1000. Only saved rows are charged. Douyin's guest search often runs out earlier (typically a few hundred posts for broad terms, fewer for niche ones, and fewer again with filters), so the actual count can be lower.

## `sort` (type: `string`):

Relevance keeps Douyin's own search ranking. Most liked and Latest re-order the posts this Actor collects for the keyword (it gathers up to twice the limit, at most 200 extra, and keeps the top ones). Douyin's guest search has no server-side sort, so these are not the same as sorting all of Douyin.

## `publishTime` (type: `string`):

Ask Douyin for posts published within this window. The Actor also checks every post's publish time and drops anything older.

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

Keep only videos in this length range: under 1 minute, 1 to 5 minutes, or over 5 minutes. Image (slideshow) posts have no length, so they are excluded when this is set. If Published within is also set, Douyin filters the date and this Actor filters length itself, which can return fewer posts.

## `contentType` (type: `string`):

Keep all posts, only videos, or only image (slideshow) posts. Checked by this Actor on each post.

## `publishedAfter` (type: `string`):

Optional cutoff for scheduled monitoring: an ISO date (2026-10-01), an ISO datetime, or a relative window such as "3 days" or "12 hours". Older posts are skipped and not charged. Douyin results are not in date order, so the Actor still reads the same pages; it just saves fewer rows.

## `dedupeAcrossKeywords` (type: `boolean`):

When on, a post found by several keywords is saved (and charged) once, under the first keyword that found it. The other matching keywords are listed in the RUN_SUMMARY record. When off, each keyword gets its own full list. Duplicates inside one keyword are always removed.

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

Optional. By default the Actor connects directly and, if Douyin stops a session, retries through Apify Proxy when your account has it. Set a proxy here to send every request through it.

## Actor input object example

```json
{
  "keywords": [
    "口红",
    "咖啡"
  ],
  "maxResultsPerQuery": 20,
  "sort": "general",
  "publishTime": "unlimited",
  "duration": "unlimited",
  "contentType": "all",
  "dedupeAcrossKeywords": true
}
```

# Actor output Schema

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

Saved posts with caption, publish time, engagement counters, creator and search provenance.

## `media` (type: `string`):

The same posts with cover, video stream, slide image and music fields.

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

Per-keyword saved/duplicate/filtered counts, stop reasons, request counts and posts matched by more than one keyword.

# 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": [
        "口红",
        "咖啡"
    ],
    "maxResultsPerQuery": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/douyin-search-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": [
        "口红",
        "咖啡",
    ],
    "maxResultsPerQuery": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/douyin-search-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": [
    "口红",
    "咖啡"
  ],
  "maxResultsPerQuery": 20
}' |
apify call automation-lab/douyin-search-scraper --silent --output-dataset

```

## MCP server setup

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