jackwener/OpenCLI · error · EmptyResultError
Tieba may have blocked the forum page, or the DOM structure
Error message
Tieba may have blocked the forum page, or the DOM structure may have changed
What it means
The tieba posts command fetches the forum page (PC template), builds post cards from payload.page_data.feed_list, and throws EmptyResultError when no items were produced or the payload carries an error_code. This signals the forum page was blocked/empty or the data contract changed.
Source
Thrown at clis/tieba/posts.js:82
description: 'Browse posts in a tieba forum',
domain: 'tieba.baidu.com',
strategy: Strategy.COOKIE,
browser: true,
navigateBefore: false,
args: [
{ name: 'forum', positional: true, required: true, type: 'string', help: 'Forum name in Chinese' },
{ name: 'page', type: 'int', default: 1, help: 'Page number' },
{ name: 'limit', type: 'int', default: 20, help: 'Number of items to return' },
],
columns: ['rank', 'title', 'author', 'replies'],
func: async (page, kwargs) => {
const limit = normalizeTiebaLimit(kwargs.limit);
const payload = await fetchTiebaPagePc(page, kwargs, limit);
const rawFeeds = Array.isArray(payload.page_data?.feed_list) ? payload.page_data.feed_list : [];
const rawCards = buildTiebaPostCardsFromPagePc(rawFeeds);
const items = buildTiebaPostItems(rawCards, limit);
if (!items.length || payload.error_code) {
throw new EmptyResultError('tieba posts', 'Tieba may have blocked the forum page, or the DOM structure may have changed');
}
return items;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the forum name/URL is correct and the forum still exists in a browser
- Inspect the fetched payload and update the page_data.feed_list / card-building logic in clis/tieba/posts.js if Tieba changed the contract
- Handle captcha/verification in the browser session, then retry
- Catch EmptyResultError and degrade gracefully (return []) in scripts that iterate many forums
Example fix
// before
const items = await tiebaPosts(page, { forum: kw });
// after
let items;
try {
items = await tiebaPosts(page, { forum: kw });
} catch (e) {
if (e instanceof EmptyResultError) items = [];
else throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
// check forum exists before scraping
const probe = await page.goto('https://tieba.baidu.com/f?kw=' + encodeURIComponent(kw));
if (!page.url().includes('/f?kw=')) throw new Error('Forum missing or redirected: ' + kw); Type guard
function forumPayloadLooksValid(payload) {
return payload && !payload.error_code && Array.isArray(payload.page_data?.feed_list);
} Try / catch
try {
const posts = await tiebaPosts(page, { forum: kw, limit });
} catch (e) {
if (e instanceof EmptyResultError) return { forum: kw, posts: [], note: 'blocked/empty' };
throw e;
} Prevention
- Validate forum keywords exist before batch iteration
- Handle error_code payloads explicitly (banned/deleted forums)
- Keep a manual-verification step ready for Baidu anti-bot interstitials
- Update feed_list extraction logic promptly after Tieba contract changes
When it happens
Trigger: fetchTiebaPagePc returns page_data.feed_list empty/non-array, or buildTiebaPostItems yields zero items, or payload.error_code is set (Tieba API-level error like blocked forum or deleted forum).
Common situations: Forum name typo'd (nonexistent forum); forum restricted/banned by Tieba; anti-bot interstitial instead of the PC page; feed_list field renamed after a Tieba update.
Related errors
- Tieba may have blocked the hot page, or the DOM structure ma
- Tieba may have blocked the thread page, or the DOM structure
- 1point3acres thread
- 1point3acres user
- amazon ${definition.commandName} did not expose any ranked i
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2a7477d91a2262bd.
Report an issue: GitHub.