{"record":{"id":"d81e910b4e77c76e","repo":"DIYgod/RSSHub","slug":"is-disabled-due-to-the-lack-of-smzdm-cook-d81e91","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/haowen-fenlei.ts","lineNumber":47,"sourceCode":"        supportScihub: false,\n    },\n    radar: [\n        {\n            source: ['post.smzdm.com/fenlei/:name'],\n            target: '/haowen/fenlei/:name',\n        },\n    ],\n    name: '好文分类',\n    maintainers: ['LogicJake'],\n    handler,\n    description: `| 最新 | 周排行 | 月排行 |\n| ---- | ------ | ------ |\n| 0    | 7      | 30     |`,\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 name = ctx.req.param('name');\n    const sort = ctx.req.param('sort') || '0';\n\n    const link = sort === '0' ? `https://post.smzdm.com/fenlei/${name}/` : `https://post.smzdm.com/fenlei/${name}/hot_${sort}/`;\n\n    const response = await got.get(link, {\n        headers: getHeaders(),\n    });\n    const $ = load(response.data);\n    const title = $('div.crumbs.nav-crumbs').text().split('>').pop();\n\n    const list = $('div.list.post-list')\n        .toArray()\n        .map((item) => {\n            const $item = $(item);\n            return {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/smzdm/haowen-fenlei.ts#L29-L65","documentation":"Thrown as a ConfigNotFoundError when config.smzdm.cookie is falsy in the SMZDM good-articles-by-category route (/smzdm/haowen/fenlei/:name). The route scrapes post.smzdm.com/fenlei/:name which requires a cookie for the anti-crawler protection. The error message '排行榜' (rankings) is a copy-paste artifact — this route fetches categorized good-articles, not rankings.","triggerScenarios":"The RSSHub instance has not set SMZDM_COOKIE. Any request to /smzdm/haowen/fenlei/:name 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 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 good-articles category 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"}