DIYgod/RSSHub · error · ConfigNotFoundError
什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
Error message
什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
What it means
Thrown as a ConfigNotFoundError when config.smzdm.cookie is falsy in the SMZDM rankings route (/smzdm/ranking/:rank_type/:rank_id/:hour). This route scrapes the authenticated www.smzdm.com/top/json_more JSON endpoint which requires a session cookie. This is the only SMZDM route where the '排行榜' (rankings) error message text is actually accurate — the other SMZDM routes copied this message incorrectly.
Source
Thrown at lib/routes/smzdm/ranking.ts:225
{
name: 'SMZDM_COOKIE',
description: '什么值得买登录后的 Cookie 值',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '排行榜',
maintainers: ['DIYgod'],
handler,
};
async function handler(ctx) {
if (!config.smzdm.cookie) {
throw new ConfigNotFoundError('什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE');
}
const { rank_type, rank_id, hour } = ctx.req.param();
// When the hour is 3, some special rank_id require a special hour num
const true_hour = getTrueHour(rank_type, rank_id, hour);
const response = await got('https://www.smzdm.com/top/json_more', {
headers: {
Referer: 'https://www.smzdm.com/top',
...getHeaders(),
},
searchParams: {
rank_type,
rank_id,
hour: true_hour,
},
});View on GitHub (pinned to bed535e087)
Solutions
- Set SMZDM_COOKIE with a valid session cookie from a logged-in smzdm.com browser session.
- Refresh the cookie if it expired and restart RSSHub.
- Use unauthenticated SMZDM routes if credentials are unavailable.
Example fix
# before # (SMZDM_COOKIE not set) # after (.env) SMZDM_COOKIE=smzdm_id=...; smzdm_sess=...; usera=...;
Defensive patterns
Strategy: validation
Validate before calling
if (!config.smzdm?.cookie) {
throw new ConfigNotFoundError('SMZDM rankings RSS requires SMZDM_COOKIE.');
} Type guard
function hasSmzdmCookie(cfg: typeof config): cfg is typeof config & { smzdm: { cookie: string } } {
return !!cfg.smzdm && typeof cfg.smzdm.cookie === 'string' && cfg.smzdm.cookie.length > 0;
} Prevention
- Set SMZDM_COOKIE during initial RSSHub deployment if SMZDM routes are needed.
- Schedule regular cookie refreshes since SMZDM sessions expire.
- This is the only SMZDM route where the '排行榜' error message is accurate — keep it here but fix the other six routes.
When it happens
Trigger: The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/ranking/... triggers this guard before any HTTP call.
Common situations: Self-hosted RSSHub without SMZDM_COOKIE; cookie expired; public instance without SMZDM support.
Related errors
- 什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
- 什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
- 什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
- 什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
- 什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/86dd184f84d80348.
Report an issue: GitHub.