This Duck helps you pull bydate rangethe Douyin real-time trending list—see at a glance what's trending on Douyin in the past few days and which topics are rising, and conveniently judge which hot topic to pursue.
🔗 This isno keyworddirect retrieval of Douyin hot searches (
{ "platform": 2 }, without keywords). When doing "comprehensive hot topic selection", it is the Douyin supplementary source for thetrending-hubprocess—do not treat the user's account name/IP name as a keyword; the IP is only used for subsequent matching and filtering.
Data goes through doubaoya.com one line, authentication uses your own token (environment variable
DOUBAOYA_API_KEY, in the formdyh_…)。
Get the key (token)
- Open doubaoya.com
- Log in
- Go to Token Center
- Generate token(in the form
dyh_…)
Configure it in the environment variable (the script only recognizes this):
export DOUBAOYA_API_KEY="dyh_你的口令"
Iron rule: the token must never be printed, never written to a file, and never echoed to the user. The script itself also never outputs the token. All requests are sent only to doubaoya.com。
Run the script
Zero dependencies, the standard library is enough (Python 3).
# 默认:抖音(platform 2),近 5 天区间
python3 "$SKILL_PATH/scripts/fetch_hot_trend.py"
# 指定平台 + 日期区间
python3 "$SKILL_PATH/scripts/fetch_hot_trend.py" --platform 2 --start-date 2026-06-20 --end-date 2026-06-24
| Parameter | Description | Default |
|---|---|---|
--platform |
Platform number (integer) | 2(Douyin) |
--start-date |
Range start date YYYY-MM-DD |
4 days before today |
--end-date |
Range end date YYYY-MM-DD |
today |
The script prints the data in the success envelope as JSON to stdout.Run the script only once each time, read the entire stdout, do not use head/tail to preview.
Workflow (3 steps)
- Set platform + range: default Douyin, past 5 days. If you want to see a longer trend, move
--start-dateearlier. - Call the script to get data: the trending list is in
data.items, each entry containsindex(rank),title(title),hotCount(popularity,string, in the form"920万")、url(link). - Lay out the list + give direction: the returned entries are already sorted by popularity;by
index(rank) ascendingjust lay it out as a Markdown table (hotCountis"920万"a string with units like this; do not use it for numerical sorting). After the table, add a sentence in this Duck's tone—which types of topics have been dominating the list these past few days, and which one is rising and worth doing first.
| Rank | Title | Popularity | Link |
|---|---|---|---|
| 1 | … | … | … |
Read fields defensively (leave blank if missing).
API contract
POST https://doubaoya.com/api/apis/trend/douyin-hot-trend/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "platform": 2, "startDate": "2026-06-20", "endDate": "2026-06-24" } - Return envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "index": 1, "title": "...", "hotCount": "920万", "url": "..." } ] }, "error": null } - First check
success: iftrue, readdata; otherwise readerror.code/error.message。
Error codes
On script failure, print to stderr [error] CODE: message and exit with code 1.
| HTTP | code | Meaning | Handling |
|---|---|---|---|
| 401 | MISSING_API_KEY / UNAUTHORIZED |
No passphrase provided or passphrase invalid | Check DOUBAOYA_API_KEY, go to the passphrase center to regenerate |
| 400 | VALIDATION_ERROR |
Invalid parameter (e.g., wrong date format) | Fix --start-date / --end-date and retry |
| 402 | INSUFFICIENT_CREDITS |
Insufficient quota | Go to doubaoya.com to top up/renew quota |
| 502 | PROVIDER_FAILED |
Temporary upstream failure (automatically refunded) | safe to retry |
Directory structure
douyin-hot-trend/
├── SKILL.md # 本文件
└── scripts/
└── fetch_hot_trend.py # 零依赖脚本(urllib),调用 doubaoya.com
FAQ
Q: It says DOUBAOYA_API_KEY?
is missing export DOUBAOYA_API_KEY="dyh_…"A: First
Q: After running, items is empty / no data for a certain day?
A: This meansthere is no trending data within this date range, not a script error—do not make up data to fill in the table. Move --start-date back a day or two, or confirm the selected window actually has data and rerun.
Q: It reports 502 PROVIDER_FAILED?
A: Temporary upstream fluctuation, the system has automatically refunded, just rerun directly.