{"record":{"id":"ee0e2b998ebe6fc7","repo":"DIYgod/RSSHub","slug":"newrank-rss-is-disabled-due-to-the-lack-of-a-href-ee0e2b","errorCode":null,"errorMessage":"newrank RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"newrank RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/newrank/wechat.ts","lineNumber":36,"sourceCode":"            {\n                name: 'NEWRANK_COOKIE',\n                description: '',\n            },\n        ],\n        requirePuppeteer: false,\n        antiCrawler: true,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '微信公众号',\n    maintainers: ['lessmoe', 'pseudoyu'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.newrank || !config.newrank.cookie) {\n        throw new ConfigNotFoundError('newrank RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>');\n    }\n    const uid = ctx.req.param('wxid');\n    const nonce = utils.random_nonce(9);\n    const { data: summaryHTML } = await got({\n        method: 'get',\n        url: `https://www.newrank.cn/new/readDetial?account=${uid}`,\n        headers: {\n            Connection: 'keep-alive',\n            Cookie: config.newrank.cookie,\n        },\n    });\n    const summary$ = load(summaryHTML);\n    const mainsrc = summary$('script')\n        .toArray()\n        .find((item) => (item.attribs.src || '').startsWith('/new/static/js/main.'))!.attribs.src;\n    const { data: mainScript } = await got({\n        method: 'get',\n        url: `https://www.newrank.cn${mainsrc}`,","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/newrank/wechat.ts#L18-L54","documentation":"Identical guard to the Douyin route, but in the newrank WeChat (公众号) route. It throws ConfigNotFoundError when config.newrank.cookie is missing, because the route must send an authenticated Cookie to newrank's article-list API. The HTML link in the message points operators at the route-specific config docs.","triggerScenarios":"Requesting /newrank/wechat/:wxid when NEWRANK_COOKIE is unset or empty. Same shape as 401 but for the WeChat endpoint — the handler needs the cookie for both the readDetial page fetch and the gw.newrank.cn API call.","commonSituations":"Self-hosted RSSHub without the newrank cookie configured; cookie removed during a config cleanup; deploying from a template env that omits NEWRANK_COOKIE.","solutions":["Set NEWRANK_COOKIE in the environment to the full Cookie string from a logged-in newrank.cn session and restart RSSHub.","Confirm the cookie works by hitting the route once after restart; an expired cookie passes this check but fails later at the N-Token or API step.","If multiple newrank routes are used, the single NEWRANK_COOKIE covers both douyin and wechat routes — configure it once."],"exampleFix":"// before\nif (!config.newrank || !config.newrank.cookie) {\n    throw new ConfigNotFoundError('newrank RSS is disabled ...');\n}\n\n// after — set env: export NEWRANK_COOKIE='<cookie>'","handlingStrategy":"validation","validationCode":"if (!process.env.NEWRANK_COOKIE) {\n  console.error('NEWRANK_COOKIE missing — /newrank/wechat/* will throw ConfigNotFoundError.');\n}","typeGuard":"const isNewrankConfigured = (): boolean =>\n  Boolean(config.newrank && typeof config.newrank.cookie === 'string' && config.newrank.cookie.trim());","tryCatchPattern":"try { await fetch('/newrank/wechat/<id>'); }\ncatch (e) {\n  if (/disabled due to the lack/.test(e.message)) { /* operator config issue, no retry */ }\n  else throw e;\n}","preventionTips":["A single NEWRANK_COOKIE serves both douyin and wechat routes — configure it once.","Refresh the cookie when it expires; expired cookies pass this guard but break at the N-Token/API step.","Validate the env on deploy with a smoke-test request."],"tags":["config","authentication","cookie","newrank","required-config"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}