{"record":{"id":"db4f3450edb5b4f6","repo":"DIYgod/RSSHub","slug":"uid-bilibili-cookie-db4f34","errorCode":null,"errorMessage":"对应 uid 的 Bilibili 用户的 Cookie 已过期","messagePattern":"对应 uid 的 Bilibili 用户的 Cookie 已过期","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":503,"severity":"error","filePath":"lib/routes/bilibili/followings-dynamic.ts","lineNumber":80,"sourceCode":"    const embed = fallback(undefined, queryToBoolean(routeParams.embed), true);\n    const displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false);\n\n    const name = await cache.getUsernameFromUID(uid);\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_list=268435455`,\n        headers: {\n            Referer: `https://space.bilibili.com/${uid}/`,\n            Cookie: cookie,\n        },\n    });\n    if (response.data.code === -6) {\n        throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');\n    }\n    if (response.data.code === 4_100_000) {\n        throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户 请求失败');\n    }\n    const data = JSONbig.parse(response.body).data.cards;\n\n    const getTitle = (data) => (data ? data.title || data.description || data.content || (data.vest && data.vest.content) || '' : '');\n    const getDes = (data) =>\n        data.dynamic || data.desc || data.description || data.content || data.summary || (data.vest && data.vest.content) + (data.sketch && `<br>${data.sketch.title}<br>${data.sketch.desc_text}`) || data.intro || '';\n    const getOriginDes = (data) => (data && (data.apiSeasonInfo && data.apiSeasonInfo.title && `//转发自: ${data.apiSeasonInfo.title}`) + (data.index_title && `<br>${data.index_title}`)) || '';\n    const getOriginName = (data) => data.uname || (data.author && data.author.name) || (data.upper && data.upper.name) || (data.user && (data.user.uname || data.user.name)) || (data.owner && data.owner.name) || '';\n    const getOriginTitle = (data) => (data.title ? `${data.title}<br>` : '');\n    const getIframe = (data) => {\n        if (!embed) {\n            return '';\n        }\n        const aid = data?.aid;\n        const bvid = data?.bvid;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/followings-dynamic.ts#L62-L98","documentation":"ConfigNotFoundError thrown by the followings-dynamic route when Bilibili's dynamic_new API returns code -6 after an authenticated request. This signals the cookie's SESSDATA is expired or invalid. The route had a cookie configured (so error 82 didn't fire) but the session is no longer recognized by Bilibili.","triggerScenarios":"The dynamic_svr/v1/dynamic_svr/dynamic_new endpoint returns code -6 for the configured cookie, meaning Bilibili considers the session unauthenticated. Occurs after SESSDATA expiry, password change, or manual logout on the source account.","commonSituations":"Long-running deployment with a stale cookie; SESSDATA rotated by Bilibili's security system; cookie copied without the SESSDATA field; account password was changed.","solutions":["Re-log into bilibili.com, copy the fresh Cookie header, and update BILIBILI_COOKIE_<uid>.","Restart RSSHub to load the updated cookie.","Verify the account is not restricted/banned, which can also produce auth-level errors."],"exampleFix":"// before: stale cookie in env\nBILIBILI_COOKIE_123456=SESSDATA=expired;...\n\n// after: refreshed\nBILIBILI_COOKIE_123456=SESSDATA=fresh_value; bili_jct=xxx; DedeUserID=123456;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const response = await got({...});\n    if (response.data.code === -6) {\n        logger.error(`Cookie expired for uid=${uid}`);\n        throw new ConfigNotFoundError('Cookie expired');\n    }\n    if (response.data.code === 4_100_000) {\n        throw new ConfigNotFoundError('Request rejected by risk control');\n    }\n} catch (e) {\n    throw e;\n}","preventionTips":["Monitor for -6 codes and proactively refresh cookies.","Keep cookie refresh procedures documented for operators.","Test cookies after updating them."],"tags":["bilibili","cookie","session-expiry","authentication","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}