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 user-tips (baoliao) route (/smzdm/baoliao/:uid). Identical guard pattern to other SMZDM routes. The error message text '排行榜' (rankings) is a copy-paste artifact — this route is for user baoliao submissions, not rankings. The route scrapes the authenticated zhiyou.smzdm.com portal and needs a valid session cookie.

Source

Thrown at lib/routes/smzdm/baoliao.ts:43

        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    radar: [
        {
            source: ['zhiyou.smzdm.com/member/:uid/baoliao'],
        },
    ],
    name: '用户爆料',
    maintainers: ['nczitzk'],
    handler,
};

async function handler(ctx) {
    if (!config.smzdm.cookie) {
        throw new ConfigNotFoundError('什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE');
    }

    const link = `https://zhiyou.smzdm.com/member/${ctx.req.param('uid')}/baoliao/`;

    const response = await got(link, {
        headers: getHeaders(),
    });
    const $ = load(response.data);
    const title = $('.info-stuff-nickname').text();

    const list = $('.pandect-content-stuff')
        .toArray()
        .map((item): DataItem => {
            const $item = $(item);
            return {
                title: $item.find('.pandect-content-title a').text(),
                link: $item.find('.pandect-content-title a').attr('href'),
                pubDate: timezone(parseDate($item.find('.pandect-content-time').text(), ['YYYY-MM-DD', 'MM-DD HH:mm']), 8),

View on GitHub (pinned to bed535e087)

Solutions

  1. Set SMZDM_COOKIE with a valid session cookie extracted from a logged-in smzdm.com browser session.
  2. Refresh the cookie if it expired and restart RSSHub.
  3. Use unauthenticated SMZDM routes if you cannot provide credentials.

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 user baoliao 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

When it happens

Trigger: The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/baoliao/:uid triggers this guard before any HTTP call is made.

Common situations: Self-hosted RSSHub without SMZDM_COOKIE; cookie expired; or using a public instance without SMZDM support.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/c587135a6246fa74. Report an issue: GitHub.