@iflyrpa/actions 3.0.4 → 3.0.5-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.js CHANGED
@@ -5489,9 +5489,7 @@ var __webpack_exports__ = {};
5489
5489
  });
5490
5490
  const package_json_namespaceObject = require("@iflyrpa/share/package.json");
5491
5491
  var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
5492
- var package_namespaceObject = {
5493
- i8: "3.0.3"
5494
- };
5492
+ var package_namespaceObject = JSON.parse('{"i8":"3.0.5-beta.1"}');
5495
5493
  const share_namespaceObject = require("@iflyrpa/share");
5496
5494
  const external_node_fs_namespaceObject = require("node:fs");
5497
5495
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -5596,6 +5594,13 @@ var __webpack_exports__ = {};
5596
5594
  }
5597
5595
  };
5598
5596
  if (foundError) Object.assign(errorResponse, foundError);
5597
+ if (error.response?.status === 403) {
5598
+ this.logger?.warn(`[403 详细信息] URL: ${error.config?.url}`);
5599
+ this.logger?.warn(`[403 响应头] ${JSON.stringify(error.response?.headers || {})}`);
5600
+ this.logger?.warn(`[403 响应体] ${JSON.stringify(error.response?.data || null)}`);
5601
+ const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
5602
+ if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
5603
+ }
5599
5604
  if (error.response?.data) {
5600
5605
  if ("object" == typeof error.response.data) {
5601
5606
  const serverError = error.response.data;
@@ -14564,54 +14569,55 @@ var __webpack_exports__ = {};
14564
14569
  })}`);
14565
14570
  task.logger.info(`publishData: ${JSON.stringify(publishData)}`);
14566
14571
  task.logger.info(`url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
14567
- let publishResult;
14568
- try {
14569
- publishResult = await proxyHttp.api({
14570
- method: "post",
14571
- url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
14572
- data: publishData,
14573
- defaultErrorMsg: "发布异常,请稍后重试。",
14574
- headers: {
14575
- ...headers,
14576
- Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
14577
- "Content-Type": "application/json",
14578
- Accept: "application/json, text/plain, */*",
14579
- "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
14580
- "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
14581
- "bd-ticket-guard-version": "2",
14582
- "bd-ticket-guard-web-sign-type": "1",
14583
- "bd-ticket-guard-web-version": "2",
14584
- "x-secsdk-csrf-token": csrfToken,
14585
- "x-tt-session-dtrait": sessionDtrait || ""
14586
- }
14587
- }, {
14588
- timeout: 60000,
14589
- retries: 3,
14590
- retryDelay: 2000
14591
- });
14592
- } catch (error) {
14593
- const upstreamMessage = error?.message || String(error);
14594
- const upstreamCode = error?.code;
14595
- task.logger.error(`TaskId:${task.taskId},create_v2 请求异常,上游错误已屏蔽。上游 code=${upstreamCode},message=${upstreamMessage}`, {
14596
- error,
14597
- upstreamData: error?.data,
14598
- extra: error?.extra
14599
- });
14600
- const message = "发布失败,请重试";
14601
- await updateTaskState?.({
14572
+ const publishResult = await proxyHttp.api({
14573
+ method: "post",
14574
+ url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
14575
+ data: publishData,
14576
+ defaultErrorMsg: "发布异常,请稍后重试。",
14577
+ headers: {
14578
+ ...headers,
14579
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
14580
+ "Content-Type": "application/json",
14581
+ Accept: "application/json, text/plain, */*",
14582
+ "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
14583
+ "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
14584
+ "bd-ticket-guard-version": "2",
14585
+ "bd-ticket-guard-web-sign-type": "1",
14586
+ "bd-ticket-guard-web-version": "2",
14587
+ "x-secsdk-csrf-token": csrfToken,
14588
+ "x-tt-session-dtrait": sessionDtrait || ""
14589
+ }
14590
+ }, {
14591
+ timeout: 60000,
14592
+ retries: 3,
14593
+ retryDelay: 2000
14594
+ });
14595
+ task.logger.info("========== api调用完成 ==========");
14596
+ task.logger.info(`decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
14597
+ if (needsVerification(decision)) {
14598
+ const details = [
14599
+ publishResult.status_msg,
14600
+ decision?.verify_title,
14601
+ decision?.verify_desc
14602
+ ].filter(Boolean).join(" ");
14603
+ const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
14604
+ task.logger.warn(`TaskId:${task.taskId},检测到需要验证,准备返回验证信息`);
14605
+ const mockData = {
14602
14606
  state: share_namespaceObject.TaskState.FAILED,
14603
14607
  error: message,
14604
14608
  result: {
14605
14609
  data: decision,
14606
14610
  uploadedImgList: JSON.stringify(publishData.item.common.images)
14607
14611
  }
14608
- });
14612
+ };
14613
+ await updateTaskState?.(mockData);
14609
14614
  return {
14610
- code: 414,
14611
- data: "",
14612
- message
14615
+ code: 0,
14616
+ data: mockData,
14617
+ message: "操作成功"
14613
14618
  };
14614
14619
  }
14620
+ task.logger.info("不需要验证,继续正常流程");
14615
14621
  reportLogger({
14616
14622
  token: params.huiwenToken || "",
14617
14623
  enverionment: task.enverionment || "development",
@@ -16130,26 +16136,26 @@ var __webpack_exports__ = {};
16130
16136
  const http = new Http({
16131
16137
  headers: {
16132
16138
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16133
- referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
16139
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish",
16140
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
16141
+ }
16142
+ });
16143
+ const totalData = await http.api({
16144
+ method: "get",
16145
+ url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
16146
+ params: {
16147
+ app_id: 1231
16148
+ }
16149
+ });
16150
+ await new Promise((r)=>setTimeout(r, 1000));
16151
+ const contentDataYesterday = await http.api({
16152
+ method: "get",
16153
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
16154
+ params: {
16155
+ type: 0,
16156
+ app_id: 1231
16134
16157
  }
16135
16158
  });
16136
- const [totalData, contentDataYesterday] = await Promise.all([
16137
- http.api({
16138
- method: "get",
16139
- url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
16140
- params: {
16141
- app_id: 1231
16142
- }
16143
- }),
16144
- http.api({
16145
- method: "get",
16146
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
16147
- params: {
16148
- type: 0,
16149
- app_id: 1231
16150
- }
16151
- })
16152
- ]);
16153
16159
  const isSuccess = !!(totalData?.data?.statistic && contentDataYesterday?.author_stat);
16154
16160
  if (!isSuccess || !totalData?.data || !contentDataYesterday?.author_stat) return types_errorResponse(totalData?.message || contentDataYesterday?.message || "头条号数据获取失败,请检查Cookie是否有效", 414);
16155
16161
  const ttData = {