@cloud411716/fancy-webnovel 0.2.24 → 0.2.25

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -281,6 +281,7 @@ async function scrapeRank(channelId, rankTypeId, periodId) {
281
281
 
282
282
  // 直接从 DOM 提取 /shuku/{id}/ 链接补到每本书上(不依赖 XHR 匹配)
283
283
  await page.evaluate(() => {
284
+ if (window.__qimaoUrlMap) return;
284
285
  var urlMap = {};
285
286
  document.querySelectorAll('a[href*="/shuku/"]').forEach(a => {
286
287
  var m = a.href.match(/\/shuku\/(\d+)\//);
@@ -291,10 +292,10 @@ async function scrapeRank(channelId, rankTypeId, periodId) {
291
292
  urlMap[title] = 'https://www.qimao.com/shuku/' + id + '/';
292
293
  }
293
294
  });
294
- // 通过 window 传递到外面
295
- window.__qimaoUrlMap = urlMap;
295
+ window.__qimaoUrlMap = JSON.stringify(urlMap);
296
296
  });
297
- const urlMap = await page.evaluate(() => window.__qimaoUrlMap || {});
297
+ const rawUrlMap = await page.evaluate(() => window.__qimaoUrlMap || '{}');
298
+ const urlMap = JSON.parse(rawUrlMap);
298
299
  const norm = s => (s || '').replace(/\s+/g, '');
299
300
  for (const b of books) {
300
301
  if (!b.url) {