tt-help-cli-ycl 1.3.1 → 1.3.3

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 (48) hide show
  1. package/README.md +17 -17
  2. package/cli.js +9 -9
  3. package/package.json +45 -44
  4. package/src/cli/auto.js +1 -1
  5. package/src/cli/explore.js +2 -3
  6. package/src/cli/progress.js +111 -111
  7. package/src/cli/scrape.js +47 -47
  8. package/src/cli/utils.js +18 -18
  9. package/src/cli/videos.js +41 -41
  10. package/src/cli/watch.js +28 -28
  11. package/src/lib/args.js +390 -377
  12. package/src/lib/browser/anti-detect.js +23 -23
  13. package/src/lib/browser/cdp.js +142 -142
  14. package/src/lib/browser/launch.js +43 -43
  15. package/src/lib/browser/page.js +80 -62
  16. package/src/lib/constants.js +94 -85
  17. package/src/lib/delay.js +54 -54
  18. package/src/lib/{explore.js → explore-fetch.js} +118 -118
  19. package/src/lib/fetcher.js +45 -45
  20. package/src/lib/filter.js +66 -66
  21. package/src/lib/io.js +54 -54
  22. package/src/lib/output.js +80 -80
  23. package/src/lib/parser.js +47 -47
  24. package/src/lib/retry.js +44 -44
  25. package/src/lib/scrape.js +40 -40
  26. package/src/lib/url.js +52 -52
  27. package/src/main.mjs +221 -200
  28. package/src/results/user-videos-bar.lar.lar.moeta.json +37 -0
  29. package/src/{auto-core.mjs → scraper/auto-core.mjs} +183 -174
  30. package/src/scraper/core.mjs +188 -182
  31. package/src/{explore-core.mjs → scraper/explore-core.mjs} +159 -148
  32. package/src/scraper/modules/captcha-handler.mjs +114 -0
  33. package/src/scraper/modules/comment-extractor.mjs +69 -57
  34. package/src/scraper/modules/follow-extractor.mjs +121 -121
  35. package/src/scraper/modules/guess-extractor.mjs +51 -51
  36. package/src/scraper/modules/page-error-detector.mjs +70 -68
  37. package/src/scraper/modules/page-helpers.mjs +46 -44
  38. package/src/scraper/modules/scroll-collector.mjs +189 -189
  39. package/src/{get-user-videos-core.mjs → videos/core.mjs} +126 -126
  40. package/src/{data-store.mjs → watch/data-store.mjs} +29 -3
  41. package/src/watch/public/index.html +444 -344
  42. package/src/watch/server.mjs +24 -1
  43. package/src/lib/auto-browser.mjs +0 -6
  44. package/src/lib/get-user-videos-browser.mjs +0 -1
  45. package/src/lib/scrape-browser.mjs +0 -1
  46. package/src/test-auto-follow.cjs +0 -109
  47. package/src/test-extractors.cjs +0 -75
  48. package/src/test-follow.cjs +0 -41
package/src/cli/watch.js CHANGED
@@ -1,28 +1,28 @@
1
- import { writeFileSync, existsSync } from 'fs';
2
- import { startWatchServer, openBrowser } from '../watch/server.mjs';
3
-
4
- export async function handleWatch(options) {
5
- const { outputFile, watchPort } = options;
6
-
7
- if (!outputFile) {
8
- console.error('用法: tt-help watch -o <数据文件> [-p 端口]');
9
- console.error('示例: tt-help watch -o data.json');
10
- console.error(' tt-help watch -o data.json -p 8080');
11
- process.exit(1);
12
- }
13
-
14
- if (!existsSync(outputFile)) {
15
- console.error(`文件不存在: ${outputFile}`);
16
- process.exit(1);
17
- }
18
-
19
- const { server, port } = await startWatchServer(outputFile, watchPort);
20
- openBrowser(port);
21
-
22
- process.once('SIGINT', () => {
23
- server.close();
24
- process.exit(0);
25
- });
26
-
27
- console.error('按 Ctrl+C 停止监控服务');
28
- }
1
+ import { writeFileSync, existsSync } from 'fs';
2
+ import { startWatchServer, openBrowser } from '../watch/server.mjs';
3
+
4
+ export async function handleWatch(options) {
5
+ const { outputFile, watchPort } = options;
6
+
7
+ if (!outputFile) {
8
+ console.error('用法: tt-help watch -o <数据文件> [-p 端口]');
9
+ console.error('示例: tt-help watch -o data.json');
10
+ console.error(' tt-help watch -o data.json -p 8080');
11
+ process.exit(1);
12
+ }
13
+
14
+ if (!existsSync(outputFile)) {
15
+ console.error(`文件不存在: ${outputFile}`);
16
+ process.exit(1);
17
+ }
18
+
19
+ const { server, port } = await startWatchServer(outputFile, watchPort);
20
+ openBrowser(port);
21
+
22
+ process.once('SIGINT', () => {
23
+ server.close();
24
+ process.exit(0);
25
+ });
26
+
27
+ console.error('按 Ctrl+C 停止监控服务');
28
+ }