@iflyrpa/actions 4.0.5 → 4.0.6-beta.1

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/dist/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c189d61d-9a94-5bff-b7c8-cf06b1e1a99a")}catch(e){}}();
1
3
  import * as __WEBPACK_EXTERNAL_MODULE_crypto__ from "crypto";
2
4
  import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
3
5
  import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_package_json_58ae5f06__ from "@iflyrpa/share/package.json";
@@ -4350,9 +4352,7 @@ function __webpack_require__(moduleId) {
4350
4352
  return module;
4351
4353
  };
4352
4354
  })();
4353
- var package_namespaceObject = {
4354
- i8: "4.0.5"
4355
- };
4355
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.6-beta.1"}');
4356
4356
  const PROXY_CREDENTIALS = [
4357
4357
  {
4358
4358
  ip: "47.110.131.129",
@@ -4439,15 +4439,14 @@ function buildProxyUrl(ip, port) {
4439
4439
  }
4440
4440
  return `socks5h://${ip}:${port}`;
4441
4441
  }
4442
- async function ProxyAgent(task, ip, adr, accountId, refresh) {
4442
+ async function ProxyAgent(task, addr, accountId, refresh) {
4443
4443
  const http = new Http({
4444
4444
  headers: {
4445
4445
  "content-type": "application/json"
4446
4446
  }
4447
4447
  });
4448
4448
  const params = {
4449
- ip: ip,
4450
- addr: adr || null,
4449
+ addr: addr || null,
4451
4450
  accountId: accountId
4452
4451
  };
4453
4452
  const ProxyInfo = await http.api({
@@ -4469,7 +4468,7 @@ async function ProxyAgent(task, ip, adr, accountId, refresh) {
4469
4468
  data: ProxyInfo.data
4470
4469
  }
4471
4470
  };
4472
- task.logger?.info(`请求代理:区域:${params.addr}, IP:${params.ip}, AccountId:${params.accountId}, 返回代理信息: ${ProxyInfo.data ? `${ProxyInfo.data.proxyIp}:${ProxyInfo.data.proxyPort}` : "无可用代理"}`, loggerInfo);
4471
+ task.logger?.info(`请求代理:区域:${params.addr}, AccountId:${params.accountId}, 返回代理信息: ${ProxyInfo.data ? `${ProxyInfo.data.proxyIp}:${ProxyInfo.data.proxyPort}` : "无可用代理"}`, loggerInfo);
4473
4472
  const proxyAgent = "000000" === ProxyInfo.code && ProxyInfo.data ? {
4474
4473
  ip: ProxyInfo.data.proxyIp,
4475
4474
  port: ProxyInfo.data.proxyPort,
@@ -4486,16 +4485,16 @@ class Http {
4486
4485
  data: error
4487
4486
  };
4488
4487
  }
4489
- constructor(config, logger, adr, ip, accountId, platform){
4488
+ constructor(config, logger, addr, accountId, platform){
4490
4489
  this.agentPromise = void 0;
4491
4490
  this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
4492
4491
  ...config
4493
4492
  });
4494
4493
  this.logger = logger;
4495
4494
  this.platform = platform;
4496
- if (ip) this.agentPromise = ProxyAgent({
4495
+ if (addr) this.agentPromise = ProxyAgent({
4497
4496
  logger
4498
- }, ip, adr, accountId);
4497
+ }, addr, accountId);
4499
4498
  this.addResponseInterceptor(()=>void 0);
4500
4499
  }
4501
4500
  clearResponseInterceptors() {
@@ -4585,11 +4584,12 @@ class Http {
4585
4584
  this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
4586
4585
  errorString: stringifyError(error)
4587
4586
  });
4588
- _message = `未知网络错误: ${error.message}`;
4587
+ _message = `网络错误: ${error.message}`;
4589
4588
  break;
4590
4589
  }
4591
4590
  }
4592
- errorResponse.message = errorResponse.message ? errorResponse.message : _message;
4591
+ if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
4592
+ else errorResponse.message = errorResponse.message ? errorResponse.message : _message;
4593
4593
  if ("canceled" === errorResponse.message) {
4594
4594
  const message = errorResponse.extra?.isProxyRequest ? "代理连接建立超时,请更换区域或稍后重试!" : "网络请求超时,请稍后重试!";
4595
4595
  errorResponse.message = message;
@@ -8652,16 +8652,11 @@ const rpaServer = async (task, params)=>{
8652
8652
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
8653
8653
  let executionState;
8654
8654
  let proxyUrl;
8655
- if (params.localIP) {
8656
- const args = [
8657
- params.localIP,
8658
- params.proxyLoc,
8659
- params.accountId
8660
- ];
8661
- task.logger?.info(`==> 开始获取代理信息:${args}`);
8655
+ if (params.proxyLoc) {
8656
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
8662
8657
  const ProxyAgentResult = await ProxyAgent({
8663
8658
  logger: task.logger
8664
- }, ...args);
8659
+ }, params.proxyLoc, params.accountId);
8665
8660
  task.logger?.info("==> 代理信息获取成功!");
8666
8661
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
8667
8662
  }
@@ -9004,7 +8999,6 @@ const mockAction = async (task, params)=>{
9004
8999
  },
9005
9000
  task.logger,
9006
9001
  params.proxyLoc,
9007
- params.localIP,
9008
9002
  params.accountId,
9009
9003
  "baijiahao"
9010
9004
  ];
@@ -9210,7 +9204,6 @@ const mockAction = async (task, params)=>{
9210
9204
  enverionment: task.enverionment || "development",
9211
9205
  postId: params.articleId,
9212
9206
  eip: proxyHttp.proxyInfo,
9213
- proxyIp: params.localIP,
9214
9207
  accountId: params.accountId,
9215
9208
  uid: params.uid,
9216
9209
  platform: "baijiahao",
@@ -9729,7 +9722,6 @@ const XhsFansExport = async (_task, params)=>{
9729
9722
  },
9730
9723
  _task.logger,
9731
9724
  params.proxyLoc,
9732
- params.localIP,
9733
9725
  params.accountId
9734
9726
  ];
9735
9727
  const http = new Http(...args);
@@ -10859,7 +10851,7 @@ const XhsSessionCheck = async (_task, params)=>{
10859
10851
  heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
10860
10852
  },
10861
10853
  accountId: params.accountId,
10862
- hasProxy: !!(params.proxyLoc || params.localIP)
10854
+ hasProxy: !!params.proxyLoc
10863
10855
  });
10864
10856
  }
10865
10857
  const check = {
@@ -10882,7 +10874,6 @@ const XhsSessionCheck = async (_task, params)=>{
10882
10874
  },
10883
10875
  _task.logger,
10884
10876
  params.proxyLoc,
10885
- params.localIP,
10886
10877
  params.accountId
10887
10878
  ];
10888
10879
  const http = new Http(...args);
