{"record":{"id":"085e72aaf0526247","repo":"DIYgod/RSSHub","slug":"uid-bilibili-cookie-085e72","errorCode":null,"errorMessage":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","messagePattern":"缺少对应 uid 的 Bilibili 用户登录后的 Cookie 值","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/manga-followings.ts","lineNumber":44,"sourceCode":"        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n    },\n    name: '用户追漫更新',\n    maintainers: ['yindaheng98'],\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 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    const page_size = ctx.req.param('limits') || 10;\n    const link = 'https://manga.bilibili.com/account-center';\n    const response = await got({\n        method: 'POST',\n        url: 'https://manga.bilibili.com/twirp/bookshelf.v1.Bookshelf/ListFavorite?device=pc&platform=web',\n        json: { page_num: 1, page_size, order: 2, wait_free: 0 },\n        headers: {\n            Referer: link,\n            Cookie: cookie,\n        },\n    });\n    if (response.data.code === -6) {\n        throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');\n    }\n    const comics = response.data.data;\n\n    return {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/manga-followings.ts#L26-L62","documentation":"ConfigNotFoundError thrown by the manga-followings route when config.bilibili.cookies[uid] is undefined. This route fetches the user's followed manga list from Bilibili Comics (manga.bilibili.com) via a POST to the bookshelf API, which requires authentication. Without the cookie, the request would return an empty/unauthorized response.","triggerScenarios":"Requesting /bilibili/manga/followings/:uid when no BILIBILI_COOKIE_<uid> env var is set. The cookie is needed because the manga bookshelf is account-private data.","commonSituations":"Cookie not configured; uid mismatch between route param and env var; operator didn't realize manga routes also need the bilibili cookie.","solutions":["Set BILIBILI_COOKIE_<uid> with a cookie from an account that has manga follows.","Ensure the cookie includes SESSDATA (the manga API checks the same session).","Restart RSSHub after configuration."],"exampleFix":"// before: no manga 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]) {\n    throw new ConfigNotFoundError(`Set BILIBILI_COOKIE_${uid} for manga access`);\n}","typeGuard":"function hasMangaCookie(uid: string): boolean {\n    return typeof config.bilibili.cookies?.[uid] === 'string';\n}","tryCatchPattern":null,"preventionTips":["Remember manga routes need the same bilibili cookie as other routes.","Configure cookies for all uids used across bilibili sub-routes.","Validate at startup."],"tags":["bilibili","manga","config","cookie","authentication","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}