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-articles route (/smzdm/article/:uid). The route scrapes zhiyou.smzdm.com (the authenticated user portal) which requires a valid session cookie to return article lists. Note: the error message text says '排行榜' (rankings) which is a copy-paste artifact — this route is for user articles, not rankings. The cookie is obtained from the browser after logging into smzdm.com.

Source

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

        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,
        supportScihub: false,
    },
    radar: [
        {
            source: ['zhiyou.smzdm.com/member/:uid/article'],
        },
    ],
    name: '用户文章',
    maintainers: ['xfangbao'],
    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')}/article/`;

    const response = await got(link, {
        headers: getHeaders(),
    });
    const $ = load(response.data);
    const title = $('.info-stuff-nickname a').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. Log into smzdm.com in a browser, copy the full Cookie header value from a request in the network tab, and set it as SMZDM_COOKIE in the RSSHub environment.
  2. If the cookie expired, repeat the extraction and update the env var, then restart RSSHub.
  3. If you cannot provide a cookie, these SMZDM routes are unavailable — use unauthenticated SMZDM routes instead.

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

When it happens

Trigger: The RSSHub instance has not set the SMZDM_COOKIE environment variable. Any request to /smzdm/article/:uid triggers this immediately at the top of the handler before any network call.

Common situations: Self-hosted RSSHub without configuring SMZDM_COOKIE; the cookie expired (SMZDM sessions are time-limited); or the operator is on a public instance that does not support authenticated SMZDM routes.

Related errors


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