@@ -10913,7 +10904,7 @@ const XhsSessionCheck = async (_task, params)=>{
10913
10904
  heapUsed: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB`,
10914
10905
  heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
10915
10906
  },
10916
- hasProxy: !!(params.proxyLoc || params.localIP),
10907
+ hasProxy: !!params.proxyLoc,
10917
10908
  timeSinceLastLog: Date.now() - lastEnvLogTime
10918
10909
  }
10919
10910
  });
@@ -11311,7 +11302,6 @@ const douyinCreateCommentReply = async (_task, params)=>{
11311
11302
  },
11312
11303
  _task.logger,
11313
11304
  params.proxyLoc,
11314
- params.localIP,
11315
11305
  params.accountId
11316
11306
  ];
11317
11307
  const http = new Http(...args);
@@ -11398,7 +11388,6 @@ const douyinGetCollection = async (_task, params)=>{
11398
11388
  },
11399
11389
  _task.logger,
11400
11390
  params.proxyLoc,
11401
- params.localIP,
11402
11391
  params.accountId
11403
11392
  ];
11404
11393
  const http = new Http(...args);
@@ -11489,7 +11478,6 @@ const douyinGetCommentList = async (_task, params)=>{
11489
11478
  },
11490
11479
  _task.logger,
11491
11480
  params.proxyLoc,
11492
- params.localIP,
11493
11481
  params.accountId
11494
11482
  ];
11495
11483
  const http = new Http(...args);
@@ -11575,7 +11563,6 @@ const douyinGetCommentReplyList = async (_task, params)=>{
11575
11563
  },
11576
11564
  _task.logger,
11577
11565
  params.proxyLoc,
11578
- params.localIP,
11579
11566
  params.accountId
11580
11567
  ];
11581
11568
  const http = new Http(...args);
@@ -11659,7 +11646,6 @@ const douyinGetHot = async (_task, params)=>{
11659
11646
  },
11660
11647
  _task.logger,
11661
11648
  params.proxyLoc,
11662
- params.localIP,
11663
11649
  params.accountId
11664
11650
  ];
11665
11651
  const http = new Http(...args);
@@ -11755,7 +11741,6 @@ const douyinGetLocation = async (_task, params)=>{
11755
11741
  },
11756
11742
  _task.logger,
11757
11743
  params.proxyLoc,
11758
- params.localIP,
11759
11744
  params.accountId
11760
11745
  ];
11761
11746
  const http = new Http(...args);
@@ -11854,7 +11839,6 @@ const douyinGetMusic = async (_task, params)=>{
11854
11839
  },
11855
11840
  _task.logger,
11856
11841
  params.proxyLoc,
11857
- params.localIP,
11858
11842
  params.accountId
11859
11843
  ];
11860
11844
  const http = new Http(...args);
@@ -12000,7 +11984,6 @@ const douyinGetMusicByCategory = async (_task, params)=>{
12000
11984
  },
12001
11985
  _task.logger,
12002
11986
  params.proxyLoc,
12003
- params.localIP,
12004
11987
  params.accountId
12005
11988
  ];
12006
11989
  const http = new Http(...args);
@@ -12088,7 +12071,6 @@ const douyinGetMusicCategory = async (_task, params)=>{
12088
12071
  },
12089
12072
  _task.logger,
12090
12073
  params.proxyLoc,
12091
- params.localIP,
12092
12074
  params.accountId
12093
12075
  ];
12094
12076
  const http = new Http(...args);
@@ -12176,7 +12158,6 @@ const douyinGetTopics = async (_task, params)=>{
12176
12158
  },
12177
12159
  _task.logger,
12178
12160
  params.proxyLoc,
12179
- params.localIP,
12180
12161
  params.accountId
12181
12162
  ];
12182
12163
  const http = new Http(...args);
@@ -12397,7 +12378,6 @@ const douyinGetWorkList = async (_task, params)=>{
12397
12378
  },
12398
12379
  _task.logger,
12399
12380
  params.proxyLoc,
12400
- params.localIP,
12401
12381
  params.accountId
12402
12382
  ];
12403
12383
  const http = new Http(...args);
@@ -12759,16 +12739,11 @@ const rpa_server_rpaServer = async (task, params)=>{
12759
12739
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
12760
12740
  let executionState;
12761
12741
  let proxyUrl;
12762
- if (params.localIP) {
12763
- const args = [
12764
- params.localIP,
12765
- params.proxyLoc,
12766
- params.accountId
12767
- ];
12768
- task.logger?.info(`==> 开始获取代理信息:${args}`);
12742
+ if (params.proxyLoc) {
12743
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
12769
12744
  const ProxyAgentResult = await ProxyAgent({
12770
12745
  logger: task.logger
12771
- }, ...args);
12746
+ }, params.proxyLoc, params.accountId);
12772
12747
  task.logger?.info("==> 代理信息获取成功!");
12773
12748
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
12774
12749
  }
@@ -13367,408 +13342,427 @@ function generateRandomString(length) {
13367
13342
  }
13368
13343
  return randomString;
13369
13344
  }
13345
+ function safeSerialize(obj) {
13346
+ if (!obj || "object" != typeof obj) return obj;
13347
+ try {
13348
+ return JSON.parse(JSON.stringify(obj));
13349
+ } catch (error) {
13350
+ return {};
13351
+ }
13352
+ }
13370
13353
  const mock_mockAction = async (task, params)=>{
13371
13354
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
13372
- if (!params.extraParam || !params.extraParam["security-sdk/s_sdk_pri_key"] || !params.extraParam["security-sdk/s_sdk_pub_key"] || !params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || !params.extraParam["security-sdk/s_sdk_server_cert_key"] || !params.extraParam["security-sdk/s_sdk_crypt_sdk"]) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "extraParam 参数缺失或不完整", "");
13373
- const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
13374
- const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
13375
- if (!sessionidCookie) return {
13376
- code: 414,
13377
- message: "账号数据异常,请重新绑定账号后重试。",
13378
- data: ""
13379
- };
13380
- const headers = {
13381
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
13382
- origin: "https://creator.douyin.com",
13383
- referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13384
- Accept: "application/json, text/plain, */*",
13385
- "Accept-Encoding": "gzip, deflate, br, zstd",
13386
- "Content-Type": "application/json",
13387
- pragma: "no-cache",
13388
- "cache-control": "no-cache",
13389
- "sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
13390
- "sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
13391
- "bd-ticket-guard-web-version": "2",
13392
- "sec-ch-ua-mobile": "?0",
13393
- "user-agent": userAgent,
13394
- "sec-fetch-site": "same-origin",
13395
- "sec-fetch-mode": "cors",
13396
- "sec-fetch-dest": "empty",
13397
- "accept-language": "zh-CN,zh;q=0.9",
13398
- priority: "u=1, i"
13399
- };
13400
- const publishParams = {
13401
- read_aid: "2906",
13402
- aid: "1128",
13403
- cookie_enabled: "true",
13404
- screen_width: params.extraParam?.browserInfo.screen_width || "1920",
13405
- screen_height: params.extraParam?.browserInfo.screen_height || "1080",
13406
- browser_language: params.extraParam?.browserInfo.browser_language || "zh-CN",
13407
- browser_platform: params.extraParam?.browserInfo.browser_platform || "Win32",
13408
- browser_name: params.extraParam?.browserInfo.browser_name || "Mozilla",
13409
- browser_version: userAgent,
13410
- browser_online: "true",
13411
- timezone_name: "Asia/Shanghai",
13412
- support_h265: "1",
13413
- msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
13414
- a_bogus: ""
13415
- };
13416
- task.logger.info(`[douyinPublish] publishParams ${JSON.stringify(publishParams)}`);
13417
- const publishData = {
13418
- item: {
13419
- common: {
13420
- text: params.content,
13421
- text_extra: params.textExtra,
13422
- activity: "[]",
13423
- challenges: params.challengeIds || "[]",
13424
- hashtag_source: "",
13425
- mentions: "[]",
13426
- music_id: params.musicId || "",
13427
- music_end_time: 1000 * (params.musicDuration || 0),
13428
- hot_sentence: params.hotSentence || "",
13429
- visibility_type: Number(params.visibleRange) || 0,
13430
- download: params.allowSave ? 1 : 0,
13431
- timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
13432
- media_type: Number(params.publishType) || 2,
13433
- images: [],
13434
- creation_id: ""
13435
- },
13436
- cover: {
13437
- poster: ""
13355
+ if (!params.extraParam || !params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || !params.extraParam["security-sdk/s_sdk_server_cert_key"] || !params.extraParam["security-sdk/s_sdk_crypt_sdk"]) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "extraParam 参数缺失或不完整", "");
13356
+ let currentStep = "初始化";
13357
+ try {
13358
+ currentStep = "验证账号信息";
13359
+ const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
13360
+ const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
13361
+ if (!sessionidCookie) return {
13362
+ code: 414,
13363
+ message: "账号数据异常,请重新绑定账号后重试。",
13364
+ data: ""
13365
+ };
13366
+ currentStep = "准备请求参数";
13367
+ const headers = {
13368
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
13369
+ origin: "https://creator.douyin.com",
13370
+ referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13371
+ Accept: "application/json, text/plain, */*",
13372
+ "Accept-Encoding": "gzip, deflate, br, zstd",
13373
+ "Content-Type": "application/json",
13374
+ pragma: "no-cache",
13375
+ "cache-control": "no-cache",
13376
+ "sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
13377
+ "sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
13378
+ "bd-ticket-guard-web-version": "2",
13379
+ "sec-ch-ua-mobile": "?0",
13380
+ "user-agent": userAgent,
13381
+ "sec-fetch-site": "same-origin",
13382
+ "sec-fetch-mode": "cors",
13383
+ "sec-fetch-dest": "empty",
13384
+ "accept-language": "zh-CN,zh;q=0.9",
13385
+ priority: "u=1, i"
13386
+ };
13387
+ const publishParams = {
13388
+ read_aid: "2906",
13389
+ aid: "1128",
13390
+ cookie_enabled: "true",
13391
+ screen_width: params.extraParam?.browserInfo.screen_width || "1920",
13392
+ screen_height: params.extraParam?.browserInfo.screen_height || "1080",
13393
+ browser_language: params.extraParam?.browserInfo.browser_language || "zh-CN",
13394
+ browser_platform: params.extraParam?.browserInfo.browser_platform || "Win32",
13395
+ browser_name: params.extraParam?.browserInfo.browser_name || "Mozilla",
13396
+ browser_version: userAgent,
13397
+ browser_online: "true",
13398
+ timezone_name: "Asia/Shanghai",
13399
+ support_h265: "1",
13400
+ msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
13401
+ a_bogus: ""
13402
+ };
13403
+ task.logger.info(`[douyinPublish] publishParams ${JSON.stringify(publishParams)}`);
13404
+ const publishData = {
13405
+ item: {
13406
+ common: {
13407
+ text: params.content,
13408
+ text_extra: params.textExtra,
13409
+ activity: "[]",
13410
+ challenges: params.challengeIds || "[]",
13411
+ hashtag_source: "",
13412
+ mentions: "[]",
13413
+ music_id: params.musicId || "",
13414
+ music_end_time: 1000 * (params.musicDuration || 0),
13415
+ hot_sentence: params.hotSentence || "",
13416
+ visibility_type: Number(params.visibleRange) || 0,
13417
+ download: params.allowSave ? 1 : 0,
13418
+ timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
13419
+ media_type: Number(params.publishType) || 2,
13420
+ images: [],
13421
+ creation_id: ""
13422
+ },
13423
+ cover: {
13424
+ poster: ""
13425
+ },
13426
+ mix: params.mix ? {
13427
+ mix_id: params.mix.mix_id,
13428
+ mix_order: params.mix.mix_order || 0
13429
+ } : {},
13430
+ anchor: {},
13431
+ declare: {
13432
+ user_declare_info: "{}"
13433
+ }
13434
+ }
13435
+ };
13436
+ const args = [
13437
+ {
13438
+ headers
13438
13439
  },
13439
- mix: params.mix ? {
13440
- mix_id: params.mix.mix_id,
13441
- mix_order: params.mix.mix_order || 0
13442
- } : {},
13443
- anchor: {},
13444
- declare: {
13445
- user_declare_info: "{}"
13440
+ task.logger,
13441
+ params.proxyLoc,
13442
+ params.accountId,
13443
+ "douyin"
13444
+ ];
13445
+ const http = new Http({
13446
+ headers
13447
+ });
13448
+ const proxyHttp = new Http(...args);
13449
+ const uploadedImgList = params.uploadedImgList ? JSON.parse(params.uploadedImgList) : [];
13450
+ if (uploadedImgList.length > 0) publishData.item.common.images = uploadedImgList;
13451
+ else {
13452
+ const tmpCachePath = task.getTmpPath();
13453
+ const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
13454
+ if (params.coverImage) {
13455
+ const cover = await uploader.uploadCover(params.coverImage);
13456
+ if (cover) {
13457
+ publishData.item.common.images.push({
13458
+ uri: cover.uri,
13459
+ width: cover.width,
13460
+ height: cover.height
13461
+ });
13462
+ publishData.item.cover = {
13463
+ poster: cover.uri
13464
+ };
13465
+ }
13466
+ }
13467
+ if (params.banners && params.banners.length > 0) {
13468
+ const banners = params.banners.filter((i)=>i !== params.coverImage);
13469
+ const uploadResults = await uploader.uploadImages(banners);
13470
+ publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
13471
+ uri: result.uri,
13472
+ width: result.width,
13473
+ height: result.height
13474
+ })));
13446
13475
  }
13447
13476
  }
13448
- };
13449
- const args = [
13450
- {
13451
- headers
13452
- },
13453
- task.logger,
13454
- "",
13455
- "",
13456
- params.accountId,
13457
- "douyin"
13458
- ];
13459
- const http = new Http({
13460
- headers
13461
- });
13462
- const proxyHttp = new Http(...args);
13463
- const uploadedImgList = params.uploadedImgList ? JSON.parse(params.uploadedImgList) : [];
13464
- if (uploadedImgList.length > 0) publishData.item.common.images = uploadedImgList;
13465
- else {
13466
- const tmpCachePath = task.getTmpPath();
13467
- const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
13468
- if (params.coverImage) {
13469
- const cover = await uploader.uploadCover(params.coverImage);
13470
- if (cover) {
13471
- publishData.item.common.images.push({
13472
- uri: cover.uri,
13473
- width: cover.width,
13474
- height: cover.height
13475
- });
13476
- publishData.item.cover = {
13477
- poster: cover.uri
13477
+ publishData.item.common.creation_id = generateRandomString(8) + Date.now();
13478
+ let decision = null;
13479
+ proxyHttp.addResponseInterceptor((response)=>{
13480
+ task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
13481
+ task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
13482
+ decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
13483
+ if (needsVerification(decision)) {
13484
+ task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
13485
+ return;
13486
+ }
13487
+ if (!response || !response.data) return;
13488
+ const responseData = response.data;
13489
+ if (response && responseData?.status_code && 0 !== responseData.status_code) {
13490
+ const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
13491
+ if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
13492
+ return {
13493
+ code: errorCode,
13494
+ message: responseData.status_msg || "文章发布异常,请稍后重试。",
13495
+ data: responseData
13478
13496
  };
13479
13497
  }
13498
+ });
13499
+ task._timerRecord.PrePublish = Date.now();
13500
+ if (MockPublish) {
13501
+ const data = "123456789";
13502
+ const message = `图文模拟发布成功 ${http.proxyInfo}`;
13503
+ await updateTaskState?.({
13504
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
13505
+ result: {
13506
+ response: data
13507
+ }
13508
+ });
13509
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(0, message, data);
13480
13510
  }
13481
- if (params.banners && params.banners.length > 0) {
13482
- const banners = params.banners.filter((i)=>i !== params.coverImage);
13483
- const uploadResults = await uploader.uploadImages(banners);
13484
- publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
13485
- uri: result.uri,
13486
- width: result.width,
13487
- height: result.height
13488
- })));
13511
+ let webProtectData;
13512
+ try {
13513
+ webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
13514
+ if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
13515
+ task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
13516
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
13517
+ }
13518
+ } catch (error) {
13519
+ task.logger.error(`解析 webProtectData 失败: ${error}`);
13520
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
13521
+ }
13522
+ let ticket = webProtectData.ticket;
13523
+ let ts_sign = webProtectData.ts_sign;
13524
+ const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
13525
+ if (serverDataCookie) try {
13526
+ const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
13527
+ if (decoded.ticket && decoded.ts_sign) {
13528
+ if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
13529
+ ticket = decoded.ticket;
13530
+ ts_sign = decoded.ts_sign;
13531
+ }
13532
+ } catch (error) {
13533
+ task.logger.info(`[douyinPublish] 解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
13489
13534
  }
