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 good-articles (haowen) route (/smzdm/haowen/:day). The route scrapes post.smzdm.com/hot_<day>/ which requires a cookie for anti-crawler access. The error message '排行榜' (rankings) is a copy-paste artifact — this route fetches hot good-articles by day, not rankings.
Source
Thrown at lib/routes/smzdm/haowen.ts:48
{
name: 'SMZDM_COOKIE',
description: '什么值得买登录后的 Cookie 值',
},
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: '好文',
maintainers: ['LogicJake', 'pseudoyu'],
handler,
};
async function handler(ctx) {
if (!config.smzdm.cookie) {
throw new ConfigNotFoundError('什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE');
}
const day = ctx.req.param('day') ?? '1';
const link = `https://post.smzdm.com/hot_${day}/`;
const response = await ofetch(link, {
headers: getHeaders(),
});
const $ = load(response);
const title = $('li.filter-tab.active').text();
const list = $('li.feed-row-wide')
.toArray()
.map((item) => {
const $item = $(item);
return {
title: $item.find('h5.z-feed-title a').text(),
link: $item.find('h5.z-feed-title a').attr('href'),View on GitHub (pinned to bed535e087)
Solutions
- Set SMZDM_COOKIE with a valid session cookie from a logged-in smzdm.com 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 good-articles 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.
- Fix the copy-paste error message to say '好文' instead of '排行榜' for clarity.
When it happens
Trigger: The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/haowen/:day triggers this guard at handler entry.
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/f5e6ef6aa69ea46f.
Report an issue: GitHub.