{"record":{"id":"dbe141e0f4e21737","repo":"DIYgod/RSSHub","slug":"huitun-rss-is-disabled-due-to-the-lack-of-a-href","errorCode":null,"errorMessage":"huitun RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"huitun 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":null,"severity":"error","filePath":"lib/routes/huitun/xiaohongshu.ts","lineNumber":33,"sourceCode":"                name: 'HUITUN_COOKIE',\n                description: '灰豚数据 cookie 值',\n            },\n        ],\n        requirePuppeteer: false,\n        antiCrawler: true,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    description: '免费版账户每天查询次数为 10 次，若需增加查询次数请购买灰豚数据红薯版会员',\n    name: '小红书笔记',\n    maintainers: ['Skylwn'],\n    handler,\n};\n\nasync function handler(ctx) {\n    if (!config.huitun || !config.huitun.cookie) {\n        throw new ConfigNotFoundError('huitun 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 cookie = config.huitun.cookie;\n    const uid = ctx.req.param('user_id');\n    const response_user = await got({\n        method: 'get',\n        url: 'https://xhsapi.huitun.com/anchor/search/v2?keyword=' + uid,\n        headers: {\n            Cookie: cookie,\n        },\n    });\n    const user_data = JSON.parse(response_user.body);\n    const anchorId = user_data.extData.list[0].anchorId;\n    const name = user_data.extData.list[0].nick;\n    const response_note = await got({\n        method: 'get',\n        url: 'https://xhsapi.huitun.com/anchor/detail/notesV2?sort=0&anchorId=' + anchorId,\n        headers: {\n            Cookie: cookie,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/huitun/xiaohongshu.ts#L15-L51","documentation":"Thrown by the Huitun (灰豚数据) Xiaohongshu route when the RSSHub instance configuration does not include `config.huitun.cookie`. The Huitun API requires an authenticated session cookie to search for anchors and fetch notes. RSSHub's `ConfigNotFoundError` maps to an HTTP 502 response indicating the route is not configured. The route's `features.requireConfig` declares the `HUITUN_COOKIE` environment variable as required.","triggerScenarios":"Calling `/huitun/xiaohongshu/<user_id>` on an RSSHub instance where the `HUITUN_COOKIE` config key is not set. This check runs before any network request.","commonSituations":"Self-hosted RSSHub deployment that didn't set the `HUITUN_COOKIE` environment variable, the cookie expired and was removed, or the config file is missing the `huitun` section entirely.","solutions":["Set `HUITUN_COOKIE` in the RSSHub environment configuration (`.env` or config file): add a `huitun: { cookie: 'your_cookie_here' }` entry.","Obtain the cookie by logging into huitun.com, opening browser DevTools → Network, and copying the `Cookie` header from an authenticated API request.","Note the free tier limits queries to 10/day; consider caching behavior and whether the cookie's quota is exhausted."],"exampleFix":"// config (.env)\n// before: HUITUN_COOKIE is unset\n\n// after:\n// HUITUN_COOKIE=PHPSESSID=xxxxx; other_cookie=yyyyy;","handlingStrategy":"validation","validationCode":"import { config } from '@/config';\nfunction isHuitunConfigured(): boolean {\n    return Boolean(config.huitun?.cookie);\n}\n// The route already checks this at handler entry. Callers can check:\nif (!isHuitunConfigured()) {\n    throw new ConfigNotFoundError('HUITUN_COOKIE is not set');\n}","typeGuard":"function hasHuitunCookie(cfg: typeof config): cfg is typeof config & { huitun: { cookie: string } } {\n    return Boolean(cfg.huitun?.cookie);\n}","tryCatchPattern":null,"preventionTips":["Set `HUITUN_COOKIE` in the deployment environment before subscribing to this route.","Document the cookie acquisition process (browser DevTools → Network → copy Cookie header).","Monitor for cookie expiration — Huitun sessions may time out, requiring re-extraction.","Note the free-tier daily query limit (10/day) when sharing the instance."],"tags":["config","missing-config","rsshub","social-media"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}