DIYgod/RSSHub · error · Error

No user posts found. The page structure may have changed or

Error message

No user posts found. The page structure may have changed or the user does not exist.

What it means

The Tieba user route loads a user's profile page, waits for '.thread-card', then counts matches. If zero, it throws, indicating the user does not exist, has no posts, the page was served as an anti-bot interstitial, or the '.thread-card' class was renamed.

Source

Thrown at lib/routes/baidu/tieba/user.tsx:51

};

async function handler(ctx) {
    const uid = ctx.req.param('uid');
    const encodedUid = encodeURIComponent(uid);
    const url = `https://tieba.baidu.com/home/main?un=${encodedUid}`;

    const html = await getTiebaPageContent(url, `tieba:user:${uid}`, {
        waitForSelector: '.thread-card',
        timeout: 3000,
    });

    const $ = load(html);

    const name = $('span.userinfo_username').text() || uid;
    const list = $('.thread-card');

    if (list.length === 0) {
        throw new Error('No user posts found. The page structure may have changed or the user does not exist.');
    }

    return {
        title: `${name} 的贴吧`,
        link: `https://tieba.baidu.com/home/main?un=${encodedUid}`,
        item: list.toArray().map((element) => {
            const item = $(element);

            // 作者
            const authorName = item.find('.head-name').text().trim() || name;

            // 标题
            const title = item.find('.title-text').text().trim();

            // 内容
            const content = item.find('.tb-richtext .text').text().trim();

            // 图片

View on GitHub (pinned to bed535e087)

Solutions

  1. Verify the uid by opening https://tieba.baidu.com/home/main?un=<uid> in a browser.
  2. Refresh BAIDU_COOKIE so the profile page renders the full thread list.
  3. If Baidu renamed the class, update the selector at lib/routes/baidu/tieba/user.tsx:49.

Example fix

// before
const list = $('.thread-card');
// after (renamed class)
const list = $('.user-thread-item');
Defensive patterns

Strategy: validation

Validate before calling

function userHasPosts($: ReturnType<typeof load>): boolean {
  return $('.thread-card').length > 0 || $('span.userinfo_username').length > 0;
}

Type guard

const userPageLooksReal = ($: ReturnType<typeof load>): boolean =>
  $('span.userinfo_username').length > 0;

Try / catch

try {
  return await handler(ctx);
} catch (e) {
  if (e instanceof Error && /No user posts found/.test(e.message)) {
    ctx.throw(404, 'User not found or cookie invalid');
  }
  throw e;
}

Prevention

When it happens

Trigger: getTiebaPageContent returns HTML where '.thread-card' matches nothing - invalid uid, a user with zero posts, an unauthenticated page that lacks the card list, or a Baidu markup change.

Common situations: Wrong/typo uid; BAIDU_COOKIE missing so the profile page renders differently; Baidu A/B test renaming 'thread-card'; the user was deleted/banned.

Related errors


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