DIYgod/RSSHub · warning · InvalidParameterError

response.data.message

Error message

response.data.message

What it means

InvalidParametersError thrown by the followings route when Bilibili's relation/followings API returns code 22115, meaning the target user has set their following list to private. The error message is whatever Bilibili returns in response.data.message (typically '用户已设置隐私,无法查看'). This is not a bug — it reflects the target user's privacy settings.

Source

Thrown at lib/routes/bilibili/followings.ts:77

            Referer: `https://space.bilibili.com/${uid}/`,
        },
    });
    const count = countResponse.data.data.following;

    const response = await got({
        method: 'get',
        url: `https://api.bilibili.com/x/relation/followings?vmid=${uid}`,
        headers: {
            Referer: `https://space.bilibili.com/${uid}/`,
            Cookie: cookie,
        },
    });
    if (response.data.code === -6) {
        throw new ConfigNotFoundError('对应 loginUid 的 Bilibili 用户的 Cookie 已过期');
    }
    // 22115 : 用户已设置隐私,无法查看
    if (response.data.code === 22115) {
        throw new InvalidParameterError(response.data.message);
    }
    const data = response.data.data.list;

    return {
        title: `${name} 的 bilibili 关注`,
        link: `https://space.bilibili.com/${uid}/#/fans/follow`,
        description: `${name} 的 bilibili 关注`,
        item: data.map((item) => ({
            title: `${name} 新关注 ${item.uname}`,
            description: `${item.uname}<br>${item.sign}<br>总计${count}`,
            pubDate: new Date(item.mtime * 1000),
            link: `https://space.bilibili.com/${item.mid}`,
        })),
    };
}

View on GitHub (pinned to bed535e087)

Solutions

  1. Choose a different target uid whose following list is public.
  2. Accept that this user's following list is not accessible via any authenticated route.
  3. If you control the target account, disable the privacy setting in Bilibili account settings.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: test if the user's following list is accessible
// (cannot truly validate without calling the API, but inform the user)
if (response.data.code === 22115) {
    throw new InvalidParametersError(
        `User ${uid} has set their following list to private. This cannot be bypassed.`
    );
}

Try / catch

try {
    const response = await got({...});
    if (response.data.code === 22115) {
        throw new InvalidParametersError('Target user following list is private');
    }
} catch (e) {
    if (e instanceof InvalidParametersError) {
        // Inform user — no technical fix available
    }
    throw e;
}

Prevention

When it happens

Trigger: The queried uid (not loginUid) has enabled the privacy setting that hides their following list. Bilibili returns code 22115 with a message explaining the privacy restriction. No amount of cookie refreshing will fix this.

Common situations: Target user toggled 'hide following list' in their Bilibili privacy settings; trying to scrape a private/celebrity account that has locked down their social graph; the target was always private.

Related errors


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