# Douyin Hashtag Search Scraper (`opspilot.cc/douyin-hashtag-search`) Actor

Test

- **URL**: https://apify.com/opspilot.cc/douyin-hashtag-search.md
- **Developed by:** [wang wei](https://apify.com/opspilot.cc) (community)
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.10 / actor start

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?

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

**EN — Search Douyin hashtags by keyword + date range.** Returns a ranked list of matching topics with `topic_id` (numeric string — this IS the `ch_id` you pass into the sibling hashtag Actors), heat index, video count, total likes, total plays. One run = one upstream POST call.

**ZH — 抖音话题搜索 — 按关键词 + 日期范围搜索抖音话题。** 返回匹配的话题列表,每条带 `topic_id`(数值字符串 — 这就是 `ch_id`,可以直接传给 hashtag-detail / hashtag-video-list)、热度指数、视频数、总点赞、总播放。一次运行 = 一次上游 POST 请求。

Built for **hashtag discovery**, **trend research**, **competitor benchmarking**, **campaign planning**, and **content ops** on Douyin — China's #1 short-video platform.

**5 free runs / day.** No API key required — the Actor's built-in upstream key is already configured.

### Input

| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| `keyword` | string | yes | — | Topic keyword, 1-100 chars. Examples: `特朗普`, `deepseek`, `美食`. |
| `startDate` | string | yes | — | Start date in `YYYYMMDD` format. Example: `20260901` for 2026-09-01. |
| `endDate` | string | yes | — | End date in `YYYYMMDD` format. Must be `>= startDate`. Example: `20260911` for 2026-09-11. |
| `appName` | string | no | `"aweme"` | Platform selector. `"aweme"` = 抖音 (Douyin, default) / `"toutiao"` = 今日头条 (broader search index). |
| `maxItems` | integer | no | `100` | Cap on items pushed to dataset (1-200). Use to limit noise on broad keywords. |

```json
{
  "keyword": "deepseek",
  "startDate": "20260901",
  "endDate": "20260911",
  "appName": "aweme",
  "maxItems": 50
}
```

### Output

The Actor pushes one item per matched topic (capped by `maxItems`) to the default dataset and writes a `SUMMARY` record with run details.

```json
{
  "rank": 1,
  "topic_name": "deepseek",
  "topic_id": "1784740573938700",
  "topic_index": 2256692,
  "item_cnt": 17619,
  "digg_cnt": 7101427,
  "play_read_cnt": 169696598,
  "datetime": null,
  "fetched_keyword": "deepseek",
  "fetched_date_range": "20260901_to_20260911",
  "fetched_app_name": "aweme",
  "rawData": { /* full upstream topic_list item */ }
}
```

> ⚠️ **`topic_id` is the `ch_id`.** The returned `topic_id` is the numeric challenge id used by Douyin's hashtag system — paste it directly into `douyin-hashtag-detail.chId` or `douyin-hashtag-video-list.chId` to follow up.

**`SUMMARY` record:**

```json
{
  "ok": true,
  "keyword": "deepseek",
  "startDate": "20260901",
  "endDate": "20260911",
  "appName": "aweme",
  "requestedMaxItems": 50,
  "requests": 1,
  "totalTopics": 100,
  "itemsPushed": 50,
  "note": "1 Run = 1 upstream request. Pass returned topic_id (= ch_id) into douyin-hashtag-detail / douyin-hashtag-video-list for follow-up."
}
```

### Use it together with the other Douyin Actors

This Actor is part of the 5-Actor Douyin MVP set. Use it together with:

| Where in the pipeline | Actor | Use it to |
|---:|---|---|
| you are here | **Douyin Hashtag Search Scraper (you are here)** | (this Actor) |
| step ② | [Douyin Hashtag Detail Scraper](../douyin-hashtag-detail/README.md) | pass returned topic\_id as chId → rich ch\_info (name, view\_count, user\_count, share info, author) |
| after / step ③ | [Douyin Hashtag Video List Scraper](../douyin-hashtag-video-list/README.md) | pass topic\_id as chId + walk cursor → full video list under the topic |
| sister Actor | [Douyin Hot Search List Scraper](../douyin-hot-search-list/README.md) | board-level trends — 热点榜 / 种草榜 / 娱乐榜 / 社会榜 / 挑战榜 |
| sister Actor | [Douyin Live Hot Search List Scraper](../douyin-live-hot-search-list/README.md) | live-stream specific trends (board\_type=6) — what is hot on Douyin LIVE right now |

**You are here:** **Douyin Hashtag Search Scraper** — run this on its own for the upstream use case described above, or chain it with the other 4 Actors for a full Douyin keyword → hashtag → videos → trends pipeline.

### Use cases

| Persona | Use it for |
|---|---|
| Influencer marketer | Search hashtags by vertical keyword (e.g. `美食`, `健身`) to shortlist topic partnerships before deep-diving each |
| Trend researcher | Run daily/weekly keyword searches with date ranges to surface rising topics before they hit 热点榜 |
| Brand manager | Search for your brand name + product lines to monitor owned-topic performance (`item_cnt`, `play_read_cnt`) |
| Content planner | Generate a 30-day hashtag calendar by keyword + date range, then validate each via step ② / step ③ |
| Competitor analyst | Pull a brand's full hashtag footprint by searching their brand name + variants |

### Why this Actor exists

Douyin's hashtag system has 100M+ topics but no public search UI for cross-keyword research. This Actor closes that gap — you supply a keyword + a date range, and it returns every matching topic with engagement metrics. **The returned `topic_id` is the bridge** to the rest of the Douyin MVP set: feed it into `douyin-hashtag-detail` for metadata, or `douyin-hashtag-video-list` for the full video corpus.

### Pricing

Free users are limited to **5 runs per day**. Paid users (`APIFY_USER_IS_PAYING=1`) have unlimited runs. The Actor itself adds no markup — you pay the upstream provider per request plus the standard Apify compute unit cost.

### Test locally

```bash
cd douyin-hashtag-search
UPSTREAM_API_KEY=... UPSTREAM_BASE_URL=<your-upstream-base-url> npm test
```

- `node test/unit.js` — 6 unit assertions on normalize / parse / rank / ctx propagation.
- `node test/integration.js` — 1 live POST call against `keyword=deepseek`. Returns 100 topics for the given date range. No fixture playback — fixture JSON kept under `test/fixtures/` for offline reference only.

### Output schema

See `.actor/output_schema.json` for the full type schema, or read it at runtime via the Apify API.

### License

MIT

# Actor input Schema

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

Topic keyword. Example: '特朗普', 'deepseek', '美食'. Max 100 chars.

## `startDate` (type: `string`):

Start date in YYYYMMDD format. Example: '20260901' for 2026-09-01. Default: yesterday (20260911).

## `endDate` (type: `string`):

End date in YYYYMMDD format. Must be >= startDate. Example: '20260911' for 2026-09-11. Default: today (20260912).

## `appName` (type: `string`):

Platform selector. 'aweme' = 抖音 (Douyin, default), 'toutiao' = 今日头条 (Toutiao, broader search index).

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

Cap the number of items pushed to the dataset (1-200, default 100). Use to limit noise on broad keywords.

## Actor input object example

```json
{
  "startDate": "20260911",
  "endDate": "20260912",
  "appName": "aweme",
  "maxItems": 100
}
```

# Actor output Schema

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

One normalized dataset item per matched item. See output\_schema section of README for the per-actor item shape (topic\_id/ch\_id, hot\_value, engagement metrics, etc.).

## `summary` (type: `string`):

Run-level summary: input params (keyword / chId / boardType / etc.), requests, uniqueItems, itemsPushed, activeTime, tier (paid/free/free-unchecked), runsToday, dailyLimit, notes.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("opspilot.cc/douyin-hashtag-search").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("opspilot.cc/douyin-hashtag-search").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 '{}' |
apify call opspilot.cc/douyin-hashtag-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,opspilot.cc/douyin-hashtag-search"
        }
    }
}
```

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/oEwKuG0MhcGQZOe2I/builds/epj6zNlacFtmGOxQW/openapi.json
