tt-help-cli-ycl 1.3.12 → 1.3.14

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 (55) hide show
  1. package/README.md +17 -17
  2. package/cli.js +9 -9
  3. package/package.json +47 -45
  4. package/scripts/run-explore.bat +68 -68
  5. package/scripts/run-explore.ps1 +81 -81
  6. package/scripts/run-explore.sh +73 -73
  7. package/scripts/test-captcha-lib.mjs +68 -0
  8. package/scripts/test-captcha.mjs +81 -0
  9. package/scripts/test-incognito-lib.mjs +36 -0
  10. package/scripts/test-login-state.mjs +128 -0
  11. package/scripts/test-safe-click.mjs +45 -0
  12. package/src/cli/attach.js +160 -0
  13. package/src/cli/auto.js +186 -157
  14. package/src/cli/config.js +39 -3
  15. package/src/cli/explore.js +234 -193
  16. package/src/cli/info.js +88 -0
  17. package/src/cli/progress.js +111 -111
  18. package/src/cli/refresh.js +216 -0
  19. package/src/cli/scrape.js +47 -47
  20. package/src/cli/utils.js +18 -18
  21. package/src/cli/videos.js +41 -41
  22. package/src/cli/watch.js +31 -31
  23. package/src/lib/args.js +517 -402
  24. package/src/lib/browser/anti-detect.js +23 -23
  25. package/src/lib/browser/cdp.js +52 -10
  26. package/src/lib/browser/launch.js +43 -43
  27. package/src/lib/browser/page.js +146 -87
  28. package/src/lib/constants.js +199 -115
  29. package/src/lib/delay.js +54 -54
  30. package/src/lib/explore-fetch.js +118 -118
  31. package/src/lib/fetcher.js +45 -45
  32. package/src/lib/filter.js +66 -66
  33. package/src/lib/io.js +54 -54
  34. package/src/lib/output.js +80 -80
  35. package/src/lib/parse-ssr.mjs +69 -0
  36. package/src/lib/parser.js +47 -47
  37. package/src/lib/retry.js +45 -45
  38. package/src/lib/scrape.js +89 -40
  39. package/src/lib/tiktok-scraper.mjs +176 -0
  40. package/src/lib/url.js +52 -52
  41. package/src/main.js +12 -16
  42. package/src/results/user-videos-bar.lar.lar.moeta.json +37 -0
  43. package/src/scraper/auto-core.js +203 -194
  44. package/src/scraper/core.js +211 -190
  45. package/src/scraper/explore-core.js +162 -171
  46. package/src/scraper/modules/captcha-handler.js +114 -114
  47. package/src/scraper/modules/comment-extractor.js +74 -69
  48. package/src/scraper/modules/follow-extractor.js +121 -121
  49. package/src/scraper/modules/guess-extractor.js +51 -51
  50. package/src/scraper/modules/page-helpers.js +48 -48
  51. package/src/scraper/refresh-core.js +179 -0
  52. package/src/videos/core.js +126 -126
  53. package/src/watch/data-store.js +536 -302
  54. package/src/watch/public/index.html +721 -701
  55. package/src/watch/server.js +527 -359
package/src/cli/watch.js CHANGED
@@ -1,31 +1,31 @@
1
- import { existsSync } from 'fs';
2
- import { createStore } from '../watch/data-store.js';
3
- import { startWatchServer, openBrowser } from '../watch/server.js';
4
-
5
- export async function handleWatch(options) {
6
- const { outputFile, watchPort } = options;
7
-
8
- if (!outputFile) {
9
- console.error('用法: tt-help watch -o <数据文件> [-p 端口]');
10
- console.error('示例: tt-help watch -o data.json');
11
- console.error(' tt-help watch -o data.json -p 8080');
12
- process.exit(1);
13
- }
14
-
15
- if (!existsSync(outputFile)) {
16
- console.error(`文件不存�? ${outputFile}`);
17
- process.exit(1);
18
- }
19
-
20
- const store = createStore(outputFile);
21
- const { server, port } = await startWatchServer(outputFile, watchPort, store);
22
- openBrowser(port);
23
-
24
- process.once('SIGINT', () => {
25
- store.stopBackup();
26
- server.close();
27
- process.exit(0);
28
- });
29
-
30
- console.error('�?Ctrl+C 停止监控服务');
31
- }
1
+ import { existsSync } from 'fs';
2
+ import { createStore } from '../watch/data-store.js';
3
+ import { startWatchServer, openBrowser } from '../watch/server.js';
4
+
5
+ export async function handleWatch(options) {
6
+ const { outputFile, watchPort } = options;
7
+
8
+ if (!outputFile) {
9
+ console.error('用法: tt-help watch -o <数据文件> [-p 端口]');
10
+ console.error('示例: tt-help watch -o data.json');
11
+ console.error(' tt-help watch -o data.json -p 8080');
12
+ process.exit(1);
13
+ }
14
+
15
+ if (!existsSync(outputFile)) {
16
+ console.error(`文件不存�? ${outputFile}`);
17
+ process.exit(1);
18
+ }
19
+
20
+ const store = createStore(outputFile);
21
+ const { server, port } = await startWatchServer(outputFile, watchPort, store);
22
+ openBrowser(port);
23
+
24
+ process.once('SIGINT', () => {
25
+ store.stopBackup();
26
+ server.close();
27
+ process.exit(0);
28
+ });
29
+
30
+ console.error('�?Ctrl+C 停止监控服务');
31
+ }