@cloud411716/fancy-webnovel 4.24.0 → 4.24.1

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.
@@ -201,12 +201,12 @@ id / kind / subkind / name / tags / genres / note / source
201
201
  滚动、懒加载或页面动画截到残缺图片。
202
202
  - 图文作品的轮播可以混合图片页和视频页。视频页会下载该页短视频,15 秒以内每 0.2 秒采样、15–60 秒每 0.5 秒采样,
203
203
  再按稳定画面段选帧并拼成一张关键帧图交给 LLM;这样快速切换的画面和动态字幕/标语不会被封面漏掉。
204
- - 图文轮播必须以页面计数器 `当前页/总页数` 为准:页面刚打开时 DOM 里可能只挂载 1–2 个 `.dySwiperSlide`,不能当作总页数。插件会以第一个 slide 所在的播放器容器为锚点,按 `X/Y` 文本定位计数器,并从计数器相邻元素取得上一页/下一页按钮,不依赖抖音会变化的哈希类名;逐页推进并等待当前页内容切换完成,确保 `note.json` 记录所有页。
204
+ - 图文轮播必须以页面计数器 `当前页/总页数` 为准:页面刚打开时 DOM 里可能只挂载 1–2 个 `.dySwiperSlide`,不能当作总页数。插件会以第一个 slide 所在的播放器容器为锚点,按 `X/Y` 文本定位计数器,并从计数器相邻元素取得上一页/下一页按钮,不依赖抖音会变化的哈希类名;逐页推进并等待当前页内容切换完成,确保 `note.json` 记录所有页。如果某次翻页被播放器/浮层吞掉导致采集页数少于计数器,会重新加载作品并重试最多 2 次。
205
205
  - 独立视频作品会先尝试下载原片并用 ffmpeg 抽帧;下载失败时退化为播放器元素截图。
206
206
  视频时长超过 1 分钟直接跳过;前 5 秒与网文创作无关也跳过。
207
207
  - 场景切换点本身常是过渡虚影。插件会在密集采样后用 ffmpeg blurdetect 给每帧打分,在每个稳定画面段的清晰中段选一帧,避免把文字尚未完全出现的模糊帧交给 LLM。
208
208
  - 稳定画面段可能漏掉只出现 0.3–0.5 秒的短字幕。每个视频页会额外生成一张覆盖全片的密集预览图(15 秒内约每 0.4 秒一帧),LLM 必须同时读取关键帧拼图和密集预览,补齐短字幕后再去重。
209
- - 帧选择版本是 `frame_version: 3`;旧版本缓存的截图/关键帧会自动重新采集。
209
+ - 帧选择版本是 `frame_version: 4`;旧版本缓存的截图/关键帧会自动重新采集。
210
210
  - 子 Agent 或 DSH 在分析途中中断时,作品任务保持 pending;下次运行会复用已采集文件重新分析。旧版本留下的 aborted/failed 任务会在启动采集时自动恢复为 pending。
211
211
  - 抖音 DOM/类名会变,`scan-account.cjs`、`crawl-note.cjs` 和 `crawl-video.cjs`
212
212
  的选择器可能需要维护。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "4.24.0",
