{"record":{"id":"a76dced29f06fa06","repo":"DIYgod/RSSHub","slug":"baidu-cookie-must-contain-bduss-please-check-your","errorCode":null,"errorMessage":"BAIDU_COOKIE must contain BDUSS. Please check your cookie configuration.","messagePattern":"BAIDU_COOKIE must contain BDUSS\\. Please check your cookie configuration\\.","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/baidu/tieba/common.ts","lineNumber":147,"sourceCode":" */\nconst TIEBA_CLIENT_SECRET = 'tiebaclient!!!';\n\nfunction computeSign(params: Record<string, string>): string {\n    // oxlint-disable-next-line unicorn-js/require-array-sort-compare\n    const sortedKeys = Object.keys(params).toSorted();\n    const raw = sortedKeys.map((key) => `${key}=${params[key]}`).join('') + TIEBA_CLIENT_SECRET;\n    return createHash('md5').update(raw).digest('hex');\n}\n\nexport async function getTiebaForumData(params: { kw: string; cid?: string; isGood?: boolean; sortBy?: string }): Promise<any> {\n    const cookie = config.baidu.cookie;\n    if (!cookie) {\n        throw new ConfigNotFoundError('Baidu Tieba RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#baidu\">BAIDU_COOKIE</a>');\n    }\n\n    const bduss = cookie.match(/BDUSS=([^;]+)/)?.[1] || '';\n    if (!bduss) {\n        throw new ConfigNotFoundError('BAIDU_COOKIE must contain BDUSS. Please check your cookie configuration.');\n    }\n\n    const apiParams: Record<string, string> = {\n        _client_id: 'wappc_1234567890123_456',\n        _client_type: '2',\n        _client_version: '12.20.1.0',\n        _phone_imei: '000000000000000',\n        from: 'tieba',\n        kw: params.kw,\n        rn: '30',\n        pn: '1',\n        BDUSS: bduss,\n    };\n\n    if (params.isGood) {\n        apiParams.is_good = '1';\n    }\n    if (params.cid && params.cid !== '0') {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/baidu/tieba/common.ts#L129-L165","documentation":"ConfigNotFoundError thrown by getTiebaForumData after confirming a cookie exists but failing to extract a BDUSS value from it (the regex /BDUSS=([^;]+)/ did not match). BDUSS is the long-lived auth token the mobile API signs requests with, so a cookie without it cannot authenticate and the route refuses to proceed rather than sending an unsigned request.","triggerScenarios":"BAIDU_COOKIE is set but does not contain a BDUSS=... entry, e.g. only PTSIG/STOKEN/login logs were copied, or the cookie string was truncated.","commonSituations":"Operator copied only part of the cookie; cookie export tool omitted HttpOnly BDUSS; BDUSS was renamed/dropped by Baidu (unlikely).","solutions":["Re-copy the full cookie from a logged-in tieba.baidu.com request, making sure the BDUSS=... entry is included (it is HttpOnly, so use devtools Application > Cookies or the full Cookie request header).","Validate the string contains 'BDUSS=' before setting it; restart RSSHub."],"exampleFix":"// before\nconst bduss = cookie.match(/BDUSS=([^;]+)/)?.[1] || '';\nif (!bduss) {\n    throw new ConfigNotFoundError('BAIDU_COOKIE must contain BDUSS. Please check your cookie configuration.');\n}\n\n// after: surface what was found so the operator can diagnose\nif (!cookie.includes('BDUSS=')) {\n    throw new ConfigNotFoundError('BAIDU_COOKIE must contain a BDUSS entry. Re-copy the cookie from a logged-in tieba.baidu.com session including HttpOnly cookies.');\n}","handlingStrategy":"validation","validationCode":"const bduss = /BDUSS=([^;]+)/.exec(config.baidu.cookie ?? '')?.[1];\nif (!bduss) {\n    throw new ConfigNotFoundError('BAIDU_COOKIE must contain a BDUSS entry.');\n}","typeGuard":"function cookieHasBduss(cookie: string): boolean {\n    return /BDUSS=[^;]+/.test(cookie);\n}","tryCatchPattern":null,"preventionTips":["When copying a Baidu cookie, copy the full Cookie header including HttpOnly BDUSS.","Add a boot-time self-test that asserts BDUSS is present."],"tags":["baidu","tieba","cookie","config","authentication"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}