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

Search Douyin by keyword across six formats: hashtags, sounds, image posts, experience posts, schools, and keyword suggestions. Each mode returns its own fields -- view and creator counts, sound titles, post captions and stats, school names, or suggested terms. One actor, six Douyin search types.

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

## Pricing

from $1.60 / 1,000 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Douyin Search Scraper

Search Douyin by keyword across seven formats in one Actor — hashtags, sounds, image posts, experience posts, schools, and two flavors of live keyword suggestion. Pick a mode with `scraperType`; each mode returns its own fields.

### Modes

| `scraperType` | Returns | Extra filters |
|---|---|---|
| `searchHashtags` (default) | Hashtags matching the keyword — name, view count, creator count | sort, recency, length, content type |
| `searchMusic` | Sounds matching the keyword — title, artist, duration, creator count, play URL | sort, recency, length, content type |
| `searchImages` | Image posts matching the keyword — caption, author, stats, share link | none |
| `searchExperiences` | Experience posts matching the keyword — caption, author, stats, share link | sort, recency, length, content type |
| `searchSchools` | School names matching the keyword | none |
| `searchSuggestions` | Live search suggestions for a partial term | none |
| `searchHashtagSuggestions` | Hashtag-specific suggestions — name, ID, view count | none |

### Input

| Field | Use it for |
|---|---|
| **`keyword`** | Search term. Required for every mode. |
| **`sort_type`** | `0` Most relevant (default), `1` Most liked, `2` Most recent. Applies to `searchHashtags`, `searchMusic`, `searchExperiences` only. |
| **`publish_time`** | `0` Any time (default), `1` Past day, `7` Past week, `180` Past six months. Same three modes. |
| **`filter_duration`** | `0` Any length (default), `0-1`, `1-5`, `5-10000`. Same three modes. |
| **`content_type`** | `0` Any (default), `1` Video, `2` Image and text, `3` Article. Same three modes. |
| **`maxItems`** | Caps the run. Default `100`. Set `0` for no limit. |

```json
{
  "scraperType": "searchMusic",
  "keyword": "猫咪",
  "maxItems": 50
}
```

### Output

Which columns are populated depends on `scraperType` — one table covers seven result shapes, not fields going missing.

| Field | Populated on |
|---|---|
| **`cha_name`**, **`view_count`**, **`user_count`** | `searchHashtags`, `searchHashtagSuggestions` |
| **`id_str`**, **`title`**, **`author`**, **`duration`**, **`play_url`** | `searchMusic` |
| **`aweme_id`**, **`desc`**, **`create_time`**, **`statistics`**, **`share_url`** | `searchImages`, `searchExperiences` |
| **`name`** | `searchSchools` |
| **`content`** | `searchSuggestions` |
| **`source_keyword`** | Every mode — the term this row was collected for |

```json
{
  "cha_name": "猫咪",
  "view_count": 545471418072,
  "user_count": 40052285,
  "source_keyword": "猫咪"
}
```

That row is `searchHashtags`. On `searchMusic` the same keyword returns rows like `{ "title": "猫咪", "author": "鸟神星", "duration": 180, "user_count": 2 }` instead — a different entity, a different subset of the table above.

### Questions

**Why does `content_type` only work for three of the seven modes?**
`searchHashtags`, `searchMusic`, and `searchExperiences` accept Douyin's sort, recency, length, and content-type filters. `searchImages`, `searchSchools`, `searchSuggestions`, and `searchHashtagSuggestions` do not take them at all — the fields are simply not sent on those modes.

**Why does `searchImages`, `searchSchools`, or `searchSuggestions` stop well short of `maxItems`?**
Those endpoints answer with a single batch and no cursor or `has_more` flag, so there is nothing to page into. Raising `maxItems` will not pull more rows out of a mode that only ever returns one page.

**Do I need to handle pagination for the other modes myself?**
No. `searchHashtags`, `searchMusic`, and `searchExperiences` page on Douyin's own continuation token; the Actor reads it off the previous response and resends it automatically.

### Related Actors

| Actor | Purpose |
|---|---|
| [Douyin Video Search Scraper](https://apify.com/toolzerhub/douyin-video-search-scraper) | Search for videos, not the entities around them |
| [Douyin User Search Scraper](https://apify.com/toolzerhub/douyin-user-search-scraper) | Search for accounts |
| [Douyin Hashtag Scraper](https://apify.com/toolzerhub/douyin-hashtag-scraper) | Have a hashtag\_id from `searchHashtags`? Get its full stats and every video under it |
| [Douyin Sound Scraper](https://apify.com/toolzerhub/douyin-sound-scraper) | Have a music\_id from `searchMusic`? Get the sound's full detail and every video using it |

### Support

Questions, bugs, or feature requests: **contact@toolzerhub.com**

Browse the rest: [apify.com/toolzerhub](https://apify.com/toolzerhub)

# Actor input Schema

## `scraperType` (type: `string`):

Choose the dataset for this run.

## `keyword` (type: `string`):

Words or phrase to search for. Chinese terms return the most results.

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

Maximum rows to save. Set 0 to keep collecting until the source is exhausted.

## `sort_type` (type: `string`):

Order for the results.

## `publish_time` (type: `string`):

Only keep posts published in this window.

## `filter_duration` (type: `string`):

Only keep videos of this length.

## `content_type` (type: `string`):

Only keep this kind of post.

## Actor input object example

```json
{
  "scraperType": "searchHashtags",
  "keyword": "猫咪",
  "maxItems": 20,
  "sort_type": "0",
  "publish_time": "0",
  "filter_duration": "0",
  "content_type": "0"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Every record collected during this run

# 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 = {
    "keyword": "猫咪",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("toolzerhub/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 = {
    "keyword": "猫咪",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("toolzerhub/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 '{
  "keyword": "猫咪",
  "maxItems": 20
}' |
apify call toolzerhub/douyin-search-scraper --silent --output-dataset

```

## MCP server setup

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