tt-help-cli-ycl 1.3.34 → 1.3.36

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 (62) hide show
  1. package/README.md +33 -17
  2. package/cli.js +9 -9
  3. package/package.json +49 -47
  4. package/scripts/run-explore copy.bat +101 -101
  5. package/scripts/run-explore.bat +132 -132
  6. package/scripts/run-explore.ps1 +157 -157
  7. package/scripts/run-explore.sh +119 -119
  8. package/scripts/test-captcha-lib.mjs +68 -0
  9. package/scripts/test-captcha.mjs +81 -0
  10. package/scripts/test-incognito-lib.mjs +36 -0
  11. package/scripts/test-login-state.mjs +128 -0
  12. package/scripts/test-safe-click.mjs +45 -0
  13. package/scripts/test-watch-db-smoke.mjs +246 -0
  14. package/src/cli/attach.js +240 -180
  15. package/src/cli/auto.js +265 -240
  16. package/src/cli/comments.js +301 -210
  17. package/src/cli/config.js +170 -152
  18. package/src/cli/db-import.js +51 -0
  19. package/src/cli/explore.js +519 -488
  20. package/src/cli/info.js +88 -88
  21. package/src/cli/open.js +111 -111
  22. package/src/cli/progress.js +111 -111
  23. package/src/cli/refresh.js +288 -216
  24. package/src/cli/scrape.js +47 -47
  25. package/src/cli/utils.js +18 -18
  26. package/src/cli/videos.js +41 -41
  27. package/src/cli/videostats.js +140 -25
  28. package/src/cli/watch.js +30 -31
  29. package/src/lib/args.js +766 -722
  30. package/src/lib/browser/anti-detect.js +23 -23
  31. package/src/lib/browser/cdp.js +261 -261
  32. package/src/lib/browser/health-checker.js +114 -114
  33. package/src/lib/browser/launch.js +43 -43
  34. package/src/lib/browser/page.js +183 -183
  35. package/src/lib/constants.js +238 -216
  36. package/src/lib/delay.js +54 -54
  37. package/src/lib/explore-fetch.js +118 -118
  38. package/src/lib/fetcher.js +45 -45
  39. package/src/lib/filter.js +66 -66
  40. package/src/lib/io.js +54 -54
  41. package/src/lib/output.js +80 -80
  42. package/src/lib/page-error-detector.js +105 -105
  43. package/src/lib/parse-ssr.mjs +69 -69
  44. package/src/lib/parser.js +47 -47
  45. package/src/lib/retry.js +45 -45
  46. package/src/lib/scrape.js +89 -89
  47. package/src/lib/tiktok-scraper.mjs +232 -194
  48. package/src/lib/url.js +52 -52
  49. package/src/main.js +70 -48
  50. package/src/results/user-videos-bar.lar.lar.moeta.json +37 -0
  51. package/src/scraper/auto-core.js +203 -203
  52. package/src/scraper/core.js +211 -211
  53. package/src/scraper/explore-core.js +177 -167
  54. package/src/scraper/modules/captcha-handler.js +114 -114
  55. package/src/scraper/modules/follow-extractor.js +194 -194
  56. package/src/scraper/modules/guess-extractor.js +51 -51
  57. package/src/scraper/modules/page-helpers.js +48 -48
  58. package/src/scraper/refresh-core.js +179 -179
  59. package/src/videos/core.js +125 -125
  60. package/src/watch/data-store.js +2364 -1030
  61. package/src/watch/public/index.html +1494 -753
  62. package/src/watch/server.js +628 -933
