{"record":{"id":"82e61cbb5b060a3d","repo":"DIYgod/RSSHub","slug":"is-disabled-due-to-the-lack-of-smzdm-cook-82e61c","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/product.ts","lineNumber":42,"sourceCode":"        antiCrawler: false,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['wiki.smzdm.com/p/:id'],\n            target: '/product/:id',\n        },\n    ],\n    name: '商品',\n    maintainers: ['chesha1'],\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 link = `https://wiki.smzdm.com/p/${ctx.req.param('id')}`;\n\n    const response = await ofetch(link, {\n        headers: getHeaders(),\n    });\n    const $ = load(response);\n    const title = $('title').text();\n\n    // get simple info from list\n    const items: DataItem[] = $('ul#feed-main-list li')\n        .toArray()\n        .map((elem) => {\n            const altText = $(elem).find('img').attr('alt');\n            const link = $(elem).find('h5.feed-block-title a').attr('href');\n            const price = $(elem).find('.z-highlight').text();\n            const title = altText + ' ' + price;","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/smzdm/product.ts#L24-L60","documentation":"Thrown as a ConfigNotFoundError when config.smzdm.cookie is falsy in the SMZDM product-wiki route (/smzdm/product/:id). The route scrapes wiki.smzdm.com/p/:id which requires a cookie for anti-crawler access. The error message '排行榜' (rankings) is a copy-paste artifact — this route fetches product wiki pages, not rankings.","triggerScenarios":"The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/product/:id triggers this guard 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 product 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"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}