From 1580e9dbc8e72867f7c97069eb0d63ba6836cc04 Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 27 Aug 2026 02:55:10 +0000 Subject: [PATCH] =?UTF-8?q?v10.5:=20=E8=A7=A6=E5=BA=95=E6=A3=80=E6=B5=8B(.?= =?UTF-8?q?recommend-indicator'=E5=B7=B2=E7=BB=8F=E5=88=B0=E5=BA=95?= =?UTF-8?q?=E5=95=A6')=E2=86=92=E7=AB=8B=E5=8D=B3=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8F=96=E6=96=B0=E6=95=B0=E6=8D=AE,=20?= =?UTF-8?q?=E4=B8=8D=E7=AD=89200=E4=BA=BA=E7=B4=AF=E8=AE=A1=E9=98=88?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/zhaopin-scrape.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/zhaopin-scrape.js b/scripts/zhaopin-scrape.js index a60c49e..e710087 100755 --- a/scripts/zhaopin-scrape.js +++ b/scripts/zhaopin-scrape.js @@ -386,6 +386,18 @@ async function scrapeZhaopin(maxCount = 20, fullMode = false, scoreOnly = false) if (currentDataIndex === null || processed.has(currentDataIndex)) { await page.evaluate(() => window.scrollBy(0, window.innerHeight * 0.8)); await randomSleep(3, 5); + // v10.5:触底检测——出现"已经到底啦"指示器说明本批数据加载完,直接刷新页面拿新数据(不等累计人数阈值) + const hitBottom = await page.evaluate(() => !!document.querySelector('.recommend-indicator') && + /已经到底/.test(document.querySelector('.recommend-indicator')?.innerText || '')); + if (hitBottom) { + console.log(' ⤓ 页面已触底(本批数据加载完),刷新页面获取新数据...'); + await page.reload({ waitUntil: 'domcontentloaded', timeout: 60000 }).catch(e => console.log(`刷新失败: ${e.message}`)); + await randomSleep(5, 10); + processed = new Set(); + noCardCount = 0; + currentDataIndex = null; // 重新从头扫描(启动跳过逻辑会略过已处理的卡片) + continue; + } const idx = await page.evaluate(() => document.querySelector('.recommend-item')?.getAttribute('data-index')); if (idx === null && ++noCardCount >= 5) { console.log('连续无新卡片,结束'); break; } currentDataIndex = idx; continue;