@cloud411716/fancy-webnovel 0.3.10 → 0.3.11
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
|
@@ -81,7 +81,7 @@ async function extractBookList(page) {
|
|
|
81
81
|
{ timeout: 15000 }
|
|
82
82
|
);
|
|
83
83
|
} catch (waitErr) {
|
|
84
|
-
console.
|
|
84
|
+
console.log(` ✗ 等待页面数据超时(15s),可能是网络慢或页面结构变化:${waitErr.message}`);
|
|
85
85
|
return []; // 返回空数组而非抛异常,避免中断整个采集
|
|
86
86
|
}
|
|
87
87
|
return page.evaluate(() => {
|
|
@@ -305,7 +305,7 @@ async function scrapeChannel(ch, type) {
|
|
|
305
305
|
try {
|
|
306
306
|
// 打开入口页
|
|
307
307
|
await page.goto(initUrl, { waitUntil: "networkidle" }).catch(gotoErr => {
|
|
308
|
-
console.
|
|
308
|
+
console.log(` ✗ 打开入口页失败:${gotoErr.message}`);
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
// 等待登录(用户可在此时手动登录)
|
|
@@ -317,7 +317,7 @@ async function scrapeChannel(ch, type) {
|
|
|
317
317
|
// 连通性自检
|
|
318
318
|
const probe = await probePage(page);
|
|
319
319
|
if (!probe.host || probe.host.indexOf("fanqie") === -1) {
|
|
320
|
-
console.
|
|
320
|
+
console.log(
|
|
321
321
|
` ✗ 当前页面非番茄(host=${probe.host}),可能被重定向到登录/验证页,已跳过。`
|
|
322
322
|
);
|
|
323
323
|
return null;
|
|
@@ -424,7 +424,7 @@ async function scrapeChannel(ch, type) {
|
|
|
424
424
|
|
|
425
425
|
try {
|
|
426
426
|
await page.goto(`https://fanqienovel.com${cat.href}`, { waitUntil: "networkidle" }).catch(gotoErr => {
|
|
427
|
-
console.
|
|
427
|
+
console.log(` ✗ 打开品类页失败:${gotoErr.message}`);
|
|
428
428
|
});
|
|
429
429
|
await page.waitForTimeout(2500);
|
|
430
430
|
await scrollLoad(page, 2);
|
|
@@ -460,7 +460,7 @@ async function scrapeChannel(ch, type) {
|
|
|
460
460
|
|
|
461
461
|
bodyLines.push("---", "");
|
|
462
462
|
} catch (catErr) {
|
|
463
|
-
console.
|
|
463
|
+
console.log(
|
|
464
464
|
` [fanqie] 品类 ${cat.name} 处理出错,跳过: ${catErr && catErr.message ? catErr.message : catErr}`
|
|
465
465
|
);
|
|
466
466
|
bodyLines.push(`## ${cat.name} — 采集失败`, "", "---", "");
|
|
@@ -500,7 +500,7 @@ async function main() {
|
|
|
500
500
|
written++;
|
|
501
501
|
console.log(` ✓ 已保存: ${filepath}`);
|
|
502
502
|
} catch (chErr) {
|
|
503
|
-
console.
|
|
503
|
+
console.log(
|
|
504
504
|
`[fanqie] ${channelLabel(ch)}${typeLabel(ty)} 采集失败,跳过: ${chErr && chErr.message ? chErr.message : chErr}`
|
|
505
505
|
);
|
|
506
506
|
}
|