{"record":{"id":"626a570493e59ac0","repo":"DIYgod/RSSHub","slug":"uid-bilibili-cookie-626a57","errorCode":null,"errorMessage":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","messagePattern":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/followings-video.ts","lineNumber":47,"sourceCode":"        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '用户关注视频动态',\n    maintainers: ['LogicJake'],\n    handler,\n    description: `::: warning\n用户动态需要 b 站登录后的 Cookie 值，所以只能自建，详情见部署页面的配置模块。\n:::`,\n};\n\nasync function handler(ctx) {\n    const uid = String(ctx.req.param('uid'));\n    const embed = !ctx.req.param('embed');\n    const name = await cache.getUsernameFromUID(uid);\n\n    const cookie = config.bilibili.cookies[uid];\n    if (cookie === undefined) {\n        throw new ConfigNotFoundError('缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值');\n    }\n\n    const response = await got({\n        method: 'get',\n        url: `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${uid}&type=8`,\n        headers: {\n            Referer: `https://space.bilibili.com/${uid}/`,\n            Cookie: cookie,\n        },\n    });\n    const data = response.data;\n    if (data.code) {\n        logger.error(JSON.stringify(data));\n        if (data.code === -6 || data.code === 4_100_000) {\n            throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');\n        }\n        throw new Error(`Got error code ${data.code} while fetching: ${data.message}`);\n    }","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/followings-video.ts#L29-L65","documentation":"ConfigNotFoundError thrown by the followings-video route when config.bilibili.cookies[uid] is undefined. This route fetches video-type dynamics (type=8) from the followed users' activity feed and requires authentication. The check fires before any network call.","triggerScenarios":"Requesting /bilibili/followings/video/:uid when no BILIBILI_COOKIE_<uid> env var is configured for that uid.","commonSituations":"Cookie not configured for the specific uid; env var name mismatch with route param; new self-hosted instance without bilibili config completed.","solutions":["Set BILIBILI_COOKIE_<uid> with a valid logged-in cookie for the account.","Confirm the uid in the env var matches the route parameter.","Restart RSSHub after setting the variable."],"exampleFix":"// before: no cookie configured\n\n// after\nBILIBILI_COOKIE_123456=SESSDATA=xxx; bili_jct=xxx; DedeUserID=123456;","handlingStrategy":"validation","validationCode":"const uid = String(ctx.req.param('uid'));\nif (config.bilibili.cookies[uid] === undefined) {\n    throw new ConfigNotFoundError(`No cookie for uid ${uid}`);\n}","typeGuard":"function hasCookie(uid: string): boolean {\n    return config.bilibili.cookies[uid] !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Configure BILIBILI_COOKIE_<uid> for every uid you subscribe to.","Restart RSSHub after adding env vars.","Verify cookie keys match route params exactly."],"tags":["bilibili","config","cookie","authentication","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}