@iflyrpa/actions 1.2.2 → 1.2.4

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/bundle.js CHANGED
@@ -13168,7 +13168,8 @@ var __webpack_exports__ = {};
13168
13168
  20040033: "封面图片推荐 jpg、png格式,宽高在372×284-5000×5000 范围内。",
13169
13169
  2004005714: "网络环境异常,请检查网络后重试发布。",
13170
13170
  401100032: "异常,请检查图片(如:格式、版权、合规性等)。",
13171
- 20040034: "封面图片推荐jpg、png格式,不支持gif格式。"
13171
+ 20040034: "封面图片推荐jpg、png格式,不支持gif格式。",
13172
+ 20040124: "服务器异常,请稍后重试!"
13172
13173
  };
13173
13174
  const mockAction = async (task, params)=>{
13174
13175
  const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
@@ -13760,6 +13761,18 @@ var __webpack_exports__ = {};
13760
13761
  data: page.url()
13761
13762
  };
13762
13763
  }
13764
+ const interceptUrls = [
13765
+ '/mp/agw/article/publish'
13766
+ ];
13767
+ await page.route('**', async (route, request)=>{
13768
+ const url = new URL(request.url());
13769
+ if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
13770
+ url.searchParams.set('aid', '1');
13771
+ await route.continue({
13772
+ url: url.toString()
13773
+ });
13774
+ } else await route.continue();
13775
+ });
13763
13776
  const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
13764
13777
  await titleInstance.click();
13765
13778
  await titleInstance.fill(params.title);
@@ -13825,7 +13838,8 @@ var __webpack_exports__ = {};
13825
13838
  const adContainer = page.locator(".form-container .edit-cell .edit-label").filter({
13826
13839
  hasText: "投放广告"
13827
13840
  }).locator("xpath=..");
13828
- await adContainer.locator(`label.byte-radio:has(input[value="${getAddTypeValue(params.settingInfo.toutiaoAd)}"])`).click();
13841
+ const isAdOptionVisible = await adContainer.isVisible();
13842
+ if (isAdOptionVisible) await adContainer.locator(`label.byte-radio:has(input[value="${getAddTypeValue(params.settingInfo.toutiaoAd)}"])`).click();
13829
13843
  if (params.settingInfo.toutiaoOriginal.includes("exclusive")) {
13830
13844
  const exclusiveContainer = page.locator(".form-container .edit-cell .edit-label").filter({
13831
13845
  hasText: "声明首发"
@@ -13846,6 +13860,11 @@ var __webpack_exports__ = {};
13846
13860
  hasText: "预览并发布"
13847
13861
  }).click();
13848
13862
  });
13863
+ if ('no' == params.settingInfo.toutiaoAd) {
13864
+ await page.waitForTimeout(200);
13865
+ const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
13866
+ if (await confirmBtn.isVisible()) await confirmBtn.click();
13867
+ }
13849
13868
  if ("publish" === params.saveType) {
13850
13869
  await page.locator(".publish-footer button").filter({
13851
13870
  hasText: "确认发布"
@@ -14951,7 +14970,9 @@ var __webpack_exports__ = {};
14951
14970
  this.iv = external_node_buffer_namespaceObject.Buffer.from("4uzjr7mbsibcaldp", "utf8");
14952
14971
  }
14953
14972
  }
14954
- const xiaohongshuPublish_mock_errnoMap = {};
14973
+ const xiaohongshuPublish_mock_errnoMap = {
14974
+ 903: "账户已登出,需重新登陆重试!"
14975
+ };
14955
14976
  const xsEncrypt = new XsEncrypt();
14956
14977
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
14957
14978
  const tmpCachePath = task.getTmpPath();
@@ -14995,6 +15016,11 @@ var __webpack_exports__ = {};
14995
15016
  });
14996
15017
  const coverIds = coverIdInfo.data.uploadTempPermits[0].fileIds;
14997
15018
  const ossToken = coverIdInfo.data.uploadTempPermits[0].token;
15019
+ if (!coverIds || !ossToken) return {
15020
+ code: 200,
15021
+ message: "图片上传失败,请稍后重试!",
15022
+ data: ""
15023
+ };
14998
15024
  const uploadFile = async (url, index)=>{
14999
15025
  const fileName = getFilenameFromUrl(url);
15000
15026
  const localUrl = await downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
@@ -15113,7 +15139,7 @@ var __webpack_exports__ = {};
15113
15139
  },
15114
15140
  defaultErrorMsg: "文章发布异常,请稍后重试。"
15115
15141
  });
15116
- return success(publishResult.data.id);
15142
+ return success(publishResult.data?.id);
15117
15143
  };
15118
15144
  const rpa_xsEncrypt = new XsEncrypt();
15119
15145
  const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
@@ -15219,7 +15245,7 @@ var __webpack_exports__ = {};
15219
15245
  };
15220
15246
  }
15221
15247
  await page.locator("#content-area .menu-container .publish-video a").click();
15222
- await page.locator(".creator-container .header .title").filter({
15248
+ await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
15223
15249
  hasText: /^上传图文$/
15224
15250
  }).click();
15225
15251
  const images = await Promise.all(params.banners.map((url)=>{
@@ -15322,7 +15348,7 @@ var __webpack_exports__ = {};
15322
15348
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
15323
15349
  };
15324
15350
  var package_namespaceObject = {
15325
- i8: "1.2.1"
15351
+ i8: "1.2.3"
15326
15352
  };
15327
15353
  class Action {
15328
15354
  constructor(task){