13490
- }
13491
- publishData.item.common.creation_id = generateRandomString(8) + Date.now();
13492
- let decision = null;
13493
- proxyHttp.addResponseInterceptor((response)=>{
13494
- task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
13495
- task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
13496
- decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
13535
+ let ec_privateKey;
13536
+ try {
13537
+ ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
13538
+ if (!ec_privateKey) {
13539
+ task.logger.error("[douyinPublish] ec_privateKey 为空");
13540
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 缺失,请重新获取后重试", "");
13541
+ }
13542
+ } catch (error) {
13543
+ task.logger.error(`[douyinPublish] 解析 ec_privateKey 失败: ${error}`);
13544
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 解析失败,请重新获取后重试", "");
13545
+ }
13546
+ let certificate;
13547
+ try {
13548
+ certificate = JSON.parse(params.extraParam["security-sdk/s_sdk_server_cert_key"] || "{}").cert;
13549
+ if (!certificate) {
13550
+ task.logger.error("[douyinPublish] certificate 为空");
13551
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 缺失,请重新获取后重试", "");
13552
+ }
13553
+ } catch (error) {
13554
+ task.logger.error(`[douyinPublish] 解析 certificate 失败: ${error}`);
13555
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
13556
+ }
13557
+ const ree_public_key = webProtectData.client_cert.replace("pub.", "");
13558
+ let bdTicketGuardClientData;
13559
+ try {
13560
+ bdTicketGuardClientData = getBdV2({
13561
+ ticket,
13562
+ ts_sign: ts_sign,
13563
+ ec_privateKey: ec_privateKey,
13564
+ certificate: certificate,
13565
+ bd_ticket_guard_ree_public_key: ree_public_key
13566
+ });
13567
+ if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
13568
+ task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
13569
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
13570
+ }
13571
+ } catch (error) {
13572
+ task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
13573
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
13574
+ }
13575
+ task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
13576
+ const publishQuery = {
13577
+ ...publishParams,
13578
+ a_bogus: ""
13579
+ };
13580
+ const queryString = new URLSearchParams(publishQuery).toString();
13581
+ let aBogus;
13582
+ try {
13583
+ aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
13584
+ if (!aBogus || aBogus.length < 10) {
13585
+ task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
13586
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成失败,请重试", "");
13587
+ }
13588
+ } catch (error) {
13589
+ task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
13590
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成异常,请重试", "");
13591
+ }
13592
+ publishQuery.a_bogus = aBogus;
13593
+ const publishQueryParams = new URLSearchParams(publishQuery).toString();
13594
+ let csrfToken;
13595
+ try {
13596
+ csrfToken = mock_generateCsrfTokenAdvanced({
13597
+ cookies: params.cookies,
13598
+ url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
13599
+ method: "POST",
13600
+ userAgent
13601
+ });
13602
+ if (!csrfToken || csrfToken.length < 10) {
13603
+ task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
13604
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
13605
+ }
13606
+ task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
13607
+ } catch (error) {
13608
+ task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
13609
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成异常,请重试", "");
13610
+ }
13611
+ let sessionDtrait;
13612
+ try {
13613
+ sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
13614
+ task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
13615
+ } catch (error) {
13616
+ task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
13617
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
13618
+ }
13619
+ task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
13620
+ ...headers,
13621
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13622
+ "Content-Type": "application/json",
13623
+ Accept: "application/json, text/plain, */*",
13624
+ "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
13625
+ "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
13626
+ "bd-ticket-guard-version": "2",
13627
+ "bd-ticket-guard-web-sign-type": "1",
13628
+ "bd-ticket-guard-web-version": "2",
13629
+ "x-secsdk-csrf-token": csrfToken,
13630
+ "x-tt-session-dtrait": sessionDtrait || ""
13631
+ })}`);
13632
+ task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
13633
+ let publishResult;
13634
+ try {
13635
+ publishResult = await proxyHttp.api({
13636
+ method: "post",
13637
+ url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
13638
+ data: publishData,
13639
+ defaultErrorMsg: "发布异常,请稍后重试。",
13640
+ headers: {
13641
+ ...headers,
13642
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13643
+ "Content-Type": "application/json",
13644
+ Accept: "application/json, text/plain, */*",
13645
+ "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
13646
+ "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
13647
+ "bd-ticket-guard-version": "2",
13648
+ "bd-ticket-guard-web-sign-type": "1",
13649
+ "bd-ticket-guard-web-version": "2",
13650
+ "x-secsdk-csrf-token": csrfToken,
13651
+ "x-tt-session-dtrait": sessionDtrait || ""
13652
+ }
13653
+ }, {
13654
+ timeout: 60000,
13655
+ retries: 3,
13656
+ retryDelay: 2000
13657
+ });
13658
+ } catch (error) {
13659
+ const handledError = Http.handleApiError(error);
13660
+ const isProxyOrNetworkError = [
13661
+ 599,
13662
+ 500,
13663
+ 502,
13664
+ 503,
13665
+ 504
13666
+ ].includes(handledError.code);
13667
+ if (isProxyOrNetworkError) {
13668
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
13669
+ const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13670
+ const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13671
+ task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
13672
+ await updateTaskState?.({
13673
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13674
+ error: message
13675
+ });
13676
+ return {
13677
+ code: 414,
13678
+ data: "",
13679
+ message
13680
+ };
13681
+ }
13682
+ throw error;
13683
+ }
13684
+ task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
13497
13685
  if (needsVerification(decision)) {
13498
- task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
13499
- return;
13686
+ const details = [
13687
+ publishResult.status_msg,
13688
+ decision?.verify_title,
13689
+ decision?.verify_desc
13690
+ ].filter(Boolean).join(" ");
13691
+ const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13692
+ const safeDecision = safeSerialize(decision) ?? {};
13693
+ const mockData = {
13694
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13695
+ error: message,
13696
+ result: {
13697
+ ...safeDecision,
13698
+ data: decision,
13699
+ uploadedImgList: JSON.stringify(publishData.item.common.images)
13700
+ }
13701
+ };
13702
+ await updateTaskState?.(mockData);
13703
+ return {
13704
+ code: 0,
13705
+ data: mockData,
13706
+ message: "操作成功"
13707
+ };
13500
13708
  }
13501
- if (!response || !response.data) return;
13502
- const responseData = response.data;
13503
- if (response && responseData?.status_code && 0 !== responseData.status_code) {
13504
- const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
13505
- if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
13709
+ reportLogger({
13710
+ token: params.huiwenToken || "",
13711
+ enverionment: task.enverionment || "development",
13712
+ postId: params.articleId,
13713
+ eip: proxyHttp.proxyInfo,
13714
+ accountId: params.accountId,
13715
+ uid: params.uid,
13716
+ platform: "douyin",
13717
+ publishParams: publishData
13718
+ });
13719
+ task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
13720
+ const isSuccess = 0 === publishResult.status_code;
13721
+ const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13722
+ const data = isSuccess ? publishResult.item_id || "" : "";
13723
+ if (!isSuccess) {
13724
+ const safeDecision = safeSerialize(decision) ?? {};
13725
+ await updateTaskState?.({
13726
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13727
+ error: message,
13728
+ result: {
13729
+ ...safeDecision,
13730
+ data: safeDecision,
13731
+ uploadedImgList: JSON.stringify(publishData.item.common.images)
13732
+ }
13733
+ });
13506
13734
  return {
13507
- code: errorCode,
13508
- message: responseData.status_msg || "文章发布异常,请稍后重试。",
13509
- data: responseData
13735
+ code: 414,
13736
+ data: safeDecision,
13737
+ message
13510
13738
  };
13511
13739
  }
13512
- });
13513
- task._timerRecord.PrePublish = Date.now();
13514
- if (MockPublish) {
13515
- const data = "123456789";
13516
- const message = `图文模拟发布成功 ${http.proxyInfo}`;
13517
13740
  await updateTaskState?.({
13518
13741
  state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
13519
13742
  result: {
13520
13743
  response: data
13521
13744
  }
13522
13745
  });
13523
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(0, message, data);
13524
- }
13525
- let webProtectData;
13526
- try {
13527
- webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
13528
- if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
13529
- task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
13530
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
13531
- }
13532
- } catch (error) {
13533
- task.logger.error(`解析 webProtectData 失败: ${error}`);
13534
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
13535
- }
13536
- let ticket = webProtectData.ticket;
13537
- let ts_sign = webProtectData.ts_sign;
13538
- const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
13539
- if (serverDataCookie) try {
13540
- const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
13541
- if (decoded.ticket && decoded.ts_sign) {
13542
- if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
13543
- ticket = decoded.ticket;
13544
- ts_sign = decoded.ts_sign;
13545
- }
13546
- } catch (error) {
13547
- task.logger.info(`[douyinPublish] 解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
13548
- }
13549
- let ec_privateKey;
13550
- try {
13551
- ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
13552
- if (!ec_privateKey) {
13553
- task.logger.error("[douyinPublish] ec_privateKey 为空");
13554
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 缺失,请重新获取后重试", "");
13555
- }
13556
- } catch (error) {
13557
- task.logger.error(`[douyinPublish] 解析 ec_privateKey 失败: ${error}`);
13558
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 解析失败,请重新获取后重试", "");
13559
- }
13560
- let certificate;
13561
- try {
13562
- certificate = JSON.parse(params.extraParam["security-sdk/s_sdk_server_cert_key"] || "{}").cert;
13563
- if (!certificate) {
13564
- task.logger.error("[douyinPublish] certificate 为空");
13565
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 缺失,请重新获取后重试", "");
13566
- }
13746
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
13567
13747
  } catch (error) {
13568
- task.logger.error(`[douyinPublish] 解析 certificate 失败: ${error}`);
13569
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
13570
- }
13571
- const ree_public_key = webProtectData.client_cert.replace("pub.", "");
13572
- let bdTicketGuardClientData;
13573
- try {
13574
- bdTicketGuardClientData = getBdV2({
13575
- ticket,
13576
- ts_sign: ts_sign,
13577
- ec_privateKey: ec_privateKey,
13578
- certificate: certificate,
13579
- bd_ticket_guard_ree_public_key: ree_public_key
13748
+ const handledError = Http.handleApiError(error);
13749
+ const errorMsg = handledError.message || "发布失败";
13750
+ const errorCode = handledError.code || 500;
13751
+ task.logger.error(`[douyinPublish] 发布流程异常 (步骤: ${currentStep}): ${errorMsg}`, stringifyError(error), handledError.extra);
13752
+ await updateTaskState?.({
13753
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13754
+ error: `${currentStep}失败: ${errorMsg}`
13580
13755
  });
13581
- if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
13582
- task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
13583
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
13584
- }
13585
- } catch (error) {
13586
- task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
13587
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
13756
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(errorCode, errorMsg, "");
13588
13757
  }
13589
- task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
13590
- const publishQuery = {
13591
- ...publishParams,
13592
- a_bogus: ""
13593
- };
13594
- const queryString = new URLSearchParams(publishQuery).toString();
13595
- let aBogus;
13596
- try {
13597
- aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
13598
- if (!aBogus || aBogus.length < 10) {
13599
- task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
13600
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成失败,请重试", "");
13601
- }
13602
- } catch (error) {
13603
- task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
13604
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成异常,请重试", "");
13605
- }
13606
- publishQuery.a_bogus = aBogus;
13607
- const publishQueryParams = new URLSearchParams(publishQuery).toString();
13608
- let csrfToken;
13609
- try {
13610
- csrfToken = mock_generateCsrfTokenAdvanced({
13611
- cookies: params.cookies,
13612
- url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
13613
- method: "POST",
13614
- userAgent
13615
- });
13616
- if (!csrfToken || csrfToken.length < 10) {
13617
- task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
13618
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
13619
- }
13620
- task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
13621
- } catch (error) {
13622
- task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
13623
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成异常,请重试", "");
13624
- }
13625
- let sessionDtrait;
13626
- try {
13627
- sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
13628
- task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
13629
- } catch (error) {
13630
- task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
13631
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
13632
- }
13633
- task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
13634
- ...headers,
13635
- Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13636
- "Content-Type": "application/json",
13637
- Accept: "application/json, text/plain, */*",
13638
- "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
13639
- "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
13640
- "bd-ticket-guard-version": "2",
13641
- "bd-ticket-guard-web-sign-type": "1",
13642
- "bd-ticket-guard-web-version": "2",
13643
- "x-secsdk-csrf-token": csrfToken,
13644
- "x-tt-session-dtrait": sessionDtrait || ""
13645
- })}`);
13646
- task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
13647
- let publishResult;
13648
- try {
13649
- publishResult = await proxyHttp.api({
13650
- method: "post",
13651
- url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
13652
- data: publishData,
13653
- defaultErrorMsg: "发布异常,请稍后重试。",
13654
- headers: {
13655
- ...headers,
13656
- Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
13657
- "Content-Type": "application/json",
13658
- Accept: "application/json, text/plain, */*",
13659
- "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
13660
- "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
13661
- "bd-ticket-guard-version": "2",
13662
- "bd-ticket-guard-web-sign-type": "1",
13663
- "bd-ticket-guard-web-version": "2",
13664
- "x-secsdk-csrf-token": csrfToken,
13665
- "x-tt-session-dtrait": sessionDtrait || ""
13666
- }
13667
- }, {
13668
- timeout: 60000,
13669
- retries: 3,
13670
- retryDelay: 2000
13671
- });
13672
- } catch (error) {
13673
- const handledError = Http.handleApiError(error);
13674
- const isProxyOrNetworkError = [
13675
- 599,
13676
- 500,
13677
- 502,
13678
- 503,
13679
- 504
13680
- ].includes(handledError.code);
13681
- if (isProxyOrNetworkError) {
13682
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
13683
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
13684
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13685
- task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
13686
- await updateTaskState?.({
13687
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13688
- error: message
13689
- });
13690
- return {
13691
- code: 414,
13692
- data: "",
13693
- message
13694
- };
13695
- }
13696
- throw error;
13697
- }
13698
- task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
13699
- if (needsVerification(decision)) {
13700
- const details = [
13701
- publishResult.status_msg,
13702
- decision?.verify_title,
13703
- decision?.verify_desc
13704
- ].filter(Boolean).join(" ");
13705
- const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13706
- let decisionObj = {};
13707
- if (decision) decisionObj = decision;
13708
- const mockData = {
13709
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13710
- error: message,
13711
- result: {
13712
- ...decisionObj,
13713
- data: decision,
13714
- uploadedImgList: JSON.stringify(publishData.item.common.images)
13715
- }
13716
- };
13717
- await updateTaskState?.(mockData);
13718
- return {
13719
- code: 0,
13720
- data: mockData,
13721
- message: "操作成功"
13722
- };
13723
- }
13724
- reportLogger({
13725
- token: params.huiwenToken || "",
13726
- enverionment: task.enverionment || "development",
13727
- postId: params.articleId,
13728
- eip: proxyHttp.proxyInfo,
13729
- proxyIp: params.localIP,
13730
- accountId: params.accountId,
13731
- uid: params.uid,
13732
- platform: "douyin",
13733
- publishParams: publishData
13734
- });
13735
- task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
13736
- const isSuccess = 0 === publishResult.status_code;
13737
- const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
13738
- const data = isSuccess ? publishResult.item_id || "" : "";
13739
- if (!isSuccess) {
13740
- let decisionObj = {};
13741
- if (decision) decisionObj = decision;
13742
- await updateTaskState?.({
13743
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
13744
- error: message,
13745
- result: {
13746
- ...decisionObj,
13747
- data: decision,
13748
- uploadedImgList: JSON.stringify(publishData.item.common.images)
13749
- }
13750
- });
13751
- return {
13752
- code: 414,
13753
- data,
13754
- message
13755
- };
13756
- }
13757
- await updateTaskState?.({
13758
- state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
13759
- result: {
13760
- response: data
13761
- }
13762
- });
13763
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
13764
- };
13765
- const douyinPublish_rpa_rpaAction = async (task, params)=>{
13766
- const commonCookies = {
13767
- path: "/",
13768
- secure: true,
13769
- domain: "douyin.com",
13770
- url: "https://creator.douyin.com",
13771
- httpOnly: true
13758
+ };
13759
+ const douyinPublish_rpa_rpaAction = async (task, params)=>{
13760
+ const commonCookies = {
13761
+ path: "/",
13762
+ secure: true,
13763
+ domain: "douyin.com",
13764
+ url: "https://creator.douyin.com",
13765
+ httpOnly: true
13772
13766
  };
13773
13767
  const page = await task.createPage({
13774
13768
  show: task.debug,
@@ -14079,18 +14073,13 @@ const rpaAction_Server = async (task, params)=>{
14079
14073
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
14080
14074
  }));
14081
14075
  let proxyUrl;
14082
- if (params.localIP) {
14083
- const args = [
14084
- params.localIP,
14085
- params.proxyLoc,
14086
- params.accountId
14087
- ];
14088
- task.logger?.info(`==> 开始获取代理信息:${args}`);
14089
- const proxyAgentResult = await ProxyAgent({
14076
+ if (params.proxyLoc) {
14077
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
14078
+ const ProxyAgentResult = await ProxyAgent({
14090
14079
  logger: task.logger
14091
- }, ...args);
14080
+ }, params.proxyLoc, params.accountId);
14092
14081
  task.logger?.info("==> 代理信息获取成功!");
14093
- proxyUrl = proxyAgentResult ? `http://${proxyAgentResult.ip}:${proxyAgentResult.port}` : void 0;
14082
+ proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
14094
14083
  }
