@cloud411716/fancy-webnovel 0.1.76 → 0.1.78

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.
Files changed (125) hide show
  1. package/infra.js +26 -21
  2. package/package.json +1 -1
  3. package/plugins/fancy-bootstrap/index.js +4 -2
  4. package/plugins/fancy-scan/index.js +1 -2
  5. package/plugins/fancy-scan/scripts/run-scan.js +22 -44
  6. package/plugins/fancy-scan/scripts/scraper-registry.md +3 -5
  7. package/plugins/fancy-scan/scripts/scrapers/cdp-utils.cjs +7 -5
  8. package/plugins/fancy-scan/scripts/scrapers/fanqie-rank-scraper.cjs +282 -253
  9. package/plugins/fancy-scan/scripts/scrapers/jjwxc-rank-scraper.cjs +193 -253
  10. package/plugins/fancy-scan/scripts/scrapers/node_modules/.package-lock.json +20 -0
  11. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/LICENSE +202 -0
  12. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/NOTICE +5 -0
  13. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/README.md +3 -0
  14. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
  15. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
  16. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
  17. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
  18. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  19. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  20. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
  21. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  22. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  23. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
  24. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  25. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  26. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
  27. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  28. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  29. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
  30. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  31. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  32. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/browsers.json +75 -0
  33. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/cli.js +21 -0
  34. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.d.ts +17 -0
  35. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.js +17 -0
  36. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/index.mjs +28 -0
  37. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/bootstrap.js +88 -0
  38. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/coreBundle.js +74830 -0
  39. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
  40. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
  41. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/mcp.js +10 -0
  42. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
  43. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/package.js +50 -0
  44. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  45. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/server/electron/loader.js +118 -0
  46. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/serverRegistry.js +7347 -0
  47. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +354 -0
  48. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
  49. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/cli.js +6 -0
  50. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/help.json +708 -0
  51. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
  52. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/output.js +343 -0
  53. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/program.js +404 -0
  54. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/registry.js +176 -0
  55. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/cli-client/session.js +258 -0
  56. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
  57. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +420 -0
  58. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  59. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  60. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  61. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
  62. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
  63. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  64. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  65. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  66. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
  67. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
  68. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  69. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
  70. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
  71. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
  72. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +171 -0
  73. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/utils/extension.js +101 -0
  74. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
  75. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/utilsBundle.js +90764 -0
  76. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +2179 -0
  77. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  78. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  79. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  80. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  81. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
  82. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
  83. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  84. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
  85. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
  86. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
  87. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
  88. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
  89. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  90. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
  91. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  92. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
  93. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
  94. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
  95. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  96. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-rXmQmLUY.js +32 -0
  97. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B-dXF5JN.js +181 -0
  98. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  99. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BuZfJS5v.js +7 -0
  100. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  101. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  102. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
  103. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  104. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.KZ4wOW1K.js +1 -0
  105. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
  106. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
  107. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  108. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  109. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
  110. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
  111. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
  112. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Dzuouizj.js +5 -0
  113. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
  114. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  115. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
  116. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
  117. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/lib/xdg-open +1267 -0
  118. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/package.json +34 -0
  119. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/protocol.d.ts +24842 -0
  120. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/structs.d.ts +52 -0
  121. package/plugins/fancy-scan/scripts/scrapers/node_modules/playwright-core/types/types.d.ts +26188 -0
  122. package/plugins/fancy-scan/scripts/scrapers/package-lock.json +27 -0
  123. package/plugins/fancy-scan/scripts/scrapers/package.json +9 -0
  124. package/plugins/fancy-scan/scripts/scrapers/qimao-rank-scraper.cjs +200 -297
  125. package/plugins/fancy-scan/scripts/scrapers/zhihu-rank-scraper.cjs +80 -80
package/infra.js CHANGED
@@ -5,13 +5,14 @@
5
5
  * notify(session, text) — 打印消息给用户(不触发 LLM)
6
6
  * llmFollowup(invocation, prompt) — 发送消息给 LLM,让 LLM 继续处理
7
7
  * spawnScript(cmd, args, opts) — spawn 子进程,解析 stdout JSON
8
+ * startActivity(session) — 开始 Activity Line 计时,返回 stop 函数
8
9
  *
9
10
  * 所有 fancy-* 插件均直接 import 此文件。
10
11
  */
11
12
 
12
- // ---------------------------------------------------------------------------
13
+ // --------------------------------------------------------------------------
13
14
  // notify — 打印消息给用户(queueMicrotask 避免打断 LLM 输出顺序)
14
- // ---------------------------------------------------------------------------
15
+ // --------------------------------------------------------------------------
15
16
 
