{"record":{"id":"d9f425869e328195","repo":"DIYgod/RSSHub","slug":"loginuid-bilibili-cookie-a-href-d9f425","errorCode":null,"errorMessage":"缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href=\"https://docs.rsshub.app/zh/deploy/config#route-specific-configurations\">bilibili 用户关注动态系列路由</a>","messagePattern":"缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href=\"https://docs\\.rsshub\\.app/zh/deploy/config#route-specific-configurations\">bilibili 用户关注动态系列路由</a>","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/followings.ts","lineNumber":49,"sourceCode":"    radar: [\n        {\n            source: ['space.bilibili.com/:uid'],\n            target: '/user/followings/:uid',\n        },\n    ],\n    name: 'UP 主关注用户',\n    maintainers: ['Qixingchen'],\n    handler,\n    description: `::: warning\nUP 主关注用户现在需要 b 站登录后的 Cookie 值，所以只能自建，详情见部署页面的配置模块。\n:::`,\n};\n\nasync function handler(ctx) {\n    const loginUid = ctx.req.param('loginUid');\n    const cookie = config.bilibili.cookies[loginUid];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError('缺少对应 loginUid 的 Bilibili 用户登录后的 Cookie 值 <a href=\"https://docs.rsshub.app/zh/deploy/config#route-specific-configurations\">bilibili 用户关注动态系列路由</a>');\n    }\n\n    const uid = ctx.req.param('uid');\n    const name = await cache.getUsernameFromUID(uid);\n\n    const countResponse = await got({\n        method: 'get',\n        url: `https://api.bilibili.com/x/relation/stat?vmid=${uid}`,\n        headers: {\n            Referer: `https://space.bilibili.com/${uid}/`,\n        },\n    });\n    const count = countResponse.data.data.following;\n\n    const response = await got({\n        method: 'get',\n        url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`,\n        headers: {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/followings.ts#L31-L67","documentation":"ConfigNotFoundError thrown by the followings ('UP 主关注用户') route when config.bilibili.cookies[loginUid] is undefined. Note this route uses loginUid (the account whose cookie is used) separately from uid (the user whose followings are queried). The error message includes a documentation link. This requires the operator to set up a cookie for the *viewing* account (loginUid), not the target uid.","triggerScenarios":"Requesting /bilibili/followings/:loginUid/:uid when BILIBILI_COOKIE_<loginUid> is not configured. The route needs the loginUid account to be authenticated because Bilibili only exposes followings lists to logged-in users.","commonSituations":"Operator set a cookie for the target uid but not for loginUid; confusion between the two parameters (loginUid = your account, uid = whose followings you want); the documentation link in the message was not followed.","solutions":["Set BILIBILI_COOKIE_<loginUid> where loginUid is YOUR account uid (the viewer), not the target.","Ensure the route URL uses the correct loginUid as the first path parameter.","Follow the docs link in the error message for the deployment config module.","Restart RSSHub after setting the env var."],"exampleFix":"// before: cookie set for wrong uid\nBILIBILI_COOKIE_999999=...  // but route is /bilibili/followings/111111/999999\n\n// after: cookie for the loginUid (viewer account)\nBILIBILI_COOKIE_111111=SESSDATA=xxx; bili_jct=xxx; DedeUserID=111111;","handlingStrategy":"validation","validationCode":"const loginUid = ctx.req.param('loginUid');\nif (!config.bilibili.cookies?.[loginUid]) {\n    throw new ConfigNotFoundError(\n        `Set BILIBILI_COOKIE_${loginUid} — this is the VIEWING account, not the target.`\n    );\n}","typeGuard":"function hasLoginCookie(loginUid: string): boolean {\n    return typeof config.bilibili.cookies?.[loginUid] === 'string';\n}","tryCatchPattern":null,"preventionTips":["Understand loginUid (your account) vs uid (target) distinction.","Document which account provides the cookie for followings routes.","Validate both params are present before making API calls."],"tags":["bilibili","config","cookie","authentication","multi-param","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}