DIYgod/RSSHub · error · Error

未获取到数据!

Error message

未获取到数据!

What it means

Generic Error ('未获取到数据!' = 'No data retrieved!') thrown when the Miyoushe getUserFullInfo API returns a response whose data.data.user_info is missing. The upstream call succeeded at the HTTP level but the payload lacks the expected user_info object — typically an auth or invalid-uid response from Miyoushe.

Source

Thrown at lib/routes/mihoyo/bbs/cache.ts:28

    uid ||= '';
    const key = 'mihoyo:user-full-info-uid-' + uid;
    return cache.tryGet(key, async () => {
        const query = new URLSearchParams({
            uid,
            gids: '2',
        }).toString();
        const url = `https://bbs-api.miyoushe.com/user/wapi/getUserFullInfo?${query}`;
        const response = await got({
            method: 'get',
            url,
            headers: {
                Referer: `https://www.miyoushe.com/ys/accountCenter/postList?id=${uid}`,
                Cookie: config.mihoyo.cookie,
            },
        });
        const userInfo = response?.data?.data?.user_info;
        if (!userInfo) {
            throw new Error('未获取到数据!');
        }
        const { nickname, introduce, gender, certification, avatar_url, uid: userId } = userInfo;
        return {
            nickname,
            introduce,
            gender,
            certification,
            avatar_url,
            uid: userId,
        };
    });
};

export default { getUserFullInfo };

View on GitHub (pinned to bed535e087)

Solutions

  1. Refresh MIHOYO_COOKIE from a fresh miyoushe.com login.
  2. Verify the uid is a real Miyoushe user id (numeric, from the accountCenter URL).
  3. If persistent across valid cookies, the API envelope changed — report to route maintainers.
  4. Retry once; transient 200-with-error does happen.

Example fix

// before
MIHOYO_COOKIE=stale_or_empty

// after
MIHOYO_COOKIE=account_id=12345; cookie_token=valid_token; ltoken=...
Defensive patterns

Strategy: retry

Validate before calling

// Validate the cookie is set before calling
if (!config.mihoyo.cookie) throw new ConfigNotFoundError('MIHOYO_COOKIE missing');

Type guard

function hasUserInfo(res: any): res is { data: { data: { user_info: object } } } {
    return Boolean(res?.data?.data?.user_info);
}

Try / catch

try {
    const userInfo = response?.data?.data?.user_info;
    if (!userInfo) throw new Error('No data from Miyoushe');
} catch (e) {
    // refresh cookie / retry once

Prevention

When it happens

Trigger: got(getUserFullInfo) resolves, but response.data.data.user_info is falsy. Common when the cookie is invalid (Miyoushe returns a logged-out payload), the uid doesn't exist, or the API shape changed.

Common situations: Invalid/expired MIHOYO_COOKIE so Miyoushe returns an unauthenticated envelope; uid refers to a deleted account; miyoushe changed its response envelope; transient API error returning an error body with HTTP 200.

Related errors


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