This duck helps you pull the Xiaohongshu weekly ranking bydate + category—see notes that have been steadily rising over a week, not one-day wonders, helping you judge mid-term trends and bet on topic directions with stable momentum.
Data goes doubaoya.com in one line, authentication uses your own key (environment variable
DOUBAOYA_API_KEY, in the formdyh_…). Tip: if502 PROVIDER_FAILEDtemporarily cannot get data, it is an upstream temporary fluctuation, just try again later—failures are automatically refunded, 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 script
Zero dependencies, standard library is enough (Python 3).
# 默认:综合全部,今天往前 2 天
python3 "$SKILL_PATH/scripts/fetch_weekly_top.py"
# 指定日期 + 分类(日期按今天现算,别照抄写死的日期)
python3 "$SKILL_PATH/scripts/fetch_weekly_top.py" \
--rank-date "$(date -d '-3 days' +%F 2>/dev/null || date -v-3d +%F)" --category 化妆美容
🔴 Read the two specifications first(tested on 2026-08-13):
-
For general categories write
综合全部, 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:综合全部出行代步休闲爱好影视娱乐数码科技医疗保健综合杂项星座情感
时尚穿搭婚庆婚礼拍摄记录学习教育化妆美容居家装修旅行度假亲子育儿个人护理美味佳肴职业发展宠物天地潮流鞋包日常生活科学探索新闻资讯体育锻炼
Map the abbreviations users say to the full names first: Beauty → 化妆美容, Food → 美味佳肴, Fashion → 时尚穿搭,
Travel → 旅行度假, Mother & Baby → 亲子育儿, Fitness → 体育锻炼, Digital → 数码科技。
- Dates lag by about two days, and only the most recent 30 days are kept. Yesterday's and today's rankings have not settled yet (empty ranking), 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 kept |
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, and 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 mid-term insights: lay out the table in descending order by
likedCount, and after the table add a sentence in this duck's tone—which topics have been steadily rising this week, whether it is a stable trend or a short-term hotspot, and whether it is worth betting on.
| Rank | Title | Likes |
|---|---|---|
| 1 | … | … |
Defensive field reading (leave blank if missing).
Interface contract
POST https://doubaoya.com/api/apis/xiaohongshu/xiaohongshu-weekly-top/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "rankDate": "YYYY-MM-DD", "category": "综合全部" }(categorytake one of the 25 above,do not pass综合—it is not in the closed set;rankDateonly the most recent 30 days are kept, with a lag of about two days) - Return envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "title": "...", "likedCount": 123 } ] }, "error": null } - First check
success: if it istruethen readdata; otherwise readerror.code/error.message。
Error codes
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 can be found for this set of input parameters.Most likely the category name is not in the closed set of 25 (for example, you wrote 综合), or the date is outside the most recent 30 days |
Change the category to the full name in the closed set, move the date into the most recent 30 days, and retry |
| 502 | PROVIDER_FAILED |
Temporary upstream failure (automatically refunded) | safe to retry |
Directory structure
xiaohongshu-weeklytop/
├── SKILL.md # 本文件
└── scripts/
└── fetch_weekly_top.py # 零依赖脚本(urllib),调用 doubaoya.com
FAQ
Q: What is the difference from the daily ranking? A: The weekly ranking looks at sustained performance over a week, which better reflects medium-term trends; the daily ranking captures what is hottest that day.
Q: Temporarily unable to get data?
A: First self-check according to the two criteria above—is the category name not in the closed set of 25 (for example, you wrote 综合), is the date set to
yesterday/today (not yet settled) or outside the most recent 30 days. If all are ruled out, thenwait a while and retry once with the same parameters: occasional transient empty values occur upstream;
the same set of parameters being empty once and full the next time has been encountered in this duck's actual testing, so do not 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 notice field appears at the top level of the returned JSON, 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 no retry or behavior change is needed.