{"record":{"id":"86dd184f84d80348","repo":"DIYgod/RSSHub","slug":"is-disabled-due-to-the-lack-of-smzdm-cook-86dd18","errorCode":null,"errorMessage":"什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE","messagePattern":"什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/smzdm/ranking.ts","lineNumber":225,"sourceCode":"            {\n                name: 'SMZDM_COOKIE',\n                description: '什么值得买登录后的 Cookie 值',\n            },\n        ],\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '排行榜',\n    maintainers: ['DIYgod'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.smzdm.cookie) {\n        throw new ConfigNotFoundError('什么值得买排行榜 is disabled due to the lack of SMZDM_COOKIE');\n    }\n\n    const { rank_type, rank_id, hour } = ctx.req.param();\n\n    // When the hour is 3, some special rank_id require a special hour num\n    const true_hour = getTrueHour(rank_type, rank_id, hour);\n\n    const response = await got('https://www.smzdm.com/top/json_more', {\n        headers: {\n            Referer: 'https://www.smzdm.com/top',\n            ...getHeaders(),\n        },\n        searchParams: {\n            rank_type,\n            rank_id,\n            hour: true_hour,\n        },\n    });","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/smzdm/ranking.ts#L207-L243","documentation":"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.","triggerScenarios":"The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/ranking/... triggers this guard before any HTTP call.","commonSituations":"Self-hosted RSSHub without SMZDM_COOKIE; cookie expired; public instance without SMZDM support.","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."],"exampleFix":"# before\n# (SMZDM_COOKIE not set)\n\n# after (.env)\nSMZDM_COOKIE=smzdm_id=...; smzdm_sess=...; usera=...;","handlingStrategy":"validation","validationCode":"if (!config.smzdm?.cookie) {\n    throw new ConfigNotFoundError('SMZDM rankings RSS requires SMZDM_COOKIE.');\n}","typeGuard":"function hasSmzdmCookie(cfg: typeof config): cfg is typeof config & { smzdm: { cookie: string } } {\n    return !!cfg.smzdm && typeof cfg.smzdm.cookie === 'string' && cfg.smzdm.cookie.length > 0;\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["config","authentication","smzdm","env-vars","cookie"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}