This duck specializes inreal-time comprehensive searchThis tier: with one keyword, according to the sorting you want (comprehensive/latest/most liked) and time window, it retrieves the current Douyin content in this niche in real time, and the terminal directly lays it out into a clickable table — for you to dotopic insightwith. To chase current traffic, watch the latest posts, and dig into benchmarks, first use this duck to scan the "surface," then go pick the "points" worth breaking down.
Data goes through doubaoya.com one line, authentication uses your own key (environment variable
DOUBAOYA_API_KEY, in the formdyh_…)。To precisely define viral hits by publish date range, use
douyin-search; to dig into a certain work'scomment-section public opinion, usedouyin-comment. This duck is a surface-scanning tool for "keyword → real-time comprehensive content," supporting sorting and time-window switching.
Applicable scenarios
| Scenario | How to use | What you get |
|---|---|---|
| Chase current traffic | Search 世界杯 --sort 1 to see popular items in comprehensive sorting |
See at a glance what is being spread right now |
| Watch the latest posts | Search 新品发布 --sort 2 --time 7 |
to see only the latest content from the last 7 days |
| Dig up highly liked viral hits | Search 减脂餐 --sort 3 --time 30 |
to lock onto the most-liked angles from the last 30 days |
| Benchmark content inventory | Search 职场干货 and page through to dig up a batch of benchmarks |
Figure out which angles the same niche is competing for |
| Public opinion trend monitoring | Search 品牌名 --sort 2 to see the latest discussion |
Quickly judge the current public opinion tendency |
Workflow (4 steps)
1. Extract keywords
Extract from the user's description thecore keyword— keep it concise, 2–6 characters is best (e.g., 减脂餐、新品发布). The shorter the word, the broader and more hits; too long and too specific easily scans empty. Search only one keyword at a time. Then choose sorting and time window according to the need (the two enums are in the table below).
| Parameter | Enum value | Meaning |
|---|---|---|
--sort(sortType) |
1 |
Comprehensive sorting (default) |
2 |
Latest posts | |
3 |
Most liked | |
--time(publishTime) |
0 |
Unlimited (default) |
7 |
Last 7 days | |
30 |
Last 30 days | |
90 |
Last 90 days |
2. Call the real-time search script
python3 "$SKILL_PATH/scripts/search_realtime.py" "减脂餐"
Switch sorting + time window, page through:
python3 "$SKILL_PATH/scripts/search_realtime.py" "减脂餐" --sort 3 --time 30 --page 2
The script outputs the data from the success envelope as JSON to stdout.Run the script only once for the same set of parameters, read the complete stdout directly, do not use head/tail preview, and do not call repeatedly.
3. Lay out into a content table
From data.items(content array), take the fields and lay them out into Markdown according to the table below. Fields areDefensive reading——description(description/title) / authorName(creator) / likeNum(likes) / fansNum(followers) / url(link) may be missing; if missing, leave blank and don't error out. Render the description as aclickable link(pointing to the work URL).
| Description | Creator | Likes | Followers |
|---|---|---|---|
| Sample content description | Some Creator | 8.6w | 120w |
If you want to rank this batch of content, you can add a "popularity index/composite index" column (keyword relevance + like popularity + recency freshness) sorted descending, with ties broken by higher likes first — this is presentation-layer processing and does not change the API calls.
4. Give a one-sentence topic insight
After the table, add a sentence in this duck's voice as atopic insight: what angle this batch of content is competing for, which angle no one has covered thoroughly yet, and whether it's worth following. Keep it short and useful, don't pile on clichés, and don't ask the user back "what is your real purpose".
Get the key (secret key)
- Open doubaoya.com
- Log in
- and go to Key Center
- Generate Key(in the form
dyh_…)
Put it into the environment variable (the script only recognizes this one):
export DOUBAOYA_API_KEY="dyh_你的密钥"
Iron rule: the secret key must never be printed, never written to a file, and never echoed back to the user. The script itself also never outputs the secret key. All requests are sent only to doubaoya.com; do not take the secret key to any other domain.
API and envelope
POST https://doubaoya.com/api/apis/douyin/realtime-search/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "keyword": "减脂餐", "sortType": "1", "publishTime": "0", "page": 1 }keyword: string, requiredsortType: string,1=comprehensive sort /2=latest published /3=most liked (default1)publishTime: string,0=unlimited /7=last 7 days /30=last 30 days /90=last 90 days (default0)page: integer, default 1
- Return envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "description": "...", "authorName": "...", "likeNum": 0, "fansNum": 0, "url": "..." } ] }, "error": null } - First check
success: only when it istruereaddata; otherwise readerror.code/error.message。
Error handling
When the script fails, it prints to stderr [error] CODE: message and exits with code 1. Common cases:
| HTTP | code | Meaning | Handling |
|---|---|---|---|
| 401 | MISSING_API_KEY / UNAUTHORIZED |
No secret key provided or the secret key is invalid | Check DOUBAOYA_API_KEY, and go to Key Center to regenerate it |
| 400 | VALIDATION_ERROR |
Invalid parameters (e.g. keyword is empty, illegal enum value) | Fix 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 |
502 PROVIDER_FAILEDwill be automatically refunded; retrying is safe and will not double-charge.
Directory structure
douyin-realtime-search/
├── SKILL.md # 本文件
└── scripts/
└── search_realtime.py # 零依赖实时搜索脚本(urllib),调用 doubaoya.com
About the notice field in the response
After calling the doubaoya API corresponding to this skill, if the top level of the returned JSON contains the notice field, please relay this sentence to the user verbatim — this is a notice that this skill has an update; it does not affect the result of this call and does not require retrying or changing behavior.