16
17
  export function notify(session, text) {
17
18
  queueMicrotask(() => {
@@ -25,7 +26,7 @@ export function notify(session, text) {
25
26
 
26
27
  // --------------------------------------------------------------------------
27
28
  // llmFollowup
28
- // ---------------------------------------------------------------------------
29
+ // --------------------------------------------------------------------------
29
30
 
30
31
  export function llmFollowup(invocation, content) {
31
32
  const prompt = typeof content === 'string' ? content : JSON.stringify(content);
@@ -35,19 +36,37 @@ export function llmFollowup(invocation, content) {
35
36
  });
36
37
  }
37
38
 
38
- // ---------------------------------------------------------------------------
39
+ // --------------------------------------------------------------------------
40
+ // startActivity — Activity Line 计时器(显示 Running… + 实时计时)
41
+ // 调用 startActivity() 返回 stop 函数,进入新阶段时先 stop 再 start
42
+ // --------------------------------------------------------------------------
43
+
44
+ /**
45
+ * @param {import('@deepseek-ai/dsh-session').Session} session
46
+ * @returns {() => void} stop — 调用后停止计时
47
+ */
48
+ export function startActivity(session) {
49
+ session.append('turn/start', { source: 'fancy-plugin' });
50
+ return () => session.append('turn/end', { source: 'fancy-plugin' });
51
+ }
52
+
53
+ // --------------------------------------------------------------------------
39
54
  // spawnScript — spawn 子进程,stdout 只收集 JSON,stderr 单独收集
40
- // ---------------------------------------------------------------------------
55
+ // opts.stop() 会在进程终止时自动调用(用于清理 turn/start)
56
+ // --------------------------------------------------------------------------
41
57
 
42
- export function spawnScript(cmd, args, { timeout = 30000, cwd } = {}) {
58
+ export function spawnScript(cmd, args, { timeout = 30000, cwd, stop } = {}) {
43
59
  return new Promise(async (resolve) => {
44
60
  const { spawn } = await import('child_process');
45
61
  const proc = spawn(cmd, args, { timeout, cwd, stdio: ['ignore', 'pipe', 'pipe'] });
46
62
  const outParts = [], errParts = [];
47
63
  proc.stdout.on('data', (d) => { outParts.push(d.toString()); });
48
64
  proc.stderr.on('data', (d) => { errParts.push(d.toString()); });
65
+
66
+ const cleanup = () => { try { stop?.(); } catch (_) {} };
49
67
  proc.on('close', (code) => {
50
68
  const stdout = outParts.join(''), stderr = errParts.join('');
69
+ cleanup();
51
70
  try {
52
71
  const parsed = JSON.parse(stdout);
53
72
  resolve({
@@ -63,20 +82,6 @@ export function spawnScript(cmd, args, { timeout = 30000, cwd } = {}) {
63
82
  resolve({ ok: false, output: stdout, error: stderr || ('exit ' + code) });
64
83
  }
65
84
  });
66
- proc.on('error', (err) => resolve({ ok: false, output: '', error: err.message }));
85
+ proc.on('error', (err) => { cleanup(); resolve({ ok: false, output: '', error: err.message }); });
67
86
  });
68
87
  }
69
-
70
- // --------------------------------------------------------------------------
71
- // activity — Activity Line 计时器(显示 Running… + 实时计时)
72
- // 调用 startActivity() 返回 stop 函数,进入新阶段时先 stop 再 start
73
- // --------------------------------------------------------------------------
74
-
75
- /**
76
- * @param {import('@deepseek-ai/dsh-session').Session} session
77
- * @returns {() => void} stop — 调用后停止计时
78
- */
79
- export function startActivity(session) {
80
- session.append('turn/start', { source: 'fancy-plugin' });
81
- return () => session.append('turn/end', { source: 'fancy-plugin' });
82
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -80,8 +80,10 @@ export async function apply(ctx) {
80
80
 
81
81
  notify(session, bootstrap.notify({ type: 'initializing', projectRoot }));
82
82
  const stopActivity = startActivity(session);
83
- const result = await spawnScript('node', [join(SCRIPTS_DIR, 'init.js'), projectRoot], { timeout: 30000 });
84
- stopActivity();
83
+ const result = await spawnScript('node', [join(SCRIPTS_DIR, 'init.js'), projectRoot], {
84
+ timeout: 30000,
85
+ stop: stopActivity,
86
+ });
85
87
 
86
88
  if (result.ok) {
87
89
  notify(session, bootstrap.notify({ type: 'success' }));
@@ -97,9 +97,8 @@ export async function apply(ctx) {
97
97
  'node',
98
98
  [join(SCAN_SCRIPTS_DIR, 'run-scan.js'),
99
99
  '--project-root', projectRoot, '--platform', platform, '--length', length],
100
- { timeout: 120000 }
100
+ { timeout: 120000, stop: stopActivity }
101
101
  );
102
- stopActivity();
103
102
 
104
103
  if (!scriptResult.ok) {
105
104
  const err = (typeof scriptResult.error === 'object' && scriptResult.error !== null)
@@ -174,49 +174,27 @@ function spawnScraper(platform, length, outDir) {
174
174
  return new Promise(async (resolve) => {
175
175
  const { spawn } = await import('child_process');
176
176
  const args = scraperArgs(platform, length, outDir);
177
- const ports = ['9222', '9223'];
178
- let portIdx = 0;
179
- let dots = 0;
180
- const interval = setInterval(() => {
181
- dots++;
182
- process.stderr.write('.');
183
- }, 3000);
184
-
185
- function tryPort(port) {
186
- process.stderr.write(`\n → 端口 ${port} ...`);
187
- const scraperScript = join(dirname(fileURLToPath(import.meta.url)), 'scrapers', args.script);
188
- const fullArgs = ['--port', port, ...args.extra];
189
- const p = spawn('node', [scraperScript, ...fullArgs], {
190
- timeout: 120000,
191
- stdio: ['ignore', 'pipe', 'inherit'],
192
- });
193
- let out = '';
194
- p.stdout.on('data', d => { out += d.toString(); });
195
- p.on('close', (code) => {
196
- clearInterval(interval);
197
- if (code === 0 && out.trim()) {
198
- resolve({ ok: true, output: out, stderr: '' });
199
- } else if (portIdx < ports.length - 1) {
200
- portIdx++;
201
- process.stderr.write(` (失败)\n`);
202
- tryPort(ports[portIdx]);
203
- } else {
204
- process.stderr.write(` (失败)\n`);
205
- const errTail = out.trimEnd().slice(-300);
206
- resolve({ ok: false, output: out, error: errTail || `exit ${code}` });
207
- }
208
- });
209
- p.on('error', (e) => {
210
- clearInterval(interval);
211
- if (portIdx < ports.length - 1) {
212
- portIdx++;
213
- tryPort(ports[portIdx]);
214
- } else {
215
- resolve({ ok: false, output: '', error: e.message });
216
- }
217
- });
218
- }
219
- tryPort(ports[portIdx]);
177
+ const scraperScript = join(dirname(fileURLToPath(import.meta.url)), 'scrapers', args.script);
178
+ const fullArgs = [...args.extra];
179
+
180
+ process.stderr.write(`\n→ 启动采集脚本...`);
181
+ const p = spawn('node', [scraperScript, ...fullArgs], {
182
+ timeout: 300000,
183
+ stdio: ['ignore', 'pipe', 'inherit'],
184
+ });
185
+ let out = '';
186
+ p.stdout.on('data', d => { out += d.toString(); });
187
+ p.on('close', (code) => {
188
+ if (code === 0 && out.trim()) {
189
+ resolve({ ok: true, output: out, stderr: '' });
190
+ } else {
191
+ const errTail = out.trimEnd().slice(-500);
192
+ resolve({ ok: false, output: out, error: errTail || `exit ${code}` });
193
+ }
194
+ });
195
+ p.on('error', (e) => {
196
+ resolve({ ok: false, output: '', error: e.message });
197
+ });
220
198
  });
221
199
  }
222
200
 
@@ -400,7 +378,7 @@ async function main() {
400
378
  console.error(` ❌ 平台 ${platform} 暂不支持采集`);
401
379
  process.exit(1);
402
380
  }
403
- console.error(`→ 采集 ${PLATFORM_CN[platform]}(Chrome CDP)...`);
381
+ console.error(`→ 采集 ${PLATFORM_CN[platform]}...`);
404
382
  const result = await spawnScraper(platform, length, scanDir);
405
383
  if (!result.ok) {
406
384
  console.error(` ❌ ${PLATFORM_CN[platform]} 采集失败:${result.error}`);
@@ -14,11 +14,9 @@
14
14
 
15
15
  ## Chrome CDP 环境要求
16
16
 
17
- > ⚠️ **除 qidian 外,其他所有 scraper 都需要先启动 Chrome CDP**:
18
- > ```bash
19
- > node {SKILL_DIR}/browser-cdp/scripts/setup-cdp-chrome.js --yes
20
- > ```
21
- > qidian 默认走 mobile-SSR(不需要 Chrome),失败才降级 CDP。
17
+ > ⚠️ **所有 scraper 现在使用 playwright-core 自己管理浏览器,不再依赖 agent-browser 和 Chrome CDP 端口。**
18
+ > 每个 scraper 独立 launch/close 浏览器进程,采集完成后自动关闭。
19
+ > 如需在采集前留时间登录,可传入 `--login-wait <秒>` 参数。
22
20
 
23
21
  ---
24
22
 
@@ -1,11 +1,13 @@
1
1
  /**
2
- * CDP 工具函数 — 各平台采集脚本的公共依赖
2
+ * 工具函数 — 各平台采集脚本的公共依赖
3
3
  *
4
- * 使用方式:
5
- * const { ab, sleep, evalJSON, evalJSONBase64, scrollLoad, getArg, safeStr, localDateStamp } = require("./cdp-utils");
4
+ * 提供:
5
+ * getArg() — 命令行参数解析
6
+ * localDateStamp() — 本地日期戳(YYYYMMDD)
7
+ * runCli() — CLI 入口包装(含进程超时和信号处理)
8
+ * sleep() — 同步阻塞等待(Atomics.wait)
6
9
  *
7
- * 前置:
8
- * node {SKILL_DIR}/browser-cdp/scripts/setup-cdp-chrome.js 9222
10
+ * 注意:cdp-utils 不再依赖 agent-browser/CDP 端口。浏览器生命周期由各 scraper 自己管理。
9
11
  */
10
12
 
11
13
  const { execFileSync } = require("child_process");