tt-help-cli-ycl 1.3.11 → 1.3.13

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 (61) hide show
  1. package/README.md +17 -17
  2. package/cli.js +9 -9
  3. package/package.json +45 -46
  4. package/{bat → scripts}/run-explore.bat +68 -68
  5. package/{bat → scripts}/run-explore.ps1 +81 -81
  6. package/{bat → 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/auto.js +186 -157
  13. package/src/cli/config.js +116 -0
  14. package/src/cli/explore-default.js +83 -0
  15. package/src/cli/explore.js +227 -181
  16. package/src/cli/progress.js +111 -111
  17. package/src/cli/refresh.js +216 -0
  18. package/src/cli/scrape.js +47 -47
  19. package/src/cli/utils.js +18 -18
  20. package/src/cli/videos.js +41 -41
  21. package/src/cli/watch.js +31 -31
  22. package/src/lib/args.js +456 -391
  23. package/src/lib/browser/anti-detect.js +23 -23
  24. package/src/lib/browser/cdp.js +194 -142
  25. package/src/lib/browser/launch.js +43 -43
  26. package/src/lib/browser/page.js +146 -87
  27. package/src/lib/constants.js +119 -119
  28. package/src/lib/delay.js +54 -54
  29. package/src/lib/explore-fetch.js +118 -118
  30. package/src/lib/fetcher.js +45 -45
  31. package/src/lib/filter.js +66 -66
  32. package/src/lib/io.js +54 -54
  33. package/src/lib/output.js +80 -80
  34. package/src/{scraper/modules/page-error-detector.mjs → lib/page-error-detector.js} +70 -70
  35. package/src/lib/parser.js +47 -47
  36. package/src/lib/retry.js +45 -45
  37. package/src/lib/scrape.js +40 -40
  38. package/src/{scraper/modules/scroll-collector.mjs → lib/scroll-collector.js} +231 -189
  39. package/src/lib/url.js +52 -52
  40. package/src/main.js +48 -0
  41. package/src/results/user-videos-bar.lar.lar.moeta.json +37 -0
  42. package/src/scraper/{auto-core.mjs → auto-core.js} +203 -194
  43. package/src/scraper/{core.mjs → core.js} +211 -190
  44. package/src/scraper/{explore-core.mjs → explore-core.js} +180 -171
  45. package/src/scraper/modules/{captcha-handler.mjs → captcha-handler.js} +114 -114
  46. package/src/scraper/modules/{comment-extractor.mjs → comment-extractor.js} +74 -69
  47. package/src/scraper/modules/{follow-extractor.mjs → follow-extractor.js} +121 -121
  48. package/src/scraper/modules/{guess-extractor.mjs → guess-extractor.js} +51 -51
  49. package/src/scraper/modules/page-error-detector.js +1 -0
  50. package/src/scraper/modules/{page-helpers.mjs → page-helpers.js} +48 -48
  51. package/src/scraper/modules/scroll-collector.js +8 -0
  52. package/src/scraper/refresh-core.js +179 -0
  53. package/src/videos/{core.mjs → core.js} +126 -126
  54. package/src/watch/data-store.js +431 -0
  55. package/src/watch/public/index.html +721 -690
  56. package/src/watch/{server.mjs → server.js} +484 -349
  57. package/src/main.mjs +0 -234
  58. package/src/test-auto-follow.cjs +0 -109
  59. package/src/test-extractors.cjs +0 -75
  60. package/src/test-follow.cjs +0 -41
  61. package/src/watch/data-store.mjs +0 -274
package/src/cli/watch.js CHANGED
@@ -1,31 +1,31 @@
1
- import { existsSync } from 'fs';
2
- import { createStore } from '../watch/data-store.mjs';
3
- import { startWatchServer, openBrowser } from '../watch/server.mjs';
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
+ }