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.
- package/README.md +17 -17
- package/cli.js +9 -9
- package/package.json +45 -44
- package/src/cli/auto.js +1 -1
- package/src/cli/explore.js +2 -3
- package/src/cli/progress.js +111 -111
- package/src/cli/scrape.js +47 -47
- package/src/cli/utils.js +18 -18
- package/src/cli/videos.js +41 -41
- package/src/cli/watch.js +28 -28
- package/src/lib/args.js +390 -377
- package/src/lib/browser/anti-detect.js +23 -23
- package/src/lib/browser/cdp.js +142 -142
- package/src/lib/browser/launch.js +43 -43
- package/src/lib/browser/page.js +80 -62
- package/src/lib/constants.js +94 -85
- package/src/lib/delay.js +54 -54
- package/src/lib/{explore.js → explore-fetch.js} +118 -118
- package/src/lib/fetcher.js +45 -45
- package/src/lib/filter.js +66 -66
- package/src/lib/io.js +54 -54
- package/src/lib/output.js +80 -80
- package/src/lib/parser.js +47 -47
- package/src/lib/retry.js +44 -44
- package/src/lib/scrape.js +40 -40
- package/src/lib/url.js +52 -52
- package/src/main.mjs +221 -200
- package/src/results/user-videos-bar.lar.lar.moeta.json +37 -0
- package/src/{auto-core.mjs → scraper/auto-core.mjs} +183 -174
- package/src/scraper/core.mjs +188 -182
- package/src/{explore-core.mjs → scraper/explore-core.mjs} +159 -148
- package/src/scraper/modules/captcha-handler.mjs +114 -0
- package/src/scraper/modules/comment-extractor.mjs +69 -57
- package/src/scraper/modules/follow-extractor.mjs +121 -121
- package/src/scraper/modules/guess-extractor.mjs +51 -51
- package/src/scraper/modules/page-error-detector.mjs +70 -68
- package/src/scraper/modules/page-helpers.mjs +46 -44
- package/src/scraper/modules/scroll-collector.mjs +189 -189
- package/src/{get-user-videos-core.mjs → videos/core.mjs} +126 -126
- package/src/{data-store.mjs → watch/data-store.mjs} +29 -3
- package/src/watch/public/index.html +444 -344
- package/src/watch/server.mjs +24 -1
- package/src/lib/auto-browser.mjs +0 -6
- package/src/lib/get-user-videos-browser.mjs +0 -1
- package/src/lib/scrape-browser.mjs +0 -1
- package/src/test-auto-follow.cjs +0 -109
- package/src/test-extractors.cjs +0 -75
- 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
|
+
}
|