tt-help-cli-ycl 1.4.50 → 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.50",
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": {
@@ -388,7 +388,6 @@ export async function handleExplore(options) {
388
388
  {
389
389
  maxVideos: exploreMaxVideos,
390
390
  enableFollow: exploreEnableFollow,
391
- enableVideos: false,
392
391
  loggedIn, // 传入登录状态,避免每次调用 isLoggedIn(page)
393
392
  maxFollowing: exploreMaxFollowing,
394
393
  maxFollowers: exploreMaxFollowers,
@@ -416,7 +415,6 @@ export async function handleExplore(options) {
416
415
  maxVideos: exploreMaxVideos,
417
416
  enableFollow: exploreEnableFollow,
418
417
  loggedIn, // 传入登录状态
419
- enableVideos: false,
420
418
  maxFollowing: exploreMaxFollowing,
421
419
  maxFollowers: exploreMaxFollowers,
422
420
  location: exploreLocation,
@@ -465,7 +463,6 @@ export async function handleExplore(options) {
465
463
  maxVideos: exploreMaxVideos,
466
464
  enableFollow: exploreEnableFollow,
467
465
  loggedIn,
468
- enableVideos: false,
469
466
  maxFollowing: exploreMaxFollowing,
470
467
  maxFollowers: exploreMaxFollowers,
471
468
  location: exploreLocation,
@@ -588,21 +585,21 @@ export async function handleExplore(options) {
588
585
  };
589
586
  await apiPost(`${serverUrl}/api/job/${username}`, payload);
590
587
 
591
- // 视频登记
592
- if (result.videoList && result.videoList.length > 0) {
593
- const { registered, skipped } = await apiPost(
594
- `${serverUrl}/api/videos`,
595
- {
596
- sourceUser: username,
597
- videoList: result.videoList,
598
- locationCreated: result.locationCreated,
599
- ttSeller: result.userInfo?.ttSeller || false,
600
- },
601
- );
602
- console.error(
603
- ` 视频登记: ${registered} 条新增, ${skipped} 条已存在`,
604
- );
605
- }
588
+ // 视频登记(暂时关闭)
589
+ // if (result.videoList && result.videoList.length > 0) {
590
+ // const { registered, skipped } = await apiPost(
591
+ // `${serverUrl}/api/videos`,
592
+ // {
593
+ // sourceUser: username,
594
+ // videoList: result.videoList,
595
+ // locationCreated: result.locationCreated,
596
+ // ttSeller: result.userInfo?.ttSeller || false,
597
+ // },
598
+ // );
599
+ // console.error(
600
+ // ` 视频登记: ${registered} 条新增, ${skipped} 条已存在`,
601
+ // );
602
+ // }
606
603
 
607
604
  console.error(" 已提交");
608
605
 
@@ -398,7 +398,6 @@ export async function handleRefresh(options) {
398
398
  {
399
399
  maxVideos: exploreMaxVideos || 16,
400
400
  enableFollow: exploreEnableFollow !== false,
401
- enableVideos: false,
402
401
  loggedIn,
403
402
  maxFollowing: exploreMaxFollowing || 100,
404
403
  maxFollowers: exploreMaxFollowers || 100,
@@ -426,7 +425,6 @@ export async function handleRefresh(options) {
426
425
  {
427
426
  maxVideos: exploreMaxVideos || 16,
428
427
  enableFollow: exploreEnableFollow !== false,
429
- enableVideos: false,
430
428
  loggedIn,
431
429
  maxFollowing: exploreMaxFollowing || 100,
432
430
  maxFollowers: exploreMaxFollowers || 100,
@@ -476,7 +474,6 @@ export async function handleRefresh(options) {
476
474
  {
477
475
  maxVideos: exploreMaxVideos || 16,
478
476
  enableFollow: exploreEnableFollow !== false,
479
- enableVideos: false,
480
477
  loggedIn,
481
478
  maxFollowing: exploreMaxFollowing || 100,
482
479
  maxFollowers: exploreMaxFollowers || 100,
@@ -608,19 +605,19 @@ export async function handleRefresh(options) {
608
605
  };
609
606
  await apiPost(`${serverUrl}/api/redo-job/${username}`, payload);
610
607
 
611
- // 视频登记
612
- if (result.videoList && result.videoList.length > 0) {
613
- const { registered, skipped } = await apiPost(
614
- `${serverUrl}/api/videos`,
615
- {
616
- sourceUser: username,
617
- videoList: result.videoList,
618
- locationCreated: refreshLocation,
619
- ttSeller: result.userInfo?.ttSeller || false,
620
- },
621
- );
622
- console.error(` 视频登记: ${registered} 条新增, ${skipped} 条已存在`);
623
- }
608
+ // 视频登记(暂时关闭)
609
+ // if (result.videoList && result.videoList.length > 0) {
610
+ // const { registered, skipped } = await apiPost(
611
+ // `${serverUrl}/api/videos`,
612
+ // {
613
+ // sourceUser: username,
614
+ // videoList: result.videoList,
615
+ // locationCreated: result.locationCreated,
616
+ // ttSeller: result.userInfo?.ttSeller || false,
617
+ // },
618
+ // );
619
+ // console.error(` 视频登记: ${registered} 条新增, ${skipped} 条已存在`);
620
+ // }
624
621
 
625
622
  console.error(" 已提交");
626
623
 
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",
@@ -60,10 +60,7 @@ async function processExplore(page, username, options, log) {
60
60
 
61
61
  try {
62
62
  log(` 访问 @${username} 主页...`);
63
- const videoList =
64
- options.enableVideos !== false
65
- ? await collectVideos(page, username, maxVideos, log)
66
- : null;
63
+ const videoList = await collectVideos(page, username, maxVideos, log);
67
64
 
68
65
  log(" 获取用户信息...");
69
66
  const info = await getUserInfo(page);
@@ -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,异步弹浏览器(不阻塞其他请求)