3
+ "version": "4.24.1",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -45,7 +45,7 @@ import {
45
45
 
46
46
  export const inject = ['commands', 'userQuestions'];
47
47
 
48
- const FRAME_SELECTION_VERSION = 3;
48
+ const FRAME_SELECTION_VERSION = 4;
49
49
  const ANALYSIS_TIMEOUT_MS = 20 * 60 * 1000;
50
50
  const ANALYSIS_IDLE_GRACE_MS = 60 * 1000;
51
51
  const CAPABILITY_TIMEOUT_MS = 5 * 60 * 1000;
@@ -365,6 +365,7 @@ async function captureSlides(page, context, outDir) {
365
365
  const screenshots = [];
366
366
  let converter = null;
367
367
  const seen = new Set();
368
+ let expectedTotal = null;
368
369
  try {
369
370
  converter = await context.newPage();
370
371
  await freezeSlideVideos(page);
@@ -375,7 +376,7 @@ async function captureSlides(page, context, outDir) {
375
376
 
376
377
  let current = await waitActiveSlide(page);
377
378
  const initialPosition = await readSlidePosition(page);
378
- const expectedTotal = initialPosition && initialPosition.total > 0 ? initialPosition.total : null;
379
+ expectedTotal = initialPosition && initialPosition.total > 0 ? initialPosition.total : null;
379
380
  let guard = 0;
380
381
  log('[note] carousel initial slides: ' + initialSlides
381
382
  + ', page: ' + (initialPosition ? initialPosition.current + '/' + initialPosition.total : 'unknown')
@@ -561,7 +562,12 @@ async function captureSlides(page, context, outDir) {
561
562
  throw new Error('没有找到可分析的图片或视频,且页面截图失败:' + (err && err.message ? err.message : String(err)));
562
563
  }
563
564
  }
564
- return { slides, screenshots };
565
+ return {
566
+ slides,
567
+ screenshots,
568
+ page_count: expectedTotal,
569
+ captured_pages: [...seen].sort((a, b) => a - b),
570
+ };
565
571
  }
566
572
 
567
573
  async function main() {
@@ -593,7 +599,25 @@ async function main() {
593
599
  }
594
600
 
595
601
  const meta = await readMetadata(page);
596
- const captured = await captureSlides(page, context, outDir);
602
+ let captured = await captureSlides(page, context, outDir);
603
+ for (let retry = 1; retry <= 2; retry += 1) {
604
+ if (!captured.page_count || captured.slides.length >= captured.page_count) break;
605
+ log('[note] incomplete carousel (' + captured.slides.length + '/' + captured.page_count
606
+ + '), reloading and retrying ' + retry);
607
+ await page.goto(noteUrl, { waitUntil: 'domcontentloaded', timeout: 60000 });
608
+ await page.waitForTimeout(4500);
609
+ const retryGate = await safeGateResult(page, outDir);
610
+ if (retryGate) {
611
+ keepPage = true;
612
+ await saveCookies(context, loginState, page.url());
613
+ printJson(retryGate);
614
+ return;
615
+ }
616
+ const retried = await captureSlides(page, context, outDir);
617
+ if (!retried.slides.length) break;
618
+ if (retried.slides.length < captured.slides.length) break;
619
+ captured = retried;
620
+ }
597
621
 
598
622
  const afterGate = await safeGateResult(page, outDir);
599
623
  if (afterGate) {
@@ -612,7 +636,9 @@ async function main() {
612
636
  description: meta.description,
613
637
  body: meta.body,
614
638
  slides: captured.slides,
615
- frame_version: 3,
639
+ page_count: captured.page_count || null,
640
+ captured_pages: captured.captured_pages || null,
641
+ frame_version: 4,
616
642
  screenshots: captured.screenshots,
617
643
  crawled_at: new Date().toISOString(),
618
644
  dir: outDir,
@@ -229,7 +229,7 @@ async function main() {
229
229
  frames: [],
230
230
  first5s: [],
231
231
  video_file: '',
232
- frame_version: 3,
232
+ frame_version: 4,
233
233
  crawled_at: new Date().toISOString(),
234
234
  dir: outDir,
235
235
  };
@@ -278,7 +278,7 @@ async function main() {
278
278
  frames: [],
279
279
  first5s: [],
280
280
  video_file: videoFile,
281
- frame_version: 3,
281
+ frame_version: 4,
282
282
  crawled_at: new Date().toISOString(),
283
283
  dir: outDir,
284
284
  };
@@ -354,7 +354,7 @@ async function main() {
354
354
  download_error: downloadError,
355
355
  overview_file: overview ? overview.file : '',
356
356
  overview_interval: overview ? overview.interval : null,
357
- frame_version: 3,
357
+ frame_version: 4,
358
358
  crawled_at: new Date().toISOString(),
359
359
  dir: outDir,
360
360
  };