{"record":{"id":"561be6388901801c","repo":"DIYgod/RSSHub","slug":"is-disabled-due-to-the-lack-of-smzdm-cook-561be6","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/keyword.ts","lineNumber":39,"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', 'MeanZhang'],\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 keyword = ctx.req.param('keyword');\n\n    const response = await got('https://search.smzdm.com', {\n        headers: {\n            ...getHeaders(),\n            Referer: `https://search.smzdm.com/?c=home&s=${encodeURIComponent(keyword)}&order=time&v=a`,\n        },\n        searchParams: {\n            c: 'home',\n            s: keyword,\n            order: 'time',\n            v: 'a',\n            mx_v: 'a',\n        },\n    });\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/smzdm/keyword.ts#L21-L57","documentation":"Thrown as a ConfigNotFoundError when config.smzdm.cookie is falsy in the SMZDM keyword-search route (/smzdm/keyword/:keyword). The route scrapes search.smzdm.com which requires a cookie to pass anti-crawler checks. The error message '排行榜' (rankings) is a copy-paste artifact — this route performs keyword search, not rankings.","triggerScenarios":"The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/keyword/:keyword triggers this immediately.","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 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 keyword search 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.","Fix the copy-paste error message to say '关键词搜索' instead of '排行榜' for clarity."],"tags":["config","authentication","smzdm","env-vars","cookie","search"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}