@iflyrpa/actions 1.2.6-beta.0 → 1.2.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.
@@ -20,6 +20,7 @@ export interface XiaohongshuPublishParams extends ActiomCommonParams {
20
20
  content: string;
21
21
  address?: Xiaohongshu.Location;
22
22
  selfDeclaration?: SelfDeclaration;
23
+ topic?: string[];
23
24
  visibleRange: "public" | "private";
24
25
  isImmediatelyPublish?: boolean;
25
26
  scheduledPublish?: string;
package/dist/bundle.js CHANGED
@@ -14063,7 +14063,10 @@ var __webpack_exports__ = {};
14063
14063
  153201: "不支持发布审核中或转码中的视频",
14064
14064
  200007: "登陆失败,请重新登陆账户后重试。",
14065
14065
  64703: "摘要超出120字长度限制,请修改摘要后重试。",
14066
- "-4": "不支持发布审核中或转码中的视频"
14066
+ "-4": "不支持发布审核中或转码中的视频",
14067
+ "-2": "不支持发布审核中或转码中的视频",
14068
+ 770001: "不支持发布审核中或转码中的视频",
14069
+ 200074: "系统繁忙,请稍后重试!"
14067
14070
  };
14068
14071
  const ignoreErrno = [
14069
14072
  154019
@@ -15430,7 +15433,8 @@ var __webpack_exports__ = {};
15430
15433
  }
15431
15434
  }
15432
15435
  const xiaohongshuPublish_mock_errnoMap = {
15433
- 903: "账户已登出,需重新登陆重试!"
15436
+ 903: "账户已登出,需重新登陆重试!",
15437
+ 902: "登录已过期,请重新登录!"
15434
15438
  };
15435
15439
  const xsEncrypt = new XsEncrypt();
15436
15440
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
@@ -15500,13 +15504,62 @@ var __webpack_exports__ = {};
15500
15504
  };
15501
15505
  };
15502
15506
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
15507
+ const searchTopic = async (topic)=>await http.api({
15508
+ method: "post",
15509
+ url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
15510
+ data: {
15511
+ keyword: topic,
15512
+ suggest_topic_request: {
15513
+ title: "",
15514
+ desc: `#${topic}`
15515
+ },
15516
+ page: {
15517
+ page_size: 20,
15518
+ page: 1
15519
+ }
15520
+ },
15521
+ defaultErrorMsg: "话题搜索异常,请稍后重试。"
15522
+ });
15523
+ let topicDesc = [];
15524
+ params.topic && params.topic.length > 0 && await Promise.all(params.topic.map(async (topic)=>{
15525
+ let topicInfo = {
15526
+ id: null,
15527
+ name: null,
15528
+ type: "topic"
15529
+ };
15530
+ const _topicInfo = await searchTopic(topic);
15531
+ if (0 === _topicInfo.data.topic_info_dtos.length || _topicInfo.data.topic_info_dtos[0].name !== topic) {
15532
+ const topicData = {
15533
+ topic_names: topic
15534
+ };
15535
+ const topicDataStr = xsEncrypt.dumps(topicData);
15536
+ const publishXt = Date.now().toString();
15537
+ const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
15538
+ let createTopic = await http.api({
15539
+ method: "POST",
15540
+ url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
15541
+ headers: {
15542
+ "x-s": publishXs,
15543
+ "x-t": publishXt
15544
+ },
15545
+ data: topicData,
15546
+ defaultErrorMsg: "话题创建异常,请稍后重试。"
15547
+ });
15548
+ Object.assign(topicInfo, createTopic.data.topic_infos[0]);
15549
+ } else {
15550
+ topicInfo.id = _topicInfo.data.topic_info_dtos[0].id;
15551
+ topicInfo.name = _topicInfo.data.topic_info_dtos[0].name;
15552
+ topicInfo.link = _topicInfo.data.topic_info_dtos[0].link;
15553
+ }
15554
+ topicDesc.push(topicInfo);
15555
+ }));
15503
15556
  const publishData = {
15504
15557
  common: {
15505
15558
  ats: [],
15506
15559
  biz_relations: [],
15507
- desc: params?.content,
15560
+ desc: params?.content + (params?.topic?.map((it)=>`#${it}[话题]#`).join("") || ""),
15508
15561
  goods_info: {},
15509
- hash_tag: [],
15562
+ hash_tag: topicDesc,
15510
15563
  note_id: "",
15511
15564
  source: JSON.stringify({
15512
15565
  type: "web",
@@ -15624,6 +15677,7 @@ var __webpack_exports__ = {};
15624
15677
  '/api/galaxy/v2/creator/activity_center/list',
15625
15678
  '/web_api/sns/v5/creator/topic/template/list',
15626
15679
  '/web_api/sns/v5/creator/file/encryption',
15680
+ '/web_api/sns/capa/postgw/topic/batch_customized',
15627
15681
  '/web_api/sns/v2/note'
15628
15682
  ];
15629
15683
  await page.route('**', async (route, request)=>{
@@ -15703,7 +15757,7 @@ var __webpack_exports__ = {};
15703
15757
  data: page.url()
15704
15758
  };
15705
15759
  }
15706
- await page.locator("#content-area .menu-container .publish-video a").click();
15760
+ await page.locator("#content-area .menu-container .publish-video .btn").click();
15707
15761
  await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
15708
15762
  hasText: /^上传图文$/
15709
15763
  }).click();
@@ -15720,7 +15774,15 @@ var __webpack_exports__ = {};
15720
15774
  await titleInstance.fill(params.title);
15721
15775
  const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
15722
15776
  await descInstance.click();
15723
- await descInstance.fill(params.content);
15777
+ await descInstance.pressSequentially(params.content);
15778
+ if (params.topic && params.topic.length > 0) for (const it of params.topic){
15779
+ await descInstance.pressSequentially(`#${it}`);
15780
+ await page.locator('.ql-mention-loading').waitFor({
15781
+ state: 'detached'
15782
+ });
15783
+ await page.waitForTimeout(1000);
15784
+ await page.locator('#quill-mention-item-0 .item-view-num').click();
15785
+ }
15724
15786
  const container = page.locator(".creator-container .content .scroll-content");
15725
15787
  await container.focus();
15726
15788
  await page.mouse.wheel(0, 500);
@@ -15806,9 +15868,7 @@ var __webpack_exports__ = {};
15806
15868
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
15807
15869
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
15808
15870
  };
15809
- var package_namespaceObject = {
15810
- i8: "1.2.5"
15811
- };
15871
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.0"}');
15812
15872
  class Action {
15813
15873
  constructor(task){
15814
15874
  this.task = task;