14095
14084
  const commonCookies = {
14096
14085
  path: "/",
@@ -15047,7 +15036,6 @@ const getXhsCollection = async (_task, params)=>{
15047
15036
  },
15048
15037
  _task.logger,
15049
15038
  params.proxyLoc,
15050
- params.localIP,
15051
15039
  params.accountId
15052
15040
  ];
15053
15041
  const http = new Http(...args);
@@ -15105,7 +15093,6 @@ const getXhsGroup = async (_task, params)=>{
15105
15093
  },
15106
15094
  _task.logger,
15107
15095
  params.proxyLoc,
15108
- params.localIP,
15109
15096
  params.accountId
15110
15097
  ];
15111
15098
  const http = new Http(...args);
@@ -15152,7 +15139,6 @@ const getXhsHotTopic = async (_task, params)=>{
15152
15139
  },
15153
15140
  _task.logger,
15154
15141
  params.proxyLoc,
15155
- params.localIP,
15156
15142
  params.accountId
15157
15143
  ];
15158
15144
  const http = new Http(...args);
@@ -15213,7 +15199,6 @@ const getXhsUnreadCount = async (_task, params)=>{
15213
15199
  },
15214
15200
  _task.logger,
15215
15201
  params.proxyLoc,
15216
- params.localIP,
15217
15202
  params.accountId
15218
15203
  ];
15219
15204
  const http = new Http(...args);
@@ -15286,6 +15271,239 @@ async function getBaijiahaoData(_task, params) {
15286
15271
  };
15287
15272
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
15288
15273
  }
