Quack! This duck will help you scoop Xiaohongshu's hottest accounts into one ranking — daily, weekly, or monthly, your choice; niche, your choice. Rank, follower count, and engagement laid out line by line in the terminal, and after you're done, I'll give you a line on "how to use this ranking for benchmarking."
Data goes through doubaoya.com one line, authentication uses your own token (environment variable
DOUBAOYA_API_KEY, in the formdyh_…)。
Use cases
| Scenario | How to use | What you get |
|---|---|---|
| Top account benchmarking | Check the daily/weekly/monthly ranking for a niche and see who the top players are | Lock onto the benchmark accounts in that niche at a glance |
| Competitor tracking | Check the ranking periodically and watch competitors' rank rises and falls | Understand changes in your competitors' position within the niche |
| Find benchmarks for starting an account | See who is rising in your niche and use them as a target to catch up to | Set a reference benchmark target for a new account |
| Initial influencer screening / account selection | Pull rankings by niche and shortlist candidates by follower tier | Quickly screen a batch of candidate accounts for ad placement/collaboration |
| Niche popularity research | Compare top-tier scale across different niches | Judge which niche is more competitive and where the opportunities are |
Workflow (4 steps)
1. Understand the intent and define three parameters clearly
Determine from the user's description:
- Period
--period: daily rankingday/ weekly rankingweek/ monthly rankingmonth(defaultday). If the user says "this week" or "this month," switch to the corresponding period. - Niche
--type: default综合全部. If the user mentions a specific direction, map it to the standard niche name (see the table below). - Date
--rank-date: default is yesterday (same-day data is usually not yet settled), generally no need to change; pass it only if the user wants to check a specific historical day.
Niche (type) reference list(colloquial term → standard niche name):
| User says | Maps to |
|---|---|
| Unlimited / All | All combined |
| Food, store visits, cooking, making meals | Delicious Food |
| Beauty, makeup, skincare | Makeup & Beauty |
| Personal care, hair and body care | Personal Care |
| Outfit, fashion | Fashion & Outfits |
| Travel, tourism | Travel & Vacation |
| Mother and baby, parenting | Parenting & Childcare |
| Fitness, sports, yoga | Physical Exercise |
| Digital, tech | Digital Tech |
| Home, renovation | Home Renovation |
| Study & Education | Study & Education |
| Pets | Pet World |
Complete track list (ready to use): All Combined, Travel & Commuting, Leisure & Hobbies, Film & Entertainment, Digital Tech, Healthcare, Miscellaneous, Astrology & Relationships, Fashion & Outfits, Weddings & Marriage, Photography & Recording, Study & Education, Makeup & Beauty, Home Renovation, Travel & Vacation, Parenting & Childcare, Personal Care, Delicious Food, Career Development, Pet World, Trendy Shoes & Bags, Daily Life, Scientific Exploration, News & Information, Sports & Fitness.
2. Call the leaderboard script
python3 "$SKILL_PATH/scripts/fetch_xhs_top_account.py"
Switch period + track:
python3 "$SKILL_PATH/scripts/fetch_xhs_top_account.py" --period week --type 美味佳肴
Query a specific day in history:
python3 "$SKILL_PATH/scripts/fetch_xhs_top_account.py" --period month --rank-date 2026-06-01
The script prints the data from the success envelope as JSON to stdout.Run the script only once per query, read the full stdout directly, don't use head/tail to preview or call it repeatedly.
If a track returns empty for a certain day, it's most likely that the day's leaderboard hasn't been settled yet—you can move
--rank-dateback a day or two and try again.
3. Render the leaderboard table
From data.items(account array), take the fields and lay them out into a Markdown table in the format below. Read fields defensively—rank(rank) / nickname(blogger) / fansCount(follower count) / interaction-related fields may be missing; if missing, leave blank or mark "N/A", don't error out, don't fill in values. The blogger name can be rendered as a clickable link pointing to their Xiaohongshu homepage (if the response includes a homepage URL/ID).
| Rank | Blogger | Followers | Engagement |
|---|---|---|---|
| 1 | Example Blogger | 128.0w | 32.1w |
Make follower counts / engagement readable with thousands separators or in "ten-thousands" units; if you want to add a "composite index" column to sort by popularity, that's presentation-layer processing and doesn't affect the API call.
4. Give a one-line benchmarking insight
After the table, add a line in this duck's tone:benchmarking insight: roughly what tier this track's top players are at, who is rising fast, and which accounts are most worth using as benchmarks for starting out. Keep it short, evidence-based, and don't pile on empty talk.
Get the key (passcode)
- Open doubaoya.com
- Log in
- Go to Passcode Center
- Generate Passcode(in the form
dyh_…)
Configure it as an environment variable (the script only recognizes this one):
export DOUBAOYA_API_KEY="dyh_你的口令"
Iron rule: the passcode must never be printed, never written to a file, never echoed back to the user. The script itself also never outputs the passcode. All requests are sent only to doubaoya.com, don't take the passcode to any other domain.
API and Envelope
POST https://doubaoya.com/api/apis/xiaohongshu/xiaohongshu-top-account/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "period": "day", "rankDate": "2026-06-26", "type": "综合全部" }period: leaderboard period,day/week/month(defaultday)rankDate: leaderboard dateYYYY-MM-DD(default yesterday)type: track/category (default综合全部)
- Return envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "rank": 1, "nickname": "...", "fansCount": 1280000 } ] }, "error": null } - First check
success: if it istruethen readdata; otherwise readerror.code/error.message。
Error Handling
When the script fails, it prints [error] CODE: message to stderr and exits with code 1. Common cases:
| HTTP | code | Meaning | Handling |
|---|---|---|---|
| 401 | MISSING_API_KEY / UNAUTHORIZED |
No passcode provided or invalid passcode | Check DOUBAOYA_API_KEY, go to the Passcode Center and regenerate |
| 400 | VALIDATION_ERROR |
Invalid parameters (e.g., incorrect track name/date format) | Check --type / --rank-date and retry |
| 402 | INSUFFICIENT_CREDITS |
Insufficient quota | Go to doubaoya.com to top up/renew |
| 502 | PROVIDER_FAILED |
Temporary upstream failure (automatically refunded) | Safe to retry |
502 PROVIDER_FAILEDwill be automatically refunded; retrying is safe and will not result in duplicate charges.
Directory structure
xiaohongshu-top-account/
├── SKILL.md # 本文件
└── scripts/
└── fetch_xhs_top_account.py # 零依赖榜单脚本(urllib),调用 doubaoya.com