tt-help-cli-ycl 1.3.74 → 1.3.76

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.3.74",
3
+ "version": "1.3.76",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli/open.js CHANGED
@@ -94,10 +94,12 @@ export async function handleOpen(parsed) {
94
94
  process.on("SIGINT", async () => {
95
95
  console.error("\n正在关闭浏览器...");
96
96
  try {
97
+ console.error(`[SIGINT] 正在终止 Edge 进程 (userDataDir: ${userDataDir})`);
97
98
  await killEdgeProcesses(userDataDir);
99
+ console.error("[SIGINT] Edge 进程已终止,正在关闭浏览器连接...");
98
100
  await browser.close();
99
- } catch {
100
- /* ignore */
101
+ } catch (e) {
102
+ console.error(`[SIGINT] 关闭浏览器时出错: ${e.message}`);
101
103
  }
102
104
  console.error("浏览器已关闭");
103
105
  process.exit(0);
@@ -109,12 +109,16 @@ function killEdgeProcesses(targetDir) {
109
109
  const ps1Content =
110
110
  `$procs = Get-CimInstance Win32_Process -Filter "Name='msedge.exe'" 2>$null; ` +
111
111
  `$count = 0; ` +
112
+ `$pids = @(); ` +
112
113
  `foreach ($p in $procs) { ` +
113
114
  ` if ($p.CommandLine -and $p.CommandLine -like "*${escapedDir}*") { ` +
115
+ ` $pids += $p.ProcessId; ` +
114
116
  ` Stop-Process -Id $p.ProcessId -Force -ErrorAction SilentlyContinue; ` +
115
117
  ` $count++ ` +
116
118
  ` } ` +
117
119
  `}; ` +
120
+ `Write-Output "KILLED_PIDS: $($pids -join ',')"; ` +
121
+ `Start-Sleep -Milliseconds 500; ` +
118
122
  `Get-ChildItem "$env:LOCALAPPDATA\\Microsoft\\Edge\\Singleton*" -ErrorAction SilentlyContinue | Remove-Item -Force; ` +
119
123
  `Write-Output $count`;
120
124
  fs.writeFileSync(ps1Path, ps1Content);
@@ -123,9 +127,11 @@ function killEdgeProcesses(targetDir) {
123
127
  )
124
128
  .toString()
125
129
  .trim();
126
- fs.unlinkSync(ps1Path);
130
+ console.error(`[killEdgeProcesses] Windows PS result: ${result}`);
131
+ try { fs.unlinkSync(ps1Path); } catch {}
127
132
  command = "exit 0";
128
- } catch {
133
+ } catch (e) {
134
+ console.error(`[killEdgeProcesses] Windows PS failed: ${e.message}`);
129
135
  command = "taskkill /F /IM msedge.exe 2>nul || exit 0";
130
136
  }
131
137
  } else {