@cloud411716/fancy-webnovel 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -275,8 +275,9 @@ function typeLabel(t) {
|
|
|
275
275
|
|
|
276
276
|
async function scrapeCategoryWithRetry(page, cat) {
|
|
277
277
|
return withRetry(async () => {
|
|
278
|
-
|
|
279
|
-
await page.
|
|
278
|
+
// 用 domcontentloaded 避免被第三方资源打断导航;extractBookList 内部已 waitForFunction 确保数据就绪
|
|
279
|
+
await page.goto(`https://fanqienovel.com${cat.href}`, { waitUntil: "domcontentloaded" });
|
|
280
|
+
await page.waitForTimeout(2000);
|
|
280
281
|
await scrollLoad(page, 2);
|
|
281
282
|
|
|
282
283
|
const books = await extractBookList(page);
|
|
@@ -311,7 +312,7 @@ async function scrapeChannel(ch, type) {
|
|
|
311
312
|
try {
|
|
312
313
|
// 打开入口页(带重试)
|
|
313
314
|
const homeResult = await withRetry(async () => {
|
|
314
|
-
await page.goto(initUrl, { waitUntil: "
|
|
315
|
+
await page.goto(initUrl, { waitUntil: "domcontentloaded" });
|
|
315
316
|
const probe = await probePage(page);
|
|
316
317
|
if (!probe.host || probe.host.indexOf("fanqie") === -1) {
|
|
317
318
|
throw new Error(`非番茄页面(host=${probe.host}),可能被重定向到登录/验证页`);
|