{"record":{"id":"698d40489701fde5","repo":"DIYgod/RSSHub","slug":"uid-bilibili-cookie-698d40","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":62,"sourceCode":"\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    }\n    const cards = data.data.cards;\n\n    const out = cards.map((card) => {\n        const card_data = JSON.parse(card.card);\n\n        return {\n            title: card_data.title,\n            description: utils.renderUGCDescription(embed, card_data.pic, card_data.desc, card_data.aid, undefined, card.desc.bvid),\n            pubDate: new Date(card_data.pubdate * 1000).toUTCString(),\n            link: card_data.pubdate > utils.bvidTime && card.desc.bvid ? `https://www.bilibili.com/video/${card.desc.bvid}` : `https://www.bilibili.com/video/av${card_data.aid}`,\n            author: card.desc.user_profile.info.uname,\n        };\n    });\n\n    return {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bilibili/followings-video.ts#L44-L80","documentation":"ConfigNotFoundError thrown by the followings-video route when the dynamic_new API returns a non-zero code that is either -6 (session expired) or 4100000 (risk-control rejection). The route lumps both codes into the same 'cookie expired' message. This is slightly imprecise: -6 is genuinely an expired cookie, while 4100000 is a risk-control failure that may not be cookie-related.","triggerScenarios":"response.data.code is truthy (non-zero) and equals -6 or 4100000. Code -6 = SESSDATA invalid/expired; code 4100000 = request flagged by Bilibili risk control.","commonSituations":"Expired SESSDATA after weeks of use; datacenter IP flagged for automation; cookie invalidated by password change; both auth and risk-control failures surface identically to the user.","solutions":["Refresh BILIBILI_COOKIE_<uid> with a new SESSDATA from a browser login session.","If code is 4100000 specifically, also reduce request frequency and consider a residential proxy.","Restart RSSHub after updating the cookie.","Check server logs (logger.error outputs the full data object) to distinguish -6 vs 4100000."],"exampleFix":"// before\nif (data.code === -6 || data.code === 4_100_000) {\n    throw new ConfigNotFoundError('对应 uid 的 Bilibili 用户的 Cookie 已过期');\n}\n\n// after: distinguish the two codes for clearer diagnostics\nif (data.code === -6) {\n    throw new ConfigNotFoundError('Cookie 已过期，请更新 BILIBILI_COOKIE_' + uid);\n}\nif (data.code === 4_100_000) {\n    throw new HTTPError('Bilibili 风控拦截，请降低频率或更换 IP');\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    const response = await got({...});\n    if (response.data.code) {\n        if (response.data.code === -6 || response.data.code === 4_100_000) {\n            throw new ConfigNotFoundError('Cookie expired or risk-controlled');\n        }\n        throw new Error(`Code ${response.data.code}: ${response.data.message}`);\n    }\n} catch (e) {\n    logger.error(`followings-video failed: ${e.message}`);\n    throw e;\n}","preventionTips":["Distinguish -6 (expired) from 4100000 (risk control) in logs for faster diagnosis.","Keep cookies fresh and use realistic User-Agents.","Reduce polling frequency to avoid risk-control flags."],"tags":["bilibili","cookie","session-expiry","risk-control","rsshub"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}