15274
+ async function getDouyinData(_task, params) {
15275
+ try {
15276
+ const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
15277
+ if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
15278
+ const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
15279
+ const headers = {
15280
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15281
+ referer: "https://creator.douyin.com/creator-micro/home",
15282
+ origin: "https://creator.douyin.com",
15283
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
15284
+ ...csrfToken ? {
15285
+ "x-secsdk-csrf-token": csrfToken
15286
+ } : {}
15287
+ };
15288
+ const args = [
15289
+ {
15290
+ headers
15291
+ },
15292
+ _task.logger,
15293
+ params.proxyLoc,
15294
+ params.accountId
15295
+ ];
15296
+ const http = new Http(...args);
15297
+ const toNum = (val)=>{
15298
+ if (null == val) return 0;
15299
+ const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
15300
+ return Number.isNaN(n) ? 0 : n;
15301
+ };
15302
+ const userProfileP = http.api({
15303
+ method: "get",
15304
+ url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
15305
+ params: {
15306
+ device_platform: "webapp",
15307
+ aid: "6383",
15308
+ channel: "channel_pc_web",
15309
+ pc_client_type: "1",
15310
+ version_code: "170400",
15311
+ version_name: "17.4.0",
15312
+ cookie_enabled: "true",
15313
+ platform: "PC"
15314
+ }
15315
+ }, {
15316
+ retries: 3,
15317
+ retryDelay: 100,
15318
+ timeout: 10000
15319
+ }).catch((e)=>{
15320
+ _task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
15321
+ return null;
15322
+ });
15323
+ const overviewP = http.api({
15324
+ method: "get",
15325
+ url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
15326
+ params: {
15327
+ last_days_type: 1,
15328
+ aid: 2906,
15329
+ app_name: "aweme_creator_platform",
15330
+ device_platform: "web"
15331
+ }
15332
+ }, {
15333
+ retries: 3,
15334
+ retryDelay: 100,
15335
+ timeout: 5000
15336
+ }).catch((e)=>{
15337
+ _task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
15338
+ return null;
15339
+ });
15340
+ const [userProfile, overview] = await Promise.all([
15341
+ userProfileP,
15342
+ overviewP
15343
+ ]);
15344
+ let fansNum = 0;
15345
+ let favedNum = 0;
15346
+ let followingNum = 0;
15347
+ if (userProfile?.status_code === 0 && userProfile.user) {
15348
+ const user = userProfile.user;
15349
+ fansNum = toNum(user.follower_count);
15350
+ followingNum = toNum(user.following_count);
15351
+ favedNum = toNum(user.total_favorited);
15352
+ } else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
15353
+ const ov = overview?.data;
15354
+ const douyinData = {
15355
+ fansNum,
15356
+ favedNum,
15357
+ fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
15358
+ watchNumLastWeek: toNum(ov?.play?.last_period_incr),
15359
+ likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
15360
+ commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
15361
+ shareNumLastWeek: toNum(ov?.share?.last_period_incr),
15362
+ visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
15363
+ };
15364
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(douyinData, "抖音平台数据获取成功!");
15365
+ } catch (error) {
15366
+ if (error && "object" == typeof error && "code" in error && "message" in error) {
15367
+ const err = error;
15368
+ _task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
15369
+ return types_errorResponse(err.message, err.code);
15370
+ }
15371
+ const errMsg = error instanceof Error ? error.message : String(error);
15372
+ _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
15373
+ return types_errorResponse(errMsg || "抖音账号数据获取失败");
15374
+ }
15375
+ }
15376
+ async function getShipinhaoData(_task, params) {
15377
+ try {
15378
+ const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
15379
+ if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
15380
+ const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
15381
+ const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
15382
+ const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
15383
+ const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
15384
+ const headers = {
15385
+ cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15386
+ referer: "https://channels.weixin.qq.com/platform",
15387
+ origin: "https://channels.weixin.qq.com",
15388
+ "content-type": "application/json",
15389
+ "X-WECHAT-UIN": uinCookie,
15390
+ ...deviceIdCookie ? {
15391
+ "finger-print-device-id": deviceIdCookie
15392
+ } : {}
15393
+ };
15394
+ const args = [
15395
+ {
15396
+ headers
15397
+ },
15398
+ _task.logger,
15399
+ params.proxyLoc,
15400
+ params.accountId
15401
+ ];
15402
+ const http = new Http(...args);
15403
+ const authData = await http.api({
15404
+ method: "post",
15405
+ url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
15406
+ params: {
15407
+ _aid: aid,
15408
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
15409
+ _pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
15410
+ },
15411
+ data: {
15412
+ timestamp: Date.now().toString(),
15413
+ _log_finder_uin: "",
15414
+ _log_finder_id: finderId,
15415
+ rawKeyBuff: "",
15416
+ pluginSessionId: null,
15417
+ scene: 7,
15418
+ reqScene: 7
15419
+ }
15420
+ }, {
15421
+ retries: 3,
15422
+ retryDelay: 100,
15423
+ timeout: 5000
15424
+ });
15425
+ const AUTH_ERROR_CODES = [
15426
+ 300333,
15427
+ 300334,
15428
+ 300330,
15429
+ 300331,
15430
+ 300332
15431
+ ];
15432
+ if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
15433
+ _task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
15434
+ return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
15435
+ }
15436
+ if (authData.errCode) {
15437
+ _task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
15438
+ return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
15439
+ }
15440
+ const finderUser = authData.data?.finderUser;
15441
+ const now = new Date();
15442
+ const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
15443
+ const startTs = Math.floor(yesterday.getTime() / 1000);
15444
+ const endTs = startTs + 86400;
15445
+ _task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
15446
+ let fansNumYesterday = 0;
15447
+ let playNumYesterday = 0;
15448
+ let likeNumYesterday = 0;
15449
+ let commentNumYesterday = 0;
15450
+ try {
15451
+ const statsData = await http.api({
15452
+ method: "post",
15453
+ url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
15454
+ params: {
15455
+ _aid: aid,
15456
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
15457
+ _pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
15458
+ },
15459
+ data: {
15460
+ startTs: startTs.toString(),
15461
+ endTs: endTs.toString(),
15462
+ interval: 3,
15463
+ timestamp: Date.now().toString(),
15464
+ _log_finder_uin: "",
15465
+ _log_finder_id: finderId,
15466
+ rawKeyBuff: "",
15467
+ pluginSessionId: null,
15468
+ scene: 7,
15469
+ reqScene: 7
15470
+ }
15471
+ }, {
15472
+ retries: 3,
15473
+ retryDelay: 100,
15474
+ timeout: 5000
15475
+ });
15476
+ if (!statsData.errCode && statsData.data?.totalData) {
15477
+ const data = statsData.data.totalData;
15478
+ fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
15479
+ playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
15480
+ likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
15481
+ commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
15482
+ }
15483
+ } catch (error) {
15484
+ const errMsg = error instanceof Error ? error.message : String(error);
15485
+ _task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
15486
+ }
15487
+ const shipinhaoData = {
15488
+ fansNum: finderUser?.fansCount || 0,
15489
+ feedsCount: finderUser?.feedsCount || 0,
15490
+ fansNumYesterday,
15491
+ playNumYesterday,
15492
+ likeNumYesterday,
15493
+ commentNumYesterday
15494
+ };
15495
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(shipinhaoData, "视频号平台数据获取成功!");
15496
+ } catch (error) {
15497
+ if (error && "object" == typeof error && "code" in error && "message" in error) {
15498
+ const err = error;
15499
+ _task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
15500
+ return types_errorResponse(err.message, err.code);
15501
+ }
15502
+ const errMsg = error instanceof Error ? error.message : String(error);
15503
+ _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
15504
+ return types_errorResponse(errMsg || "视频号账号数据获取失败");
15505
+ }
15506
+ }
15289
15507
  async function getToutiaoData(_task, params) {
15290
15508
  const http = new Http({
15291
15509
  headers: {
@@ -15382,7 +15600,7 @@ async function getWeixinData(_task, params) {
15382
15600
  userInfoHtmlPromise,
15383
15601
  userSummaryHtmlPromise
15384
15602
  ]);
15385
- if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("Token已失效,请重新获取", 414);
15603
+ if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
15386
15604
  const userInfoJson = exportWxCgiData(userInfoHtml);
15387
15605
  const userSummaryJson = exportWxCgiData(userSummaryHtml);
15388
15606
  const wxData = {
@@ -15407,7 +15625,6 @@ async function getXiaohongshuData(_task, params) {
15407
15625
  },
15408
15626
  _task.logger,
15409
15627
  params.proxyLoc,
15410
- params.localIP,
15411
15628
  params.accountId
15412
15629
  ];
15413
15630
  const http = new Http(...args);
@@ -15459,7 +15676,9 @@ const SearchAccountInfoParamsSchema = ActionCommonParamsSchema.extend({
15459
15676
  "toutiao",
15460
15677
  "xiaohongshu",
15461
15678
  "weixin",
15462
- "baijiahao"
15679
+ "baijiahao",
15680
+ "douyin",
15681
+ "shipinhao"
15463
15682
  ])
15464
15683
  });
15465
15684
  const SearchAccountInfo = async (_task, params)=>{
@@ -15473,6 +15692,10 @@ const SearchAccountInfo = async (_task, params)=>{
15473
15692
  return getWeixinData(_task, params);
15474
15693
  case "baijiahao":
15475
15694
  return getBaijiahaoData(_task, params);
15695
+ case "douyin":
15696
+ return getDouyinData(_task, params);
15697
+ case "shipinhao":
15698
+ return getShipinhaoData(_task, params);
15476
15699
  default:
15477
15700
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
15478
15701
  }
@@ -15567,18 +15790,45 @@ const XiaohongshuArticleSchema = BaseArticleSchema.extend({
15567
15790
  collectNum: schemas_number(),
15568
15791
  shareNum: schemas_number()
15569
15792
  });
15793
+ const DouyinArticleSchema = BaseArticleSchema.extend({
15794
+ playNum: schemas_number(),
15795
+ likeNum: schemas_number(),
15796
+ commentNum: schemas_number(),
15797
+ shareNum: schemas_number(),
15798
+ collectNum: schemas_number(),
15799
+ awemeId: schemas_string(),
15800
+ awemeType: schemas_number(),
15801
+ duration: schemas_number().optional(),
15802
+ status: schemas_string(),
15803
+ publicUrl: schemas_string()
15804
+ });
15805
+ const ShipinhaoArticleSchema = BaseArticleSchema.extend({
15806
+ readNum: schemas_number(),
15807
+ likeNum: schemas_number(),
15808
+ commentNum: schemas_number(),
15809
+ forwardNum: schemas_number(),
15810
+ favNum: schemas_number(),
15811
+ objectId: schemas_string(),
15812
+ postType: schemas_string(),
15813
+ postStatus: schemas_number(),
15814
+ effectiveTime: schemas_number().optional()
15815
+ });
15570
15816
  const FetchArticlesDataSchema = schemas_object({
15571
15817
  articleCell: schemas_array(union([
15572
15818
  ToutiaoArticleSchema,
15573
15819
  WeixinArticleSchema,
15574
15820
  BaijiahaoArticleSchema,
15575
- XiaohongshuArticleSchema
15821
+ XiaohongshuArticleSchema,
15822
+ DouyinArticleSchema,
15823
+ ShipinhaoArticleSchema
15576
15824
  ])).optional(),
15577
15825
  timerPublish: schemas_array(union([
15578
15826
  ToutiaoArticleSchema,
15579
15827
  WeixinArticleSchema,
15580
15828
  BaijiahaoArticleSchema,
15581
- XiaohongshuArticleSchema
15829
+ XiaohongshuArticleSchema,
15830
+ DouyinArticleSchema,
15831
+ ShipinhaoArticleSchema
15582
15832
  ])).optional(),
15583
15833
  pagination: schemas_object({
15584
15834
  total: schemas_number().optional(),
@@ -15693,6 +15943,267 @@ async function handleBaijiahaoData(_task, params) {
15693
15943
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
15694
15944
  }
15695
15945
  }
15946
+ async function handleDouyinData(_task, params) {
15947
+ try {
15948
+ const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
15949
+ const pageNum = params.pageNum || 1;
15950
+ const headers = {
15951
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
15952
+ referer: "https://creator.douyin.com"
15953
+ };
15954
+ const args = [
15955
+ {
15956
+ headers
15957
+ },
15958
+ _task.logger,
15959
+ params.proxyLoc,
15960
+ params.accountId
15961
+ ];
15962
+ const http = new Http(...args);
15963
+ async function fetchWorks(cursor) {
15964
+ return await http.api({
15965
+ method: "get",
15966
+ url: "https://creator.douyin.com/janus/douyin/creator/pc/work_list",
15967
+ params: {
15968
+ scene: "star_atlas",
15969
+ device_platform: "android",
15970
+ aid: 1128,
15971
+ status,
15972
+ count: pageSize,
15973
+ max_cursor: cursor
15974
+ }
15975
+ }, {
15976
+ retries: 3,
15977
+ retryDelay: 100,
15978
+ timeout: 5000
15979
+ });
15980
+ }
15981
+ const isHasMore = (v)=>true === v || 1 === v;
15982
+ const skipCount = (pageNum - 1) * pageSize;
15983
+ const needCount = skipCount + pageSize;
15984
+ const workListResponse = await fetchWorks(0);
15985
+ if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
15986
+ const allWorks = [
15987
+ ...workListResponse.aweme_list
15988
+ ];
15989
+ let hasMore = isHasMore(workListResponse.has_more);
15990
+ let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
15991
+ let guard = 0;
15992
+ while(allWorks.length < needCount && hasMore && guard < 20){
15993
+ const nextPageResponse = await fetchWorks(currentCursor);
15994
+ if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
15995
+ allWorks.push(...nextPageResponse.aweme_list);
15996
+ hasMore = isHasMore(nextPageResponse.has_more);
15997
+ currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
15998
+ guard++;
15999
+ }
16000
+ const finalWorks = allWorks.slice(skipCount, needCount);
16001
+ const articleCell = finalWorks.map((item)=>{
16002
+ const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
16003
+ const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
16004
+ let statusText;
16005
+ statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
16006
+ return {
16007
+ title: item.desc || "无作品描述",
16008
+ imageUrl: item.Cover?.url_list?.[0] || "",
16009
+ createTime: item.create_time,
16010
+ redirectUrl: workDetailUrl,
16011
+ playNum: item.statistics?.play_count || 0,
16012
+ likeNum: item.statistics?.digg_count || 0,
16013
+ commentNum: item.statistics?.comment_count || 0,
16014
+ shareNum: item.statistics?.share_count || 0,
16015
+ collectNum: item.statistics?.collect_count || 0,
16016
+ awemeId: item.aweme_id,
16017
+ awemeType: item.aweme_type ?? 0,
16018
+ duration: item.duration,
16019
+ status: statusText,
16020
+ publicUrl: workPublicUrl,
16021
+ ...showOriginalData ? {
16022
+ originalData: item
16023
+ } : {}
16024
+ };
16025
+ });
16026
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
16027
+ articleCell,
16028
+ ...onlySuccess ? {
16029
+ pagination: {
16030
+ total: workListResponse.total || allWorks.length,
16031
+ nextPage: hasMore,
16032
+ pageNum,
16033
+ pageSize
16034
+ }
16035
+ } : null
16036
+ }, "抖音数据获取成功");
16037
+ } catch (error) {
16038
+ return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
16039
+ }
16040
+ }
16041
+ async function handleShipinhaoData(_task, params) {
16042
+ try {
16043
+ const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
16044
+ const pageNum = params.pageNum || 1;
16045
+ const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
16046
+ const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
16047
+ const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
16048
+ const deviceIdCookie = cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
16049
+ const headers = {
16050
+ cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16051
+ referer: "https://channels.weixin.qq.com",
16052
+ origin: "https://channels.weixin.qq.com",
16053
+ "content-type": "application/json",
16054
+ "X-WECHAT-UIN": uinCookie,
16055
+ ...deviceIdCookie ? {
16056
+ "finger-print-device-id": deviceIdCookie
16057
+ } : {}
16058
+ };
16059
+ const args = [
16060
+ {
16061
+ headers
16062
+ },
16063
+ _task.logger,
16064
+ params.proxyLoc,
16065
+ params.accountId
16066
+ ];
16067
+ const http = new Http(...args);
16068
+ const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
16069
+ async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
16070
+ return await http.api({
16071
+ method: "post",
16072
+ url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
16073
+ params: {
16074
+ _aid: aid,
16075
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
16076
+ _pageUrl: encodeURIComponent(pageUrl)
16077
+ },
16078
+ data: {
16079
+ pageSize,
16080
+ currentPage,
16081
+ userpageType,
16082
+ stickyOrder: true,
16083
+ timestamp: Date.now().toString(),
16084
+ _log_finder_uin: "",
16085
+ _log_finder_id: finderIdCookie,
16086
+ rawKeyBuff,
16087
+ pluginSessionId: null,
16088
+ scene: 7,
16089
+ reqScene: 7
16090
+ }
16091
+ }, {
16092
+ retries: 3,
16093
+ retryDelay: 100,
16094
+ timeout: 5000
16095
+ });
16096
+ }
16097
+ async function fetchAllPosts(userpageType, pageUrl) {
16098
+ const allPosts = [];
16099
+ let currentPage = 1;
16100
+ let rawKeyBuff = "";
16101
+ let continueFlag = true;
16102
+ let totalCount = 0;
16103
+ while(continueFlag){
16104
+ const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
16105
+ if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
16106
+ if (response.errCode) {
16107
+ _task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
16108
+ throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
16109
+ }
16110
+ if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
16111
+ const posts = response.data?.list || response.posts || response.post_list || [];
16112
+ allPosts.push(...posts);
16113
+ continueFlag = response.data?.continueFlag ?? false;
16114
+ rawKeyBuff = response.data?.lastBuff || "";
16115
+ currentPage++;
16116
+ if (currentPage > 100) {
16117
+ _task.logger.warn("分页超过100页,停止请求");
16118
+ break;
16119
+ }
16120
+ }
16121
+ if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
16122
+ return {
16123
+ posts: allPosts,
16124
+ totalCount
16125
+ };
16126
+ }
16127
+ const mapPost = (item, forcePostType)=>{
16128
+ let imageUrl = "";
16129
+ if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
16130
+ else if (item.desc?.media?.[0]?.coverUrl) imageUrl = item.desc.media[0].coverUrl;
16131
+ else if (item.cover?.url) imageUrl = item.cover.url;
16132
+ else if (item.media_url) imageUrl = item.media_url;
16133
+ const title = item.desc?.description || item.object_desc || "无标题";
16134
+ return {
16135
+ title,
16136
+ imageUrl,
16137
+ createTime: item.createTime || item.create_time,
16138
+ redirectUrl: "https://channels.weixin.qq.com/platform",
16139
+ readNum: item.readCount || item.read_count || 0,
16140
+ likeNum: item.likeCount || item.like_count || 0,
16141
+ commentNum: item.commentCount || item.comment_count || 0,
16142
+ forwardNum: item.forwardCount || item.forward_count || 0,
16143
+ favNum: item.favCount || item.fav_count || 0,
16144
+ objectId: item.exportId || item.objectId || "",
16145
+ postType: forcePostType,
16146
+ postStatus: item.status || item.post_status || 0,
16147
+ ...item.effectiveTime ? {
16148
+ effectiveTime: item.effectiveTime
16149
+ } : {},
16150
+ ...showOriginalData ? {
16151
+ originalData: item
16152
+ } : {}
16153
+ };
16154
+ };
16155
+ const allArticles = [];
16156
+ const needVideo = "all" === postType || "video" === postType;
16157
+ const needArticle = "all" === postType || "article" === postType;
16158
+ const AUTH_ERROR_CODES = [
16159
+ 300333,
16160
+ 300334,
16161
+ 300330,
16162
+ 300331,
16163
+ 300332
16164
+ ];
16165
+ let combinedTotal = 0;
16166
+ if (needVideo) try {
16167
+ const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
16168
+ const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
16169
+ const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
16170
+ allArticles.push(...videoArticles);
16171
+ combinedTotal += totalCount || videoArticles.length;
16172
+ } catch (error) {
16173
+ const errMsg = error instanceof Error ? error.message : String(error);
16174
+ if (errMsg.startsWith("AUTH_ERROR:")) throw error;
16175
+ _task.logger.warn(`获取视频号视频失败:${errMsg}`);
16176
+ }
16177
+ if (needArticle) try {
16178
+ const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
16179
+ const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
16180
+ const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
16181
+ allArticles.push(...articleArticles);
16182
+ combinedTotal += totalCount || articleArticles.length;
16183
+ } catch (error) {
16184
+ const errMsg = error instanceof Error ? error.message : String(error);
16185
+ if (errMsg.startsWith("AUTH_ERROR:")) throw error;
16186
+ _task.logger.warn(`获取视频号图文失败:${errMsg}`);
16187
+ }
16188
+ allArticles.sort((a, b)=>b.createTime - a.createTime);
16189
+ const total = allArticles.length;
16190
+ const start = (pageNum - 1) * pageSize;
16191
+ const pageItems = allArticles.slice(start, start + pageSize);
16192
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
16193
+ articleCell: pageItems,
16194
+ pagination: {
16195
+ total,
16196
+ nextPage: start + pageSize < total,
16197
+ pageNum,
16198
+ pageSize
16199
+ }
16200
+ }, "视频号数据获取成功");
16201
+ } catch (error) {
16202
+ const errMsg = error instanceof Error ? error.message : String(error);
16203
+ if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
16204
+ return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
16205
+ }
16206
+ }
15696
16207
  async function handleToutiaoData(_task, params) {
15697
16208
  try {
15698
16209
  const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
@@ -15725,7 +16236,7 @@ async function handleToutiaoData(_task, params) {
15725
16236
  app_id: 1231
15726
16237
  }
15727
16238
  });
