{"record":{"id":"e0d631aa9e52d569","repo":"jackwener/OpenCLI","slug":"tieba-may-have-blocked-the-hot-page-or-the-dom-st","errorCode":null,"errorMessage":"Tieba may have blocked the hot page, or the DOM structure may have changed","messagePattern":"Tieba may have blocked the hot page, or the DOM structure may have changed","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/tieba/hot.js","lineNumber":38,"sourceCode":"        const raw = await page.evaluate(`(() => {\n      const items = document.querySelectorAll('li.topic-top-item');\n      return Array.from(items).map((item) => {\n        const titleEl = item.querySelector('a.topic-text');\n        const numEl = item.querySelector('span.topic-num');\n        const descEl = item.querySelector('p.topic-top-item-desc');\n        const href = titleEl?.getAttribute('href') || '';\n\n        return {\n          title: titleEl?.textContent?.trim() || '',\n          discussions: numEl?.textContent?.trim() || '',\n          description: descEl?.textContent?.trim() || '',\n          url: href.startsWith('http') ? href : 'https://tieba.baidu.com' + href,\n        };\n      }).filter((item) => item.title).slice(0, ${limit});\n    })()`);\n        const items = Array.isArray(raw) ? raw : [];\n        if (!items.length) {\n            throw new EmptyResultError('tieba hot', 'Tieba may have blocked the hot page, or the DOM structure may have changed');\n        }\n        return items.map((item, index) => ({\n            rank: index + 1,\n            title: item.title || '',\n            discussions: item.discussions || '',\n            description: item.description || '',\n            url: item.url || '',\n        }));\n    },\n});\n","sourceCodeStart":20,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tieba/hot.js#L20-L49","documentation":"The tieba hot command extracts titles/links from the Baidu Tieba hot page DOM inside the browser. If zero items with titles are extracted, EmptyResultError('tieba hot', ...) is thrown — either the page was blocked (anti-bot/verify page) or Tieba's DOM changed so the selectors no longer match.","triggerScenarios":"Running the tieba hot scrape when the in-page evaluate returns an empty array: page served is a security-verification interstitial, region-blocked page, or the hot-list container/selector markup changed.","commonSituations":"Baidu serving captcha/verify pages to datacenter IPs; frequent scraping triggering rate limits; Tieba front-end redesign moving the hot list selectors; mobile-vs-pc template mismatch.","solutions":["Open the hot page in the controlled browser and inspect whether a verification interstitial is shown; solve it manually then retry","Update the DOM selectors in clis/tieba/hot.js to match current markup after inspecting page.content()","Slow down scrape frequency or rotate egress IP to avoid blocking","Retry after a delay — blocks are often temporary"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const html = await page.content();\nif (/verify|captcha|wappass/i.test(html)) throw new Error('Tieba verification interstitial — solve before scraping');","typeGuard":"function looksBlocked(html) {\n  return /security\\/verify|captcha|wappass|百度安全验证/i.test(html);\n}","tryCatchPattern":"try {\n  const hot = await tiebaHot(page, { limit });\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    console.warn('Tieba hot blocked or markup changed; skipping');\n    return [];\n  }\n  throw e;\n}","preventionTips":["Throttle scrape frequency and reuse warm browser sessions","Check for Baidu security-verify pages before parsing and solve them manually","Snapshot page.content() when empty so you can update selectors quickly","Pin selectors in one module and test against live markup periodically"],"tags":["scraping","dom-parse","tieba","empty-result"],"backgroundTag":"dom-scrape-extraction-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}