@@ -1,194 +1,232 @@
1
- import { chromium } from 'playwright';
2
- import { detectBrowser } from './browser/launch.js';
3
- import { parseUserInfo, parseVideoInfo } from './parse-ssr.mjs';
4
-
5
- const DEFAULT_POOL_SIZE = 3;
6
- const DEFAULT_WAF_TTL = 120000;
7
- const DEFAULT_WARM_URL = 'https://www.tiktok.com/@nike';
8
-
9
- function delay(ms) {
10
- return new Promise(r => setTimeout(r, ms));
11
- }
12
-
13
- class PageSlot {
14
- constructor(page) {
15
- this.page = page;
16
- this.lock = new PromiseQueue();
17
- }
18
- }
19
-
20
- class PromiseQueue {
21
- constructor() {
22
- this._queue = [];
23
- this._processing = false;
24
- }
25
- async run(task) {
26
- return new Promise((resolve, reject) => {
27
- this._queue.push({ task, resolve, reject });
28
- this._process();
29
- });
30
- }
31
- async _process() {
32
- if (this._processing) return;
33
- this._processing = true;
34
- while (this._queue.length > 0) {
35
- const { task, resolve, reject } = this._queue.shift();
36
- try {
37
- const result = await task();
38
- resolve(result);
39
- } catch (e) {
40
- reject(e);
41
- }
42
- }
43
- this._processing = false;
44
- }
45
- }
46
-
47
- export class TikTokScraper {
48
- constructor({ poolSize = DEFAULT_POOL_SIZE, wafTtl = DEFAULT_WAF_TTL, warmUrl = DEFAULT_WARM_URL } = {}) {
49
- this.poolSize = poolSize;
50
- this.wafTtl = wafTtl;
51
- this.warmUrl = warmUrl;
52
- this.browser = null;
53
- this.context = null;
54
- this.slots = [];
55
- this.slotIdx = 0;
56
- this.lastWarmTime = 0;
57
- this.warmPromise = null;
58
- }
59
-
60
- async init() {
61
- const executablePath = detectBrowser();
62
- if (!executablePath) {
63
- throw new Error('未找到本地浏览器(Chrome/Edge),请先安装浏览器或执行 npx playwright install');
64
- }
65
- this.browser = await chromium.launch({
66
- headless: true,
67
- executablePath,
68
- args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage'],
69
- });
70
- this.context = await this.browser.newContext();
71
- for (let i = 0; i < this.poolSize; i++) {
72
- this.slots.push(new PageSlot(await this.context.newPage()));
73
- }
74
- await this.warmWaf();
75
- }
76
-
77
- async close() {
78
- if (this.browser) {
79
- await this.browser.close();
80
- this.browser = null;
81
- this.context = null;
82
- this.slots = [];
83
- }
84
- }
85
-
86
- async restart() {
87
- await this.close();
88
- await this.init();
89
- }
90
-
91
- isAlive() {
92
- try {
93
- return !!(this.browser && this.browser.isConnected());
94
- } catch {
95
- return false;
96
- }
97
- }
98
-
99
- async warmWaf() {
100
- if (this.warmPromise) return this.warmPromise;
101
- this.warmPromise = (async () => {
102
- const page = await this.context.newPage();
103
- try {
104
- await page.goto(this.warmUrl, { waitUntil: 'domcontentloaded', timeout: 15000 });
105
- await delay(1500);
106
- this.lastWarmTime = Date.now();
107
- } catch (e) {
108
- console.error(`[warmWaf] failed: ${e.message}`);
109
- } finally {
110
- await page.close();
111
- this.warmPromise = null;
112
- }
113
- })();
114
- return this.warmPromise;
115
- }
116
-
117
- _needWarm() {
118
- return Date.now() - this.lastWarmTime > this.wafTtl;
119
- }
120
-
121
- _pickSlot() {
122
- const slot = this.slots[this.slotIdx % this.poolSize];
123
- this.slotIdx++;
124
- return slot;
125
- }
126
-
127
- async _ensurePage(slot) {
128
- try {
129
- if (!slot.page.isClosed()) return slot.page;
130
- } catch {}
131
- slot.page = await this.context.newPage();
132
- return slot.page;
133
- }
134
-
135
- async _fetchViewSource(url, slot) {
136
- const page = await this._ensurePage(slot);
137
-
138
- await page.goto('view-source:' + url, {
139
- waitUntil: 'domcontentloaded',
140
- timeout: 15000,
141
- });
142
-
143
- return await page.evaluate(() => {
144
- const rows = document.querySelectorAll('tr');
145
- let content = '';
146
- rows.forEach(r => {
147
- const lc = r.querySelector('.line-content');
148
- if (lc) content += lc.textContent + '\n';
149
- });
150
- return content;
151
- });
152
- }
153
-
154
- async getUserInfo(uniqueId) {
155
- const slot = this._pickSlot();
156
- return slot.lock.run(async () => {
157
- let rawHtml = await this._fetchViewSource(
158
- `https://www.tiktok.com/@${uniqueId}`,
159
- slot
160
- );
161
- let result = parseUserInfo(rawHtml);
162
- if (!result) {
163
- try { await this.warmWaf(); } catch {}
164
- rawHtml = await this._fetchViewSource(
165
- `https://www.tiktok.com/@${uniqueId}`,
166
- slot
167
- );
168
- result = parseUserInfo(rawHtml);
169
- }
170
- return result || null;
171
- });
172
- }
173
-
174
- async getVideoInfo(videoUrl) {
175
- const slot = this._pickSlot();
176
- return slot.lock.run(async () => {
177
- let rawHtml = await this._fetchViewSource(videoUrl, slot);
178
- let result = parseVideoInfo(rawHtml);
179
- if (!result) {
180
- try { await this.warmWaf(); } catch {}
181
- rawHtml = await this._fetchViewSource(videoUrl, slot);
182
- result = parseVideoInfo(rawHtml);
183
- }
184
- return result || null;
185
- });
186
- }
187
-
188
- async getUserAndVideo(videoUrl) {
189
- const video = await this.getVideoInfo(videoUrl);
190
- if (!video) return null;
191
- const user = await this.getUserInfo(video.author.uniqueId);
192
- return { user, video };
193
- }
194
- }
1
+ import { chromium } from "playwright";
2
+ import { detectBrowser } from "./browser/launch.js";
3
+ import { parseUserInfo, parseVideoInfo } from "./parse-ssr.mjs";
4
+
5
+ const DEFAULT_POOL_SIZE = 3;
6
+ const DEFAULT_WAF_TTL = 120000;
7
+ const DEFAULT_WARM_URL = "https://www.tiktok.com/@nike";
8
+ const BROWSER_CLOSE_TIMEOUT = 5000;
9
+
10
+ function delay(ms) {
11
+ return new Promise((r) => setTimeout(r, ms));
12
+ }
13
+
14
+ class PageSlot {
15
+ constructor(page) {
16
+ this.page = page;
17
+ this.lock = new PromiseQueue();
18
+ }
19
+ }
20
+
21
+ class PromiseQueue {
22
+ constructor() {
23
+ this._queue = [];
24
+ this._processing = false;
25
+ }
26
+ async run(task) {
27
+ return new Promise((resolve, reject) => {
28
+ this._queue.push({ task, resolve, reject });
29
+ this._process();
30
+ });
31
+ }
32
+ async _process() {
33
+ if (this._processing) return;
34
+ this._processing = true;
35
+ while (this._queue.length > 0) {
36
+ const { task, resolve, reject } = this._queue.shift();
37
+ try {
38
+ const result = await task();
39
+ resolve(result);
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ }
44
+ this._processing = false;
45
+ }
46
+ }
47
+
48
+ export class TikTokScraper {
49
+ constructor({
50
+ poolSize = DEFAULT_POOL_SIZE,
51
+ wafTtl = DEFAULT_WAF_TTL,
52
+ warmUrl = DEFAULT_WARM_URL,
53
+ } = {}) {
54
+ this.poolSize = poolSize;
55
+ this.wafTtl = wafTtl;
56
+ this.warmUrl = warmUrl;
57
+ this.browser = null;
58
+ this.context = null;
59
+ this.slots = [];
60
+ this.slotIdx = 0;
61
+ this.lastWarmTime = 0;
62
+ this.warmPromise = null;
63
+ }
64
+
65
+ async init() {
66
+ const executablePath = detectBrowser();
67
+ if (!executablePath) {
68
+ throw new Error(
69
+ "未找到本地浏览器(Chrome/Edge),请先安装浏览器或执行 npx playwright install",
70
+ );
71
+ }
72
+ this.browser = await chromium.launch({
73
+ headless: true,
74
+ executablePath,
75
+ handleSIGINT: false,
76
+ handleSIGTERM: false,
77
+ handleSIGHUP: false,
78
+ args: [
79
+ "--no-sandbox",
80
+ "--disable-setuid-sandbox",
81
+ "--disable-dev-shm-usage",
82
+ ],
83
+ });
84
+ this.context = await this.browser.newContext();
85
+ for (let i = 0; i < this.poolSize; i++) {
86
+ this.slots.push(new PageSlot(await this.context.newPage()));
87
+ }
88
+ await this.warmWaf();
89
+ }
90
+
91
+ async close() {
92
+ if (this.browser) {
93
+ const browser = this.browser;
94
+ let closeTimedOut = false;
95
+ const closePromise = browser.close().catch((error) => {
96
+ console.error(
97
+ `[TikTokScraper] browser.close() failed: ${error.message}`,
98
+ );
99
+ });
100
+ await Promise.race([
101
+ closePromise,
102
+ delay(BROWSER_CLOSE_TIMEOUT).then(() => {
103
+ closeTimedOut = true;
104
+ }),
105
+ ]);
106
+ if (closeTimedOut) {
107
+ console.error(
108
+ `[TikTokScraper] browser.close() 超时 ${BROWSER_CLOSE_TIMEOUT}ms,跳过等待并继续退出`,
109
+ );
110
+ }
111
+ this.browser = null;
112
+ this.context = null;
113
+ this.slots = [];
114
+ }
115
+ }
116
+
117
+ async restart() {
118
+ await this.close();
119
+ await this.init();
120
+ }
121
+
122
+ isAlive() {
123
+ try {
124
+ return !!(this.browser && this.browser.isConnected());
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+
130
+ async warmWaf() {
131
+ if (this.warmPromise) return this.warmPromise;
132
+ this.warmPromise = (async () => {
133
+ const page = await this.context.newPage();
134
+ try {
135
+ await page.goto(this.warmUrl, {
136
+ waitUntil: "domcontentloaded",
137
+ timeout: 15000,
138
+ });
139
+ await delay(1500);
140
+ this.lastWarmTime = Date.now();
141
+ } catch (e) {
142
+ console.error(`[warmWaf] failed: ${e.message}`);
143
+ } finally {
144
+ await page.close();
145
+ this.warmPromise = null;
146
+ }
147
+ })();
148
+ return this.warmPromise;
149
+ }
150
+
151
+ _needWarm() {
152
+ return Date.now() - this.lastWarmTime > this.wafTtl;
153
+ }
154
+
155
+ _pickSlot() {
156
+ const slot = this.slots[this.slotIdx % this.poolSize];
157
+ this.slotIdx++;
158
+ return slot;
159
+ }
160
+
161
+ async _ensurePage(slot) {
162
+ try {
163
+ if (!slot.page.isClosed()) return slot.page;
164
+ } catch {}
165
+ slot.page = await this.context.newPage();
166
+ return slot.page;
167
+ }
168
+
169
+ async _fetchViewSource(url, slot) {
170
+ const page = await this._ensurePage(slot);
171
+
172
+ await page.goto("view-source:" + url, {
173
+ waitUntil: "domcontentloaded",
174
+ timeout: 15000,
175
+ });
176
+
177
+ return await page.evaluate(() => {
178
+ const rows = document.querySelectorAll("tr");
179
+ let content = "";
180
+ rows.forEach((r) => {
181
+ const lc = r.querySelector(".line-content");
182
+ if (lc) content += lc.textContent + "\n";
183
+ });
184
+ return content;
185
+ });
186
+ }
187
+
188
+ async getUserInfo(uniqueId) {
189
+ const slot = this._pickSlot();
190
+ return slot.lock.run(async () => {
191
+ let rawHtml = await this._fetchViewSource(
192
+ `https://www.tiktok.com/@${uniqueId}`,
193
+ slot,
194
+ );
195
+ let result = parseUserInfo(rawHtml);
196
+ if (!result) {
197
+ try {
198
+ await this.warmWaf();
199
+ } catch {}
200
+ rawHtml = await this._fetchViewSource(
201
+ `https://www.tiktok.com/@${uniqueId}`,
202
+ slot,
203
+ );
204
+ result = parseUserInfo(rawHtml);
205
+ }
206
+ return result || null;
207
+ });
208
+ }
209
+
210
+ async getVideoInfo(videoUrl) {
211
+ const slot = this._pickSlot();
212
+ return slot.lock.run(async () => {
213
+ let rawHtml = await this._fetchViewSource(videoUrl, slot);
214
+ let result = parseVideoInfo(rawHtml);
215
+ if (!result) {
216
+ try {
217
+ await this.warmWaf();
218
+ } catch {}
219
+ rawHtml = await this._fetchViewSource(videoUrl, slot);
220
+ result = parseVideoInfo(rawHtml);
221
+ }
222
+ return result || null;
223
+ });
224
+ }
225
+
226
+ async getUserAndVideo(videoUrl) {
227
+ const video = await this.getVideoInfo(videoUrl);
228
+ if (!video) return null;
229
+ const user = await this.getUserInfo(video.author.uniqueId);
230
+ return { user, video };
231
+ }
232
+ }
package/src/lib/url.js CHANGED
@@ -1,52 +1,52 @@
1
- const BASE_URL = 'https://www.tiktok.com';
2
-
3
- export function extractUniqueId(url) {
4
- const m = url.match(/\/@([\w.-]+)/);
5
- return m ? m[1] : null;
6
- }
7
-
8
- export function extractVideoId(url) {
9
- const m = url.match(/\/video\/(\d+)/);
10
- return m ? m[1] : null;
11
- }
12
-
13
- export function normalizeUsername(input) {
14
- return (input || '').replace(/^@/, '');
15
- }
16
-
17
- export function toProfileUrl(handle) {
18
- const clean = normalizeUsername(handle);
19
- return `${BASE_URL}/@${clean}`;
20
- }
21
-
22
- export function toVideoUrl(handle, videoId) {
23
- const clean = normalizeUsername(handle);
24
- return `${BASE_URL}/@${clean}/video/${videoId}`;
25
- }
26
-
27
- export function ensureAbsoluteUrl(href) {
28
- if (href.startsWith('http')) return href;
29
- return `${BASE_URL}${href}`;
30
- }
31
-
32
- export function isProfileUrl(url) {
33
- return /\/@[\w.-]+(?:$|[?#])/.test(url);
34
- }
35
-
36
- export function isVideoUrl(url) {
37
- return /\/video\/\d+/.test(url);
38
- }
39
-
40
- export function extractDisplayPath(url) {
41
- try {
42
- const parts = new URL(url).pathname.split('/').filter(Boolean);
43
- return parts.slice(-2).join('/');
44
- } catch {
45
- return url;
46
- }
47
- }
48
-
49
- export function extractAuthorFromVideoUrl(url) {
50
- const m = url.match(/@([^/]+)\/video/);
51
- return m ? '@' + m[1] : null;
52
- }
1
+ const BASE_URL = 'https://www.tiktok.com';
2
+
3
+ export function extractUniqueId(url) {
4
+ const m = url.match(/\/@([\w.-]+)/);
5
+ return m ? m[1] : null;
6
+ }
7
+
8
+ export function extractVideoId(url) {
9
+ const m = url.match(/\/video\/(\d+)/);
10
+ return m ? m[1] : null;
11
+ }
12
+
13
+ export function normalizeUsername(input) {
14
+ return (input || '').replace(/^@/, '');
15
+ }
16
+
17
+ export function toProfileUrl(handle) {
18
+ const clean = normalizeUsername(handle);
19
+ return `${BASE_URL}/@${clean}`;
20
+ }
21
+
22
+ export function toVideoUrl(handle, videoId) {
23
+ const clean = normalizeUsername(handle);
24
+ return `${BASE_URL}/@${clean}/video/${videoId}`;
25
+ }
26
+
27
+ export function ensureAbsoluteUrl(href) {
28
+ if (href.startsWith('http')) return href;
29
+ return `${BASE_URL}${href}`;
30
+ }
31
+
32
+ export function isProfileUrl(url) {
33
+ return /\/@[\w.-]+(?:$|[?#])/.test(url);
34
+ }
35
+
36
+ export function isVideoUrl(url) {
37
+ return /\/video\/\d+/.test(url);
38
+ }
39
+
40
+ export function extractDisplayPath(url) {
41
+ try {
42
+ const parts = new URL(url).pathname.split('/').filter(Boolean);
43
+ return parts.slice(-2).join('/');
44
+ } catch {
45
+ return url;
46
+ }
47
+ }
48
+
49
+ export function extractAuthorFromVideoUrl(url) {
50
+ const m = url.match(/@([^/]+)\/video/);
51
+ return m ? '@' + m[1] : null;
52
+ }
package/src/main.js CHANGED
@@ -1,48 +1,70 @@
1
- import { parseArgs } from './lib/args.js';
2
- import { proxy, HELP_TEXT, getConfigText } from './lib/constants.js';
3
- import { handleInfo } from './cli/info.js';
4
- import { handleExplore } from './cli/explore.js';
5
- import { handleAttach } from './cli/attach.js';
6
- import { handleWatch } from './cli/watch.js';
7
- import { handleConfig, showConfig, showUsage, version } from './cli/config.js';
8
- import { handleOpen } from './cli/open.js';
9
- import { handleComments } from './cli/comments.js';
10
- import { handleVideoStats } from './cli/videostats.js';
11
-
12
- async function main() {
13
- const parsed = parseArgs();
14
-
15
- switch (parsed.subcommand) {
16
- case 'explore': return handleExplore(parsed);
17
- case 'info': return handleInfo(parsed);
18
- case 'attach': return handleAttach(parsed);
19
- case 'watch': return handleWatch(parsed);
20
- case 'open': return handleOpen(parsed);
21
- case 'comments': return handleComments(parsed);
22
- case 'videostats': return handleVideoStats(parsed);
23
- }
24
-
25
- const { urls, outputFile, outputFormat, exploreCount, showConfig: showCfg, showHelp, showVersion, customProxy, configAction, configKey, configValue } = parsed;
26
-
27
- if (showVersion) {
28
- console.log(version);
29
- process.exit(0);
30
- }
31
- if (showHelp) return showUsage();
32
- if (configAction) return handleConfig(configAction, configKey, configValue);
33
- if (showCfg) return showConfig(urls, outputFile);
34
- if (urls.length === 0 && exploreCount === 0) return showUsage();
35
-
36
- // 默认行为:URL 走 info,--explore 走 explore
37
- if (exploreCount > 0) {
38
- return handleExplore({ ...parsed, subcommand: 'explore' });
39
- }
40
-
41
- // 有 URL 默认走 info
42
- return handleInfo(parsed);
43
- }
44
-
45
- main().catch(err => {
46
- console.error(`错误: ${err.message}`);
47
- process.exit(1);
48
- });
1
+ import { parseArgs } from "./lib/args.js";
2
+ import { proxy, HELP_TEXT, getConfigText } from "./lib/constants.js";
3
+ import { handleInfo } from "./cli/info.js";
4
+ import { handleExplore } from "./cli/explore.js";
5
+ import { handleAttach } from "./cli/attach.js";
6
+ import { handleWatch } from "./cli/watch.js";
7
+ import { handleConfig, showConfig, showUsage, version } from "./cli/config.js";
8
+ import { handleOpen } from "./cli/open.js";
9
+ import { handleComments } from "./cli/comments.js";
10
+ import { handleVideoStats } from "./cli/videostats.js";
11
+ import { handleDbImport } from "./cli/db-import.js";
12
+
13
+ async function main() {
14
+ const parsed = parseArgs();
15
+
16
+ switch (parsed.subcommand) {
17
+ case "explore":
18
+ return handleExplore(parsed);
19
+ case "info":
20
+ return handleInfo(parsed);
21
+ case "attach":
22
+ return handleAttach(parsed);
23
+ case "watch":
24
+ return handleWatch(parsed);
25
+ case "open":
26
+ return handleOpen(parsed);
27
+ case "comments":
28
+ return handleComments(parsed);
29
+ case "videostats":
30
+ return handleVideoStats(parsed);
31
+ case "db-import":
32
+ return handleDbImport(parsed);
33
+ }
34
+
35
+ const {
36
+ urls,
37
+ outputFile,
38
+ outputFormat,
39
+ exploreCount,
40
+ showConfig: showCfg,
41
+ showHelp,
42
+ showVersion,
43
+ customProxy,
44
+ configAction,
45
+ configKey,
46
+ configValue,
47
+ } = parsed;
48
+
49
+ if (showVersion) {
50
+ console.log(version);
51
+ process.exit(0);
52
+ }
53
+ if (showHelp) return showUsage();
54
+ if (configAction) return handleConfig(configAction, configKey, configValue);
55
+ if (showCfg) return showConfig(urls, outputFile);
56
+ if (urls.length === 0 && exploreCount === 0) return showUsage();
57
+
58
+ // 默认行为:URL 走 info,--explore 走 explore
59
+ if (exploreCount > 0) {
60
+ return handleExplore({ ...parsed, subcommand: "explore" });
61
+ }
62
+
63
+ // 有 URL 默认走 info
64
+ return handleInfo(parsed);
65
+ }
66
+
67
+ main().catch((err) => {
68
+ console.error(`错误: ${err.message}`);
69
+ process.exit(1);
70
+ });