{"record":{"id":"369dbd4faa08dd6b","repo":"DIYgod/RSSHub","slug":"no-search-results-found-the-page-structure-may-ha","errorCode":null,"errorMessage":"No search results found. The page structure may have changed.","messagePattern":"No search results found\\. The page structure may have changed\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/routes/baidu/tieba/search.tsx","lineNumber":62,"sourceCode":"    const qw = ctx.req.param('qw');\n\n    const query = new URLSearchParams(ctx.req.param('routeParams'));\n    query.set('ie', 'utf-8');\n    query.set('qw', qw);\n    query.set('rn', query.get('rn') || '20');\n    const link = `https://tieba.baidu.com/f/search/res?${query.toString()}`;\n\n    const html = await getTiebaPageContent(link, `tieba:search:${qw}:${query.toString()}`, {\n        waitForSelector: '.thread-content-box',\n        timeout: 3000,\n    });\n\n    const $ = load(html);\n\n    const resultList = $('.thread-content-box');\n\n    if (resultList.length === 0) {\n        throw new Error('No search results found. The page structure may have changed.');\n    }\n\n    return {\n        title: `${qw} - ${query.get('kw') || '百度贴'}吧搜索`,\n        link,\n        item: resultList.toArray().map((element) => {\n            const item = $(element);\n\n            // 标题\n            const title = item.find('.title-content-wrap .title-wrap span').text().trim();\n\n            // 内容摘要\n            const details = item.find('.abstract-wrap span').text().trim();\n\n            // 从链接中提取帖子URL，并规范化为绝对地址\n            const linkPath = item.find('.action-bar-warp a.action-link-bg').attr('href') || '';\n            const linkHref = normalizeUrl(linkPath);\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/baidu/tieba/search.tsx#L44-L80","documentation":"The Tieba search route loads /f/search/res and selects '.thread-content-box' after waiting for that selector (3s timeout). If the selector matches nothing it throws, meaning either the page never rendered the results (timeout/anti-bot) or Baidu renamed the result container.","triggerScenarios":"getTiebaPageContent returns HTML with zero '.thread-content-box' elements - either because waitForSelector timed out at 3000ms before the Vue-rendered results appeared, or the search genuinely had no results, or an anti-bot page was served.","commonSituations":"Slow connection/JS render exceeding the 3s timeout; BAIDU_COOKIE issues returning a non-result page; Baidu renaming the '.thread-content-box' class; a query that legitimately has zero matches.","solutions":["Increase the waitForSelector timeout (lib/routes/baidu/tieba/search.tsx:58) if render is slow.","Refresh BAIDU_COOKIE if the page is being redirected to a login/captcha.","Confirm in a browser that the search query returns results; if Baidu renamed the class, update the selector."],"exampleFix":"// before\nwaitForSelector: '.thread-content-box', timeout: 3000,\n// after\nwaitForSelector: '.thread-content-box', timeout: 8000,","handlingStrategy":"retry","validationCode":"const MIN_TIMEOUT_MS = 5000;\nfunction timeoutIsSane(ms: number): boolean { return ms >= MIN_TIMEOUT_MS; }","typeGuard":"const pageHasResults = ($: ReturnType<typeof load>): boolean =>\n  $('.thread-content-box').length > 0;","tryCatchPattern":"try {\n  return await handler(ctx);\n} catch (e) {\n  if (e instanceof Error && /No search results found/.test(e.message)) {\n    // bump waitForSelector timeout and retry once\n    return await handler({ ...ctx, _timeout: 8000 });\n  }\n  throw e;\n}","preventionTips":["Use a waitForSelector timeout >= 5s so slow Vue rendering does not false-fail.","Keep BAIDU_COOKIE fresh to avoid being served an anti-bot page.","Record the page HTML on failure so selector drift is diagnosable."],"tags":["baidu-tieba","scraping","puppeteer","css-selector","rss-route"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}