15728
- if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号账号信息获取失败,请检查账号状态", 414);
16239
+ if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号数据获取失败,请检查账号状态", 414);
15729
16240
  const articleInfo = await http.api({
15730
16241
  method: "get",
15731
16242
  url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
@@ -15832,7 +16343,7 @@ async function handleWeixinData(_task, params) {
15832
16343
  const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
15833
16344
  let begin = (lastPage ?? pageNum) - 1;
15834
16345
  const rawArticlesInfo = await fetchArticles(begin * size, size, token);
15835
- if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("登陆已失效,请重新登陆!", 414);
16346
+ if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
15836
16347
  const articlesInfo = ParsePublishPage(rawArticlesInfo);
15837
16348
  let articleCell = [];
15838
16349
  if (!onlySuccess && pageSize > 20) {
@@ -15994,7 +16505,7 @@ async function handleXiaohongshuData(_task, params) {
15994
16505
  const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
15995
16506
  if (!a1Cookie) return {
15996
16507
  code: 414,
15997
- message: "账号数据异常",
16508
+ message: "小红书数据获取失败,请检查账号状态",
15998
16509
  data: {}
15999
16510
  };
16000
16511
  if (onlySuccess && 10 !== pageSize) return {
@@ -16013,7 +16524,6 @@ async function handleXiaohongshuData(_task, params) {
16013
16524
  },
16014
16525
  _task.logger,
16015
16526
  params.proxyLoc,
16016
- params.localIP,
16017
16527
  params.accountId
16018
16528
  ];
16019
16529
  const http = new Http(...args);
@@ -16113,7 +16623,7 @@ async function handleXiaohongshuData(_task, params) {
16113
16623
  }, "小红书文章数据获取成功");
16114
16624
  }
16115
16625
  const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
16116
- platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
16626
+ platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu, douyin, shipinhao"),
16117
16627
  token: union([
16118
16628
  schemas_string(),
16119
16629
  schemas_number()
@@ -16125,7 +16635,14 @@ const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
16125
16635
  showOriginalData: schemas_boolean().optional().describe("是否展示原始数据,默认false"),
16126
16636
  cursor: schemas_number().optional().describe("仅用于微信分页游标,默认为空"),
16127
16637
  lastPage: schemas_number().optional(),
16128
- containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false")
16638
+ containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false"),
16639
+ status: schemas_number().optional().describe("抖音作品状态:0=全部"),
16640
+ includeAccount: schemas_boolean().optional().describe("是否包含账号数据,默认true"),
16641
+ postType: schemas_enum([
16642
+ "video",
16643
+ "article",
16644
+ "all"
16645
+ ]).optional().describe("视频号作品类型:video=视频, article=图文, all=全部")
16129
16646
  });
16130
16647
  const FetchArticles = async (_task, params)=>{
16131
16648
  const { platform } = params;
@@ -16138,6 +16655,10 @@ const FetchArticles = async (_task, params)=>{
16138
16655
  return handleBaijiahaoData(_task, params);
16139
16656
  case "xiaohongshu":
16140
16657
  return handleXiaohongshuData(_task, params);
16658
+ case "douyin":
16659
+ return handleDouyinData(_task, params);
16660
+ case "shipinhao":
16661
+ return handleShipinhaoData(_task, params);
16141
16662
  default:
16142
16663
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({}, "暂不支持该平台");
16143
16664
  }
@@ -16333,7 +16854,6 @@ const searchXhsWebConnections = async (_task, params)=>{
16333
16854
  },
16334
16855
  _task.logger,
16335
16856
  params.proxyLoc,
16336
- params.localIP,
16337
16857
  params.accountId
16338
16858
  ];
16339
16859
  const http = new Http(...args);
@@ -16386,7 +16906,6 @@ const searchXhsWebLikes = async (_task, params)=>{
16386
16906
  },
16387
16907
  _task.logger,
16388
16908
  params.proxyLoc,
16389
- params.localIP,
16390
16909
  params.accountId
16391
16910
  ];
16392
16911
  const http = new Http(...args);
@@ -16439,7 +16958,6 @@ const searchXhsWebMentions = async (_task, params)=>{
16439
16958
  },
16440
16959
  _task.logger,
16441
16960
  params.proxyLoc,
16442
- params.localIP,
16443
16961
  params.accountId
16444
16962
  ];
16445
16963
  const http = new Http(...args);
@@ -16486,7 +17004,6 @@ const searchXiaohongshuLocation = async (_task, params)=>{
16486
17004
  },
16487
17005
  _task.logger,
16488
17006
  params.proxyLoc,
16489
- params.localIP,
16490
17007
  params.accountId
16491
17008
  ];
16492
17009
  const http = new Http(...args);
@@ -16525,7 +17042,6 @@ const searchXiaohongshuTopicList = async (_task, params)=>{
16525
17042
  },
16526
17043
  _task.logger,
16527
17044
  params.proxyLoc,
16528
- params.localIP,
16529
17045
  params.accountId
16530
17046
  ];
16531
17047
  const http = new Http(...args);
@@ -16587,7 +17103,6 @@ const searchXiaohongshuUserArticle = async (_task, params)=>{
16587
17103
  },
16588
17104
  _task.logger,
16589
17105
  params.proxyLoc,
16590
- params.localIP,
16591
17106
  params.accountId
16592
17107
  ];
16593
17108
  const http = new Http(...args);
@@ -16644,7 +17159,6 @@ const shipinhaoCheckLinkValidate = async (_task, params)=>{
16644
17159
  },
16645
17160
  _task.logger,
16646
17161
  params.proxyLoc,
16647
- params.localIP,
16648
17162
  params.accountId
16649
17163
  ];
16650
17164
  const http = new Http(...args);
@@ -16730,7 +17244,6 @@ const shipinhaoGetLocation = async (_task, params)=>{
16730
17244
  },
16731
17245
  _task.logger,
16732
17246
  params.proxyLoc,
16733
- params.localIP,
16734
17247
  params.accountId
16735
17248
  ];
16736
17249
  const http = new Http(...args);
@@ -16818,7 +17331,6 @@ const shipinhaoGetMsg = async (_task, params)=>{
16818
17331
  },
