{"record":{"id":"16121866a0c39efb","repo":"DIYgod/RSSHub","slug":"newrank-rss-is-disabled-due-to-the-lack-of-a-href","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/douyin.ts","lineNumber":36,"sourceCode":"            },\n        ],\n        requirePuppeteer: false,\n        antiCrawler: true,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '抖音短视频',\n    maintainers: ['lessmoe'],\n    handler,\n    description: `::: warning\n免费版账户抖音每天查询次数 20 次，如需增加次数可购买新榜会员或等待未来多账户支持\n:::`,\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('dyid');\n    const nonce = utils.random_nonce(9);\n    const url_detail = 'https://xd.newrank.cn/xdnphb/nr/cloud/douyin/detail/aweme?xyz=' + utils.decrypt_douyin_detail_xyz(nonce) + '&nonce=' + nonce;\n    const cookie = config.newrank.cookie;\n    const response_detail = await got({\n        method: 'post',\n        url: url_detail,\n        headers: {\n            Connection: 'keep-alive',\n            Cookie: cookie,\n            'Content-Type': 'application/json',\n        },\n        data: JSON.stringify({\n            create_time_end: '',\n            create_time_start: '',\n            date_type: '',\n            is_promotion: '0',","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/newrank/douyin.ts#L18-L54","documentation":"A ConfigNotFoundError thrown by the newrank Douyin route when config.newrank or config.newrank.cookie is falsy. RSSHub declares NEWRANK_COOKIE as a required route-specific config; without it the route cannot authenticate against newrank's anti-crawler API and refuses to run. The message is HTML-formatted to link users to the deploy config docs.","triggerScenarios":"Calling /newrank/douyin/:dyid without NEWRANK_COOKIE set in the environment (NEW_RANK_COOKIE or the config.newrank.cookie key). Also triggers when config.newrank exists but cookie is an empty string, or when the deployment uses a config preset that omits the newrank block.","commonSituations":"Fresh RSSHub deployment without route-specific env vars; container rebuild that dropped the env; the cookie expired and was cleared; self-hosted instance where the operator never configured newrank.","solutions":["Set NEWRANK_COOKIE in your RSSHub environment (export NEWRANK_COOKIE='your_cookie_string') and restart the service.","If using docker-compose/.env, add NEWRANK_COOKIE to the env file and recreate the container.","Verify the cookie is current by logging into newrank.cn in a browser and copying the full Cookie header; expired cookies will pass the config check but fail downstream.","If you do not need newrank, leave the route disabled and ignore the error."],"exampleFix":"// before\nif (!config.newrank || !config.newrank.cookie) {\n    throw new ConfigNotFoundError('newrank RSS is disabled ...');\n}\n\n// after — no code change needed; set env instead\n//   export NEWRANK_COOKIE='<full cookie from newrank.cn>'","handlingStrategy":"validation","validationCode":"// RSSHub operator check before enabling the route.\nif (!process.env.NEWRANK_COOKIE) {\n  console.error('NEWRANK_COOKIE is not set — /newrank/douyin/* will throw ConfigNotFoundError.');\n}","typeGuard":"const isNewrankConfigured = (): boolean =>\n  Boolean(config.newrank && typeof config.newrank.cookie === 'string' && config.newrank.cookie.trim());","tryCatchPattern":"// If you consume RSSHub programmatically, treat ConfigNotFoundError as non-retryable.\ntry { await fetch('/newrank/douyin/<id>'); }\ncatch (e) {\n  if (/disabled due to the lack/.test(e.message)) { /* config issue — do not retry, alert operator */ }\n  else throw e;\n}","preventionTips":["Always set NEWRANK_COOKIE via env, never hard-code it.","Document cookie expiry: newrank cookies expire — schedule periodic refresh.","Health-check the route after deploy so a missing env is caught early."],"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"}