jackwener/OpenCLI · error · EmptyResultError
Tieba may have blocked the result page, or the DOM structure
Error message
Tieba may have blocked the result page, or the DOM structure may have changed
What it means
`tieba search` navigates to the search URL, runs the extraction script, and builds result items. If zero items are extracted from the result page, it throws this EmptyResultError instead of returning an empty list, because a normal Tieba search results page always renders at least one result for a valid query. The throw distinguishes 'we got blocked or the DOM changed' from a legitimate empty search.
Source
Thrown at clis/tieba/search.js:105
strategy: Strategy.COOKIE,
browser: true,
navigateBefore: false,
args: [
{ name: 'keyword', positional: true, required: true, type: 'string', help: 'Search keyword' },
// Restrict unsupported pages before the browser session starts.
{ name: 'page', type: 'int', default: 1, choices: ['1'], help: 'Page number (currently only 1 is supported)' },
{ name: 'limit', type: 'int', default: 20, help: 'Number of items to return' },
],
columns: ['rank', 'id', 'title', 'forum', 'author', 'time', 'url'],
func: async (page, kwargs) => {
assertSupportedPage(kwargs);
const limit = normalizeTiebaLimit(kwargs.limit);
// Use the default browser settle path so we do not read a stale page.
await page.goto(getSearchUrl(kwargs));
const raw = await page.evaluate(buildExtractSearchResultsEvaluate(limit));
const items = buildTiebaSearchItems(Array.isArray(raw) ? raw : [], limit);
if (!items.length) {
throw new EmptyResultError('tieba search', 'Tieba may have blocked the result page, or the DOM structure may have changed');
}
return items;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Reduce search frequency / add delays between calls and retry — transient rate-limit walls are the most common cause.
- Use a logged-in, cookie-persisted browser profile; anonymous searches are blocked more aggressively.
- Verify the query manually at the Tieba search URL in the same browser session and complete any captcha shown.
- If the page renders results manually but extraction still fails, update the library — the search-result selectors are outdated.
Defensive patterns
Strategy: retry
Try / catch
try {
return await cli.search({ query });
} catch (e) {
if (e instanceof EmptyResultError) {
await sleep(randomInt(2000, 6000)); // anti-bot backoff
return cli.search({ query });
}
throw e;
} Prevention
- Throttle searches and add jittered delays between calls.
- Run with a logged-in, cookie-persisted browser profile.
- Avoid bursts from datacenter IPs; prefer residential egress.
- After Tieba UI updates, smoke-test one search to confirm selectors still extract results.
When it happens
Trigger: Calling `tieba search --query <q>` when the extraction finds no result nodes: an anti-bot/captcha wall replaced the results under the same URL, the query returns results only after login, or Tieba changed the search-results markup so selectors no longer match.
Common situations: Baidu rate-limiting a burst of searches from one IP; headless-browser detection; searching niche/rare terms while logged out; Tieba frontend redesign; stale cookies triggering a verification page.
Related errors
- Tieba may have blocked the thread page, or the DOM structure
- No 12306 stations match "${keyword}"
- ${label}
- No papers found for author "${authorText}". Try alternate sp
- No papers found. Try a different keyword.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/fc57d2bd9891f063.
Report an issue: GitHub.