16819
17332
  _task.logger,
16820
17333
  params.proxyLoc,
16821
- params.localIP,
16822
17334
  params.accountId
16823
17335
  ];
16824
17336
  const http = new Http(...args);
@@ -16928,7 +17440,6 @@ const shipinhaoGetMsgImage = async (_task, params)=>{
16928
17440
  },
16929
17441
  _task.logger,
16930
17442
  params.proxyLoc,
16931
- params.localIP,
16932
17443
  params.accountId
16933
17444
  ];
16934
17445
  const http = new Http(...args);
@@ -17206,16 +17717,11 @@ const shipinhaoLogin_rpa_server_rpaServer = async (task, params)=>{
17206
17717
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
17207
17718
  let executionState;
17208
17719
  let proxyUrl;
17209
- if (params.localIP) {
17210
- const args = [
17211
- params.localIP,
17212
- params.proxyLoc,
17213
- params.accountId
17214
- ];
17215
- task.logger?.info(`==> 开始获取代理信息:${args}`);
17720
+ if (params.proxyLoc) {
17721
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
17216
17722
  const ProxyAgentResult = await ProxyAgent({
17217
17723
  logger: task.logger
17218
- }, ...args);
17724
+ }, params.proxyLoc, params.accountId);
17219
17725
  task.logger?.info("==> 代理信息获取成功!");
17220
17726
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
17221
17727
  }
@@ -17541,6 +18047,11 @@ class VideoChannelUploader {
17541
18047
  this.concurrentLimit = config.concurrentLimit || 4;
17542
18048
  this.singleFileSize = config.singleFileSize || 10485760;
17543
18049
  this.http = config.http || new Http();
18050
+ this.reqOptions = {
18051
+ timeout: config.timeout ?? 60000,
18052
+ retries: config.retries ?? 3,
18053
+ retryDelay: config.retryDelay ?? 2000
18054
+ };
17544
18055
  }
17545
18056
  calculateMd5(buffer) {
17546
18057
  const MAX_SIZE = 5242880;
@@ -17597,7 +18108,7 @@ class VideoChannelUploader {
17597
18108
  url: filePath,
17598
18109
  method: "get",
17599
18110
  responseType: "arraybuffer"
17600
- });
18111
+ }, this.reqOptions);
17601
18112
  return Buffer.from(resp);
17602
18113
  }
17603
18114
  return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].promises.readFile(filePath);
@@ -17627,7 +18138,7 @@ class VideoChannelUploader {
17627
18138
  headers,
17628
18139
  data: requestBody,
17629
18140
  defaultErrorMsg: "获取UploadID失败"
17630
- });
18141
+ }, this.reqOptions);
17631
18142
  if (!resp?.UploadID) throw new Error(`获取 UploadID 失败: ${resp?.errMsg || "未知错误"}`);
17632
18143
  return resp.UploadID;
17633
18144
  }
@@ -17648,7 +18159,7 @@ class VideoChannelUploader {
17648
18159
  headers,
17649
18160
  data: chunk,
17650
18161
  defaultErrorMsg: `分片 ${partNumber} 上传失败`
17651
- });
18162
+ }, this.reqOptions);
17652
18163
  if (resp?.errCode !== void 0 && 0 !== resp.errCode) throw new Error(`分片 ${partNumber} 上传失败: ${resp.errMsg}`);
17653
18164
  if (onProgress) onProgress(chunk.length);
17654
18165
  return resp.ETag || "";
@@ -17672,7 +18183,7 @@ class VideoChannelUploader {
17672
18183
  headers,
17673
18184
  data: requestBody,
17674
18185
  defaultErrorMsg: "确认分片上传失败"
17675
- });
18186
+ }, this.reqOptions);
17676
18187
  if (resp?.ListPartsResult?.Part) return resp.ListPartsResult.Part.map((p)=>({
17677
18188
  PartNumber: parseInt(p.PartNumber),
17678
18189
  ETag: p.ETag
@@ -17698,7 +18209,7 @@ class VideoChannelUploader {
17698
18209
  headers,
17699
18210
  data: requestBody,
17700
18211
  defaultErrorMsg: "完成上传失败"
17701
- });
18212
+ }, this.reqOptions);
17702
18213
  if (!resp?.DownloadURL) throw new Error(`完成上传失败: ${resp?.errMsg || "未知错误"}`);
17703
18214
  return resp.DownloadURL;
17704
18215
  }
@@ -18037,7 +18548,6 @@ async function publishDynamic(cookies, uin, fingerPrintDeviceId, aId, proxyHttp,
18037
18548
  enverionment: confParams.enverionment || "development",
18038
18549
  postId: confParams.articleId,
18039
18550
  eip: proxyHttp.proxyInfo,
18040
- proxyIp: confParams.proxyIp,
18041
18551
  accountId: confParams.accountId,
18042
18552
  uid: confParams.uid,
18043
18553
  publishParams: publishData,
@@ -18049,7 +18559,9 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18049
18559
  task.logger.info("[shipinhaoPublish] 开始执行视频号发布 - Mock API 方式");
18050
18560
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
18051
18561
  if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "fingerPrintDeviceId和aId 不能为空", "");
18562
+ let currentStep = "初始化";
18052
18563
  try {
18564
+ currentStep = "解析认证信息";
18053
18565
  const cookieString = params.cookies.map((c)=>`${c.name}=${c.value}`).join("; ");
18054
18566
  const fingerPrintDeviceId = params.extraParam.fingerPrintDeviceId;
18055
18567
  const aId = params.extraParam.aId;
@@ -18062,7 +18574,6 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18062
18574
  },
18063
18575
  task.logger,
18064
18576
  params.proxyLoc,
18065
- params.localIP,
18066
18577
  params.accountId,
18067
18578
  "shipinhao"
18068
18579
  ];
@@ -18070,8 +18581,10 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18070
18581
  headers
18071
18582
  });
18072
18583
  const proxyHttp = new Http(...args);
18584
+ currentStep = "验证发布参数";
18073
18585
  if (!params.banners || 0 === params.banners.length) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "至少需要一张图片", "");
18074
18586
  const images = params.banners.slice(0, 18).filter((img)=>"string" == typeof img);
18587
+ currentStep = "获取用户信息";
18075
18588
  task.logger.info("[shipinhaoPublish] 获取用户信息...");
18076
18589
  console.log("cookieString", cookieString);
18077
18590
  const userInfo = await mock_getUserInfo(cookieString, http);
@@ -18082,6 +18595,7 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18082
18595
  }
18083
18596
  const finderUsername = userInfo.data.finderUser.finderUsername;
18084
18597
  console.log(finderUsername);
18598
+ currentStep = "获取上传认证密钥";
18085
18599
  task.logger.info("[shipinhaoPublish] 获取上传认证密钥...");
18086
18600
  const authKeyResponse = await getUploadAuthKey(cookieString, finderUsername, http);
18087
18601
  if (0 !== authKeyResponse.errCode || !authKeyResponse.data?.authKey) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(authKeyResponse.errCode || 500, `获取上传认证参数失败: ${authKeyResponse.errMsg}`, "");
@@ -18089,10 +18603,12 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18089
18603
  const uin = authKeyResponse.data.uin;
18090
18604
  if (!uin) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, "获取用户 uin 失败", "");
18091
18605
  const taskId = String(generateUUID());
18606
+ currentStep = "上传图片";
18092
18607
  task.logger.info(`[shipinhaoPublish] 开始上传 ${images.length} 张图片...`);
18093
18608
  const uploadedImages = [];
18094
18609
  for(let i = 0; i < images.length; i++){
18095
- task.logger.info(`[shipinhaoPublish] 上传图片 ${i + 1}/${images.length}...`);
18610
+ currentStep = `上传图片 ${i + 1}/${images.length}`;
18611
+ task.logger.info(`[shipinhaoPublish] ${currentStep}...`);
18096
18612
  const uploadResult = await uploadImageComplete(images[i], taskId, finderUsername, uin, authKey, http);
18097
18613
  console.log(JSON.stringify(uploadResult));
18098
18614
  if (!uploadResult.DownloadURL) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, `图片上传失败: ${uploadResult.errMsg}`, "");
@@ -18109,6 +18625,7 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18109
18625
  urlCdnTaskId: ""
18110
18626
  });
18111
18627
  }
18628
+ currentStep = "发布图文内容";
18112
18629
  task.logger.info("[shipinhaoPublish] 正在发布...");
18113
18630
  const topicNames = params.topic || void 0;
18114
18631
  const addressInfo = params.address ? {
@@ -18127,7 +18644,6 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18127
18644
  articleId: params.articleId,
18128
18645
  postId: params.articleId,
18129
18646
  eip: proxyHttp.proxyInfo,
18130
- proxyIp: params.localIP,
18131
18647
  accountId: params.accountId,
18132
18648
  uid: params.uid
18133
18649
  }, {
@@ -18195,9 +18711,15 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
18195
18711
  });
18196
18712
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(resultCode || 500, errorMessage, "");
18197
18713
  } catch (error) {
18198
- const errorMsg = error instanceof Error ? error.message : "发布失败";
18199
- task.logger.error(`[shipinhaoPublish] 发布异常: ${errorMsg}`);
18200
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, errorMsg, "");
18714
+ const handledError = Http.handleApiError(error);
18715
+ const errorMsg = handledError.message || "发布失败,请稍后重试";
18716
+ const errorCode = handledError.code || 500;
18717
+ task.logger.error(`[shipinhaoPublish] 发布流程异常: ${errorMsg}`, stringifyError(error), handledError.extra);
18718
+ await updateTaskState?.({
18719
+ state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
18720
+ error: errorMsg
18721
+ });
18722
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(errorCode, errorMsg, "");
18201
18723
  }
18202
18724
  };
18203
18725
  const shipinhaoPublish_rpa_rpaAction = async (task, params)=>{
@@ -18508,16 +19030,11 @@ const rpa_server_rpaAction_Server = async (task, params)=>{
18508
19030
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
18509
19031
  }));
18510
19032
  let proxyUrl;
18511
- if (params.localIP) {
18512
- const args = [
18513
- params.localIP,
18514
- params.proxyLoc,
18515
- params.accountId
18516
- ];
18517
- task.logger?.info(`==> 开始获取代理信息:${args}`);
19033
+ if (params.proxyLoc) {
19034
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
18518
19035
  const ProxyAgentResult = await ProxyAgent({
18519
19036
  logger: task.logger
18520
- }, ...args);
19037
+ }, params.proxyLoc, params.accountId);
18521
19038
  task.logger?.info("==> 代理信息获取成功!");
18522
19039
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
18523
19040
  }
@@ -19167,16 +19684,11 @@ const toutiaoLogin_rpa_server_rpaServer = async (task, params)=>{
19167
19684
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
19168
19685
  let executionState;
19169
19686
  let proxyUrl;
19170
- if (params.localIP) {
19171
- const args = [
19172
- params.localIP,
19173
- params.proxyLoc,
19174
- params.accountId
19175
- ];
19176
- task.logger?.info(`==> 开始获取代理信息:${args}`);
19687
+ if (params.proxyLoc) {
19688
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
19177
19689
  const ProxyAgentResult = await ProxyAgent({
19178
19690
  logger: task.logger
19179
- }, ...args);
19691
+ }, params.proxyLoc, params.accountId);
19180
19692
  task.logger?.info("==> 代理信息获取成功!");
19181
19693
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
19182
19694
  }
@@ -19427,7 +19939,6 @@ const toutiaoPublish_mock_mockAction = async (task, params)=>{
19427
19939
  },
19428
19940
  task.logger,
19429
19941
  params.proxyLoc,
19430
- params.localIP,
19431
19942
  params.accountId,
19432
19943
  "toutiao"
19433
19944
  ];
