This duck helps you pull theWeChat Official Account popularity index rankingunder a certain vertical category—who are the leaders in this track, who are in the middle tier, how the index is ranked; one ranking gives you a clear view of the competitive landscape, making it easy to benchmark and track competitors.
Data goes through doubaoya.com in one line; authentication uses your own key (environment variable
DOUBAOYA_API_KEY, in the formdyh_…)。
Applicable scenarios
| Scenario | How to use | What you get |
|---|---|---|
| Top account benchmarking | See who the TOP accounts in your track are | A tiered top-account ranking |
| Competitor tracking | Pull the same category for several consecutive days to see competitor ranking changes | Competitors' daily ranking trends |
| Track selection | Get a feel for the top ecosystem before entering a new track | The top distribution in that category |
| Operations review | See where your own account ranks on the list | Your own relative position |
Workflow (4 steps)
1. Set ranking parameters
Confirm two things:categoryanddate(only the daily ranking is available for period, see below).
🔴 Category is an official closed set; only the full track name is recognized. If you write 职场、财经 , it will not error out, nor will it auto-correct;
it will only return an empty ranking—the real reason is not "there is no ranking for this track", but that these two words are not valid track names: the official wording is
职场发展、财富理财, and switching to them immediately gives 100 entries.Match the name first, then talk about data.
The 22 officially supported tracks (copy exactly, don't abbreviate, don't make up your own; this duck has tested each one, and all 22 produce data on this ranking):
人文资讯知识百科健康养生时尚潮流美食餐饮乐活生活旅游出行搞笑幽默情感心理体育娱乐美容美体文摘精选民生资讯财富理财科技数码创投商业汽车交通房产楼市职场发展教育考试学术研究企业品牌
- For category use
--category(default人文资讯),only choose from these 22. Map the shorthand the user says to the full name first: Tech/Digital →科技数码, Finance/Wealth Management →财富理财, Workplace →职场发展, Education →教育考试, Entertainment/Sports →体育娱乐, Beauty →美容美体, Real Estate →房产楼市, Entrepreneurship →创投商业。 - For date use
--date YYYY-MM-DD(default2 days back from today). Two hard rules: ① Only keep the most recent 7 days, earlier dates will be rejected;② Data lags by about two days, both yesterday and today have not yet settled, so by default take T-2, don't take it upon yourself to change it to "yesterday". - For period
--rank-type:currently onlyday(daily ranking) has data,week/monthtests always return an empty ranking, don't use it. If you want to see trends, pull the daily ranking for several consecutive days and compare yourself.
2. Call the script
python3 "$SKILL_PATH/scripts/fetch_index_rank.py" --category "人文资讯"
When specifying a dateCalculate based on today, don't copy a hardcoded date(a hardcoded date falls out of the 7-day window within two days):
python3 "$SKILL_PATH/scripts/fetch_index_rank.py" --category "科技数码" \
--date "$(date -d '-3 days' +%F 2>/dev/null || date -v-3d +%F)"
The script prints the success envelope's data as JSON to stdout.Run the script only once each time, read the full stdout, don't use head/tail to preview.
3. Render the ranking table
From data.items take rank (ranking)、accountName (account name)、indexScore (popularity index) and other fields (read defensively, leave blank if missing), lay them out as a Markdown table, sorted by ranking ascending:
| Ranking | Account | Popularity Index |
|---|---|---|
| 1 | Some Official Account | 96.5 |
The index here is uniformly called "popularity index / composite index", corresponding to the field
indexScore。
4. Add a one-sentence insight on the landscape
After the table, add a sentence in this duck's tone: how concentrated is the top of this category, has any dark horse squeezed in, and which tier your own account still needs to reach to get on the list. Short, useful, don't pile on clichés.
Get the key (secret key)
- Open doubaoya.com
- Log in
- Go to Key Center
- Generate key(in the form
dyh_…)
Configure it as an environment variable (the script only recognizes this):
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。
Interface and envelope
POST https://doubaoya.com/api/apis/gongzhonghao/gongzhonghao-index-rank/call- Auth header:
Authorization: Bearer $DOUBAOYA_API_KEY - Request body:
{ "rankType": "day", "rankDate": "YYYY-MM-DD", "category": "人文资讯" }rankType: string,Actually onlydayreturns data(week/monthreturns an empty list)rankDate: stringYYYY-MM-DD,required; only the most recent 7 days are kept, and it lags by about two days (default T-2)category: string,required, only the full names of the above 22 official tracks are recognized
- Return envelope:
{ "success": true, "requestId": "...", "data": { "items": [ { "rank": 1, "accountName": "...", "indexScore": 96.5 } ] }, "error": null } - First check
success: istrueonly then readdata; otherwise readerror.code/error.message。
Error handling
When the script fails, it prints to stderr [error] CODE: message and exits with exit code 1. Common cases:
| 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 (e.g., wrong date format, invalid period) | Fix the parameters and retry |
| 402 | INSUFFICIENT_CREDITS |
Insufficient quota | Go to doubaoya.com to top up/renew quota |
| 404 | NOT_FOUND |
No ranking for that date/category | Change the date or category and retry |
| 422 | PROVIDER_NO_RESULT |
No data found for this set of parameters,most likely the date is beyond the most recent 7 days | Move --date into the most recent 7 days (T-2 recommended) and retry |
| 502 | PROVIDER_FAILED |
Upstream temporary failure (automatic refund issued) | safe to retry |
502 PROVIDER_FAILEDwill automatically refund; retrying is safe and won't double-charge.
The list is empty(success: true but 0 items): not a failure, and alsodoesn't deduct your credits—the response will include a
noResult marked, points are refunded on the spot. Troubleshoot in this order: is the category not among those 22 (most common), was the date taken as yesterday/today (not yet settled), or was week/monthused.
If all are correct, thenwait a moment and retry once exactly as before—the upstream occasionally returns a momentary empty value, so don't draw a conclusion based on just one empty result.
Directory structure
wechat-top-account/
├── SKILL.md # 本文件
└── scripts/
└── fetch_index_rank.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 exactly as is—this is a notice that there is an update for this skill, it does not affect the result of this call, and no retry or change in behavior is needed.