This duck helps you pull bydate + categorythe Xiaohongshu daily ranking—see at a glance who is dominating the charts in this category today, what content they are using to drive volume, and conveniently lock onto viral hits worth benchmarking.
Data goes through doubaoya.com one line, authentication uses your own key (environment variable
DOUBAOYA_API_KEY, in the formdyh_…). Tip: if data is temporarily unavailable, it is upstream fluctuation, try again later (no charge).
Get the key (secret key)
- Open doubaoya.com
- Log in
- Go to Key Center
- Generate Key(in the form
dyh_…)
export DOUBAOYA_API_KEY="dyh_你的密钥"
Iron rule: the key is never printed, never written to a file, never echoed back to the user. The script itself also never outputs the key. All requests are sent only to doubaoya.com。
Run the script
Zero dependencies, standard library is enough (Python 3).
# 默认:综合全部,今天往前 2 天
python3 "$SKILL_PATH/scripts/fetch_daily_top.py"
# 指定日期 + 分类(日期按今天现算,别照抄写死的日期)
python3 "$SKILL_PATH/scripts/fetch_daily_top.py" \
--rank-date "$(date -d '-3 days' +%F 2>/dev/null || date -v-3d +%F)" --category 化妆美容
🔴 Two specifications to understand first(tested on 2026-08-13):
-
Generic categories must be written as
综合全部, not综合。综合is not in the official closed set; if passed, it will be directly judged as "no results found"— this is not "no ranking that day", it is the wrong name. Categories are a closed set of 25 tracks, copy them exactly, do not make up your own:综合全部出行代步休闲爱好影视娱乐数码科技医疗保健综合杂项星座情感
时尚穿搭婚庆婚礼拍摄记录学习教育化妆美容居家装修旅行度假亲子育儿个人护理美味佳肴职业发展宠物天地潮流鞋包日常生活科学探索新闻资讯体育锻炼
First map the abbreviations users say to the full names: Beauty → 化妆美容, Food → 美味佳肴, Fashion → 时尚穿搭,
Travel → 旅行度假, Mother & Baby → 亲子育儿, Fitness → 体育锻炼, Digital → 数码科技。
- The date lags by about two days, and only the most recent 30 days are retained. Yesterday's and today's rankings have not yet been settled (empty rankings), so the default is T-2; dates earlier than 30 days will be judged as no results found (not an empty ranking).
| Parameter | Description | Default |
|---|---|---|
--rank-date |
Ranking date YYYY-MM-DD, only the most recent 30 days are retained |
2 days before today |
--category |
Category, one of the 25 closed set; do not pass 综合 |
综合全部 |
The script prints the data from the success envelope as JSON to stdout.Run the script only once each time, read the complete stdout.
Workflow (3 steps)
- Set date + category: default category
综合全部, date is 2 days before today. - Call the script to get data: the ranking is in
data.items, each entry containstitle(title),likedCount(like count). - Lay out the ranking + give insights: sort by
likedCountin descending order into a Markdown table, and after the table add a sentence in this duck's tone—what topics/formats this category is using to drive volume today, and whether it can be transferred to your own account.
| Rank | Title | Likes |
|---|---|---|
| 1 | … | … |
Defensive field reading (leave blank if missing).
API contract
POST https://doubaoya.com/api/apis/xiaohongshu/xiaohongshu-daily-top/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "rankDate": "YYYY-MM-DD", "category": "综合全部" }(categorytake one of the above 25,do not pass综合—it is not in the closed set;rankDateonly keep the most recent 30 days, with a lag of about two days) - Response envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "title": "...", "likedCount": 123 } ] }, "error": null } - first check
successif it istrueonly then readdata; otherwise readerror.code/error.message。
Error code
When the script fails, print to stderr [error] CODE: message and exit with code 1.
| HTTP | code | Meaning | Handling |
|---|---|---|---|
| 401 | MISSING_API_KEY / UNAUTHORIZED |
No key provided or invalid key | Check DOUBAOYA_API_KEY, go to the key center to regenerate |
| 400 | VALIDATION_ERROR |
Invalid parameters | Fix --rank-date / --category and retry |
| 402 | INSUFFICIENT_CREDITS |
Insufficient quota | Go to doubaoya.com to top up/renew quota |
| 422 | PROVIDER_NO_RESULT |
No data found for this set of input parameters.Most likely the category name is not in the 25-item closed set (for example, you wrote 综合), or the date is outside the most recent 30 days |
Replace the category with the full name from the closed set, move the date into the most recent 30 days, and retry |
| 502 | PROVIDER_FAILED |
Temporary upstream failure (refund has been issued automatically) | safe to retry |
Directory structure
xiaohongshu-dailytop/
├── SKILL.md # 本文件
└── scripts/
└── fetch_daily_top.py # 零依赖脚本(urllib),调用 doubaoya.com
FAQ
Q: It says DOUBAOYA_API_KEY?
A: First export DOUBAOYA_API_KEY="dyh_…"(go to doubaoya.com → log in → key center → generate key).
Q: Temporarily unable to get data?
A: First check yourself according to the two criteria above—whether the category name is not in the 25-item closed set (for example, you wrote 综合) and whether the date falls on
yesterday/today (not yet settled) or outside the most recent 30 days. If all of these are ruled out, thenretry once unchanged after a while: upstream occasionally has transient empty values;
the same set of parameters being empty once and full the next time has been observed in practice by this duck, so don't draw conclusions from just one empty result (empty results are not charged).
About the notice field in the response
After calling the doubaoya API corresponding to this skill, if the returned JSON has a top-level notice field, please relay this sentence to the user exactly as is—this is a notice that this skill has an update, does not affect the result of this call, and does not require retrying or changing behavior.