tt-help-cli-ycl 1.4.51 → 1.4.52

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.51",
3
+ "version": "1.4.52",
4
4
  "description": "TikTok user & video data scraper - extract ttSeller, verified, locationCreated from HTML source",
5
5
  "type": "module",
6
6
  "bin": {
package/src/lib/args.js CHANGED
@@ -418,7 +418,13 @@ function parseWebserverArgs(args) {
418
418
  } else if (arg === "--proxy") {
419
419
  webserverProxy = args[++i] || null;
420
420
  } else if (arg === "--notify") {
421
- webserverNotify = args[++i] || null;
421
+ const next = args[i + 1];
422
+ // 没写地址或下一个是别的参数 → 使用默认 watch 服务器
423
+ if (!next || next.startsWith("--")) {
424
+ webserverNotify = "http://117.71.53.99:17301";
425
+ } else {
426
+ webserverNotify = args[++i];
427
+ }
422
428
  }
423
429
  }
424
430
 
@@ -246,13 +246,14 @@ const HELP_TEXT = [
246
246
  " -p, --port <端口号> 监听端口,默认 3000",
247
247
  " --pool-size <数量> 浏览器页面池大小,默认 8",
248
248
  " --proxy <地址> HTTP 代理(如 127.0.0.1:7897)",
249
+ " --notify [地址] 验证码通知,默认 http://117.71.53.99:17301",
249
250
  " API:",
250
251
  " GET /health 健康检查",
251
252
  " GET / 服务信息",
252
253
  " POST /api/tiktok/user 获取用户信息 { uniqueId: string }",
253
254
  " POST /api/tiktok/video 获取视频信息 { videoUrl: string }",
254
255
  " POST /api/tiktok/lookup 同时获取视频和作者信息 { videoUrl: string }",
255
- " 示例: tt-help webserver -p 3000 --pool-size 8 --proxy 127.0.0.1:7897",
256
+ " 示例: tt-help webserver -p 3000 --pool-size 8 --proxy 127.0.0.1:7897 --notify",
256
257
  "",
257
258
  " comments [选项]",
258
259
  " 评论采集:从视频评论中发现新用户,来源标记为 comment",
@@ -200,6 +200,10 @@ async function handleTiktokProduct(req, res) {
200
200
  if (!body.url) {
201
201
  return sendJSON(res, 400, { error: "missing url" });
202
202
  }
203
+ const clientIP =
204
+ req.headers["x-forwarded-for"]?.split(",")[0]?.trim() ||
205
+ req.socket.remoteAddress ||
206
+ "";
203
207
  // URL 标准化:www.tiktok.com/shop/pdp → shop.tiktok.com/us/pdp
204
208
  const normalizedUrl = body.url.replace(
205
209
  "www.tiktok.com/shop/pdp",
@@ -213,9 +217,13 @@ async function handleTiktokProduct(req, res) {
213
217
  captchaFallback: false,
214
218
  },
215
219
  );
220
+ console.error(
221
+ `[webserver] product OK | ${clientIP} | rating=${result.rating ?? "-"} sold=${result.soldCount ?? "-"} name=${(result.productName || "").slice(0, 40)}`,
222
+ );
216
223
  return sendJSON(res, 200, result);
217
224
  } catch (e) {
218
225
  // 先返回错误,不阻塞请求
226
+ console.error(`[webserver] product FAIL | ${clientIP} | ${e.message}`);
219
227
  sendJSON(res, 502, { error: e.message });
220
228
 
221
229
  // 如果是 captcha,异步弹浏览器(不阻塞其他请求)