DIYgod/RSSHub · error · CaptchaError

遇到源站风控校验,请稍后再试

Error message

遇到源站风控校验,请稍后再试

What it means

CaptchaError thrown by the bilibili dynamic route after the dynamic API returns code -352 twice in a row: once with the cached cookie and once with a freshly fetched cookie. Code -352 is bilibili's risk-control challenge, so after the second failure the route invalidates the stored bili-cookie and surfaces a Chinese 'source risk-control verification, try again later' message.

Source

Thrown at lib/routes/bilibili/dynamic.ts:299

                Cookie: cookie,
            },
        });
        const body = JSONbig.parse(response.body);
        return body;
    };

    let body: BilibiliWebDynamicResponse;

    const cookie = (await cacheIn.getCookie()) as string;
    body = await getDynamic(cookie);

    if (body?.code === -352) {
        const cookie = (await cacheIn.getCookie(true)) as string;
        body = await getDynamic(cookie);

        if (body?.code === -352) {
            cache.set('bili-cookie', '');
            throw new CaptchaError('遇到源站风控校验,请稍后再试');
        }
    }
    const items = (body as BilibiliWebDynamicResponse)?.data?.items;

    let author = items[0]?.modules?.module_author?.name;
    let face = items[0]?.modules?.module_author?.face;
    if (!face || !author) {
        const usernameAndFace = await cacheIn.getUsernameAndFaceFromUID(uid);
        author = usernameAndFace[0] || items[0]?.modules?.module_author?.name;
        face = usernameAndFace[1] || items[0]?.modules?.module_author?.face;
    } else {
        cache.set(`bili-username-from-uid-${uid}`, author);
        cache.set(`bili-userface-from-uid-${uid}`, face);
    }

    const rssItems = await Promise.all(
        items
            .filter((item) => {

View on GitHub (pinned to bed535e087)

Solutions

  1. Wait and retry — the cached cookie is cleared, so the next request will fetch a fresh one.
  2. Supply a logged-in bilibili cookie (config.bilibili.cookies) so the dynamic API is not challenged as an anonymous client.
  3. If recurring, run RSSHub from a cleaner/residential egress or add more cookies to the pool.
Defensive patterns

Strategy: retry

Validate before calling

if (body?.code === -352) {
    // will retry once with a fresh cookie before throwing
}

Type guard

function isRiskControl(body: any): boolean {
    return body?.code === -352;
}

Try / catch

try {
    body = await getDynamic(cookie);
} catch (e) {
    if (e instanceof CaptchaError) {
        // back off and retry later; do not hammer the API
    }
    throw e;
}

Prevention

When it happens

Trigger: Both getDynamic calls (cached cookie, then refreshed cookie) return code -352; the route clears the shared 'bili-cookie' cache entry and throws CaptchaError.

Common situations: Bilibili is actively challenging the instance's IP/cookie; the bili-cookie pool is exhausted or all cookies are flagged; running from a datacenter IP that bilibili rate-limits.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/64be043c7edd89b6. Report an issue: GitHub.