tt-help-cli-ycl 1.4.27 → 1.4.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-help-cli-ycl",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { chromium } from "playwright";
3
+ import path from "path";
4
+ import { searchAndSave } from "../src/lib/search-collector.js";
5
+
6
+ const keyword = process.argv[2];
7
+ if (!keyword) {
8
+ console.error("用法: node scripts/search-authors.mjs <关键词> [CDP端口]");
9
+ process.exit(1);
10
+ }
11
+
12
+ const port = parseInt(process.argv[3] || "9223", 10);
13
+ const file = path.resolve(`../newdata/search-${keyword}-authors.txt`);
14
+ const browser = await chromium.connectOverCDP(`http://127.0.0.1:${port}`);
15
+
16
+ const ids = await searchAndSave(browser, keyword, file);
17
+ console.error(`文件: ${file} (${ids.length} 个)\n`);
18
+ for (const id of ids) console.log(id);
19
+
20
+ await browser.close();
21
+ process.exit(0);