@@ -19625,7 +20136,6 @@ const toutiaoPublish_mock_mockAction = async (task, params)=>{
19625
20136
  enverionment: task.enverionment || "development",
19626
20137
  postId: params.articleId,
19627
20138
  eip: proxyHttp.proxyInfo,
19628
- proxyIp: params.localIP,
19629
20139
  accountId: params.accountId,
19630
20140
  uid: params.uid,
19631
20141
  platform: "toutiao",
@@ -20260,16 +20770,11 @@ const weixinLogin_rpa_server_rpaServer = async (task, params)=>{
20260
20770
  const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
20261
20771
  let executionState;
20262
20772
  let proxyUrl;
20263
- if (params.localIP) {
20264
- const args = [
20265
- params.localIP,
20266
- params.proxyLoc,
20267
- params.accountId
20268
- ];
20269
- task.logger?.info(`==> 开始获取代理信息:${args}`);
20773
+ if (params.proxyLoc) {
20774
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
20270
20775
  const ProxyAgentResult = await ProxyAgent({
20271
20776
  logger: task.logger
20272
- }, ...args);
20777
+ }, params.proxyLoc, params.accountId);
20273
20778
  task.logger?.info("==> 代理信息获取成功!");
20274
20779
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
20275
20780
  }
@@ -20761,7 +21266,6 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
20761
21266
  },
20762
21267
  task.logger,
20763
21268
  params.proxyLoc,
20764
- params.localIP,
20765
21269
  params.accountId,
20766
21270
  "weixin"
20767
21271
  ];
@@ -21540,7 +22044,6 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
21540
22044
  enverionment: task.enverionment || "development",
21541
22045
  postId: params.articleId,
21542
22046
  eip: proxyHttp.proxyInfo,
21543
- proxyIp: params.localIP,
21544
22047
  accountId: params.accountId,
21545
22048
  uid: params.uid,
21546
22049
  platform: "weixin",
@@ -22345,16 +22848,11 @@ const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
22345
22848
  const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
22346
22849
  let executionState;
22347
22850
  let proxyUrl;
22348
- if (params.localIP) {
22349
- const args = [
22350
- params.localIP,
22351
- params.proxyLoc,
22352
- params.accountId
22353
- ];
22354
- task.logger?.info(`==> 开始获取代理信息:${args}`);
22851
+ if (params.proxyLoc) {
22852
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
22355
22853
  const ProxyAgentResult = await ProxyAgent({
22356
22854
  logger: task.logger
22357
- }, ...args);
22855
+ }, params.proxyLoc, params.accountId);
22358
22856
  task.logger?.info("==> 代理信息获取成功!");
22359
22857
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
22360
22858
  }
@@ -22671,7 +23169,6 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
22671
23169
  },
22672
23170
  task.logger,
22673
23171
  params.proxyLoc,
22674
- params.localIP,
22675
23172
  params.accountId,
22676
23173
  "xiaohongshu"
22677
23174
  ];
@@ -22712,8 +23209,8 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
22712
23209
  params: fetchCoverParams
22713
23210
  }, {
22714
23211
  retries: 3,
22715
- retryDelay: 20,
22716
- timeout: 3000
23212
+ retryDelay: 500,
23213
+ timeout: 30000
22717
23214
  });
22718
23215
  for (const item of batchCoverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item.fileIds)uploadInfos.push({
22719
23216
  bucket: item.bucket || "",
@@ -22732,8 +23229,8 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
22732
23229
  params: fetchCoverParams
22733
23230
  }, {
22734
23231
  retries: 3,
22735
- retryDelay: 20,
22736
- timeout: 3000
23232
+ retryDelay: 500,
23233
+ timeout: 30000
22737
23234
  });
22738
23235
  for (const item of coverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item.fileIds)uploadInfos.push({
22739
23236
  bucket: item.bucket || "",
@@ -22794,7 +23291,9 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
22794
23291
  headers: {
22795
23292
  "x-cos-security-token": ossToken
22796
23293
  },
22797
- defaultErrorMsg: "图片上传异常,请稍后重试发布。"
23294
+ defaultErrorMsg: "图片上传异常,请稍后重试。"
23295
+ }, {
23296
+ timeout: 60000
22798
23297
  });
22799
23298
  return {
22800
23299
  ossFileId,
@@ -22804,6 +23303,8 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
22804
23303
  originSize
22805
23304
  };
22806
23305
  } catch (error) {
23306
+ const e = Http.handleApiError(error);
23307
+ task.logger.warn(`[xhs upload] 第${attempt + 1}次失败 index=${index} bucket=${ossBucketIndex} domain=${ossDomain} fileId=${ossFileId} code=${e.code} msg=${e.message} data=${stringifyError(e.data)}`);
22807
23308
  attempt++;
22808
23309
  }
22809
23310
  }
@@ -23037,7 +23538,6 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
23037
23538
  enverionment: task.enverionment || "development",
23038
23539
  postId: params.articleId,
23039
23540
  eip: proxyHttp.proxyInfo,
23040
- proxyIp: params.localIP,
23041
23541
  accountId: params.accountId,
23042
23542
  uid: params.uid,
23043
23543
  platform: "xiaohongshu",
@@ -23299,16 +23799,11 @@ const xiaohongshuPublish_rpa_server_rpaAction_Server = async (task, params)=>{
23299
23799
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
23300
23800
  }));
23301
23801
  let proxyUrl;
23302
- if (params.localIP) {
23303
- const args = [
23304
- params.localIP,
23305
- params.proxyLoc,
23306
- params.accountId
23307
- ];
23308
- task.logger?.info(`==> 开始获取代理信息:${args}`);
23802
+ if (params.proxyLoc) {
23803
+ task.logger?.info(`==> 开始获取代理信息:${params}`);
23309
23804
  const ProxyAgentResult = await ProxyAgent({
23310
23805
  logger: task.logger
23311
- }, ...args);
23806
+ }, params.proxyLoc, params.accountId);
23312
23807
  task.logger?.info("==> 代理信息获取成功!");
23313
23808
  proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
23314
23809
  }
@@ -23737,7 +24232,6 @@ const rpaAction_Server_Mock = async (task, params)=>{
23737
24232
  },
23738
24233
  task.logger,
23739
24234
  params.proxyLoc,
23740
- params.localIP,
23741
24235
  params.accountId,
23742
24236
  "xiaohongshu-rpa"
23743
24237
  ];
@@ -23783,8 +24277,8 @@ const rpaAction_Server_Mock = async (task, params)=>{
23783
24277
  params: fetchCoverParams
23784
24278
  }, {
23785
24279
  retries: 3,
23786
- retryDelay: 20,
23787
- timeout: 3000
24280
+ retryDelay: 500,
24281
+ timeout: 8000
23788
24282
  });
23789
24283
  for (const item of batchCoverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item?.fileIds ?? [])uploadInfos.push({
23790
24284
  bucket: item.bucket || "",
@@ -23803,8 +24297,8 @@ const rpaAction_Server_Mock = async (task, params)=>{
23803
24297
  params: fetchCoverParams
23804
24298
  }, {
23805
24299
  retries: 3,
23806
- retryDelay: 20,
23807
- timeout: 3000
24300
+ retryDelay: 500,
24301
+ timeout: 8000
23808
24302
  });
23809
24303
  for (const item of coverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item?.fileIds ?? [])uploadInfos.push({
23810
24304
  bucket: item.bucket || "",
@@ -23849,6 +24343,8 @@ const rpaAction_Server_Mock = async (task, params)=>{
23849
24343
  "x-cos-security-token": ossToken
23850
24344
  },
23851
24345
  defaultErrorMsg: "图片上传异常,请稍后重试发布。"
24346
+ }, {
24347
+ timeout: 60000
23852
24348
  });
23853
24349
  return {
23854
24350
  ossFileId,
@@ -24158,7 +24654,6 @@ const xiaohongshuWebCommentAction = async (_task, params)=>{
24158
24654
  },
24159
24655
  _task.logger,
24160
24656
  params.proxyLoc,
24161
- params.localIP,
24162
24657
  params.accountId
24163
24658
  ];
24164
24659
  const http = new Http(...args);
@@ -24244,7 +24739,6 @@ const xiaohongshuWebIntimacySearch = async (_task, params)=>{
24244
24739
  },
24245
24740
  _task.logger,
24246
24741
  params.proxyLoc,
24247
- params.localIP,
24248
24742
  params.accountId
24249
24743
  ];
24250
24744
  const http = new Http(...args);
@@ -24283,7 +24777,6 @@ const xiaohongshuWebMsgRead = async (_task, params)=>{
24283
24777
  },
24284
24778
  _task.logger,
24285
24779
  params.proxyLoc,
24286
- params.localIP,
24287
24780
  params.accountId
24288
24781
  ];
24289
24782
  const http = new Http(...args);
@@ -24336,7 +24829,6 @@ const xiaohongshuWebMsgReply = async (_task, params)=>{
24336
24829
  },
24337
24830
  _task.logger,
24338
24831
  params.proxyLoc,
24339
- params.localIP,
24340
24832
  params.accountId
24341
24833
  ];
24342
24834
  const http = new Http(...args);
@@ -24393,7 +24885,6 @@ const xiaohongshuWebNoteFeed = async (_task, params)=>{
24393
24885
  },
24394
24886
  _task.logger,
24395
24887
  params.proxyLoc,
24396
- params.localIP,
24397
24888
  params.accountId
24398
24889
  ];
24399
24890
  const http = new Http(...args);
@@ -24466,7 +24957,6 @@ const xiaohongshuWebRelationAction = async (_task, params)=>{
24466
24957
  },
24467
24958
  _task.logger,
24468
24959
  params.proxyLoc,
24469
- params.localIP,
24470
24960
  params.accountId
24471
24961
  ];
24472
24962
  const http = new Http(...args);
@@ -24570,7 +25060,6 @@ const xiaohongshuWebSearch = async (_task, params)=>{
24570
25060
  },
24571
25061
  _task.logger,
24572
25062
  params.proxyLoc,
24573
- params.localIP,
24574
25063
  params.accountId
24575
25064
  ];
24576
25065
  const http = new Http(...args);
@@ -24703,6 +25192,24 @@ const bjhConfigDataSchema = schemas_object({
24703
25192
  likeNumYesterday: schemas_number().nullable(),
24704
25193
  commentNumYesterday: schemas_number().nullable()
24705
25194
  });
25195
+ const douyinConfigDataSchema = schemas_object({
25196
+ fansNum: schemas_number(),
25197
+ favedNum: schemas_number(),
25198
+ fansNumLastWeek: schemas_number(),
25199
+ watchNumLastWeek: schemas_number(),
25200
+ likeNumLastWeek: schemas_number(),
25201
+ commentNumLastWeek: schemas_number(),
25202
+ shareNumLastWeek: schemas_number(),
25203
+ visitNumLastWeek: schemas_number()
25204
+ });
25205
+ const shipinhaoConfigDataSchema = schemas_object({
25206
+ fansNum: schemas_number(),
25207
+ feedsCount: schemas_number(),
25208
+ fansNumYesterday: schemas_number().nullable(),
25209
+ playNumYesterday: schemas_number().nullable(),
25210
+ likeNumYesterday: schemas_number().nullable(),
25211
+ commentNumYesterday: schemas_number().nullable()
25212
+ });
24706
25213
  const BetaFlag = "HuiwenCanary";
24707
25214
  class Action {
24708
25215
  constructor(task){
@@ -24985,6 +25492,7 @@ class Action {
24985
25492
  }
24986
25493
  }
24987
25494
  var __webpack_exports__version = package_namespaceObject.i8;
24988
- export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
25495
+ export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, douyinConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, shipinhaoConfigDataSchema, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
24989
25496
 
24990
- //# sourceMappingURL=index.mjs.map
25497
+ //# sourceMappingURL=index.mjs.map
25498
+ //# debugId=c189d61d-9a94-5bff-b7c8-cf06b1e1a99a