@iflyrpa/actions 1.2.6-beta.1 → 1.2.6

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
@@ -2546,8 +2546,7 @@ class XsEncrypt {
2546
2546
  }
2547
2547
  }
2548
2548
  const xiaohongshuPublish_mock_errnoMap = {
2549
- 903: "账户已登出,需重新登陆重试!",
2550
- 902: "登录已过期,请重新登录!"
2549
+ 903: "账户已登出,需重新登陆重试!"
2551
2550
  };
2552
2551
  const xsEncrypt = new XsEncrypt();
2553
2552
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
@@ -2617,62 +2616,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
2617
2616
  };
2618
2617
  };
2619
2618
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
2620
- const searchTopic = async (topic)=>await http.api({
2621
- method: "post",
2622
- url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
2623
- data: {
2624
- keyword: topic,
2625
- suggest_topic_request: {
2626
- title: "",
2627
- desc: `#${topic}`
2628
- },
2629
- page: {
2630
- page_size: 20,
2631
- page: 1
2632
- }
2633
- },
2634
- defaultErrorMsg: "话题搜索异常,请稍后重试。"
2635
- });
2636
- let topicDesc = [];
2637
- params.topic && params.topic.length > 0 && await Promise.all(params.topic.map(async (topic)=>{
2638
- let topicInfo = {
2639
- id: null,
2640
- name: null,
2641
- type: "topic"
2642
- };
2643
- const _topicInfo = await searchTopic(topic);
2644
- if (0 === _topicInfo.data.topic_info_dtos.length || _topicInfo.data.topic_info_dtos[0].name !== topic) {
2645
- const topicData = {
2646
- topic_names: topic
2647
- };
2648
- const topicDataStr = xsEncrypt.dumps(topicData);
2649
- const publishXt = Date.now().toString();
2650
- const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
2651
- let createTopic = await http.api({
2652
- method: "POST",
2653
- url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
2654
- headers: {
2655
- "x-s": publishXs,
2656
- "x-t": publishXt
2657
- },
2658
- data: topicData,
2659
- defaultErrorMsg: "话题创建异常,请稍后重试。"
2660
- });
2661
- Object.assign(topicInfo, createTopic.data.topic_infos[0]);
2662
- } else {
2663
- topicInfo.id = _topicInfo.data.topic_info_dtos[0].id;
2664
- topicInfo.name = _topicInfo.data.topic_info_dtos[0].name;
2665
- topicInfo.link = _topicInfo.data.topic_info_dtos[0].link;
2666
- }
2667
- topicDesc.push(topicInfo);
2668
- }));
2669
2619
  const publishData = {
2670
2620
  common: {
2671
2621
  ats: [],
2672
2622
  biz_relations: [],
2673
- desc: params?.content + (params?.topic?.map((it)=>`#${it}[话题]#`).join("") || ""),
2623
+ desc: params?.content,
2674
2624
  goods_info: {},
2675
- hash_tag: topicDesc,
2625
+ hash_tag: [],
2676
2626
  note_id: "",
2677
2627
  source: JSON.stringify({
2678
2628
  type: "web",
@@ -2790,7 +2740,6 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2790
2740
  '/api/galaxy/v2/creator/activity_center/list',
2791
2741
  '/web_api/sns/v5/creator/topic/template/list',
2792
2742
  '/web_api/sns/v5/creator/file/encryption',
2793
- '/web_api/sns/capa/postgw/topic/batch_customized',
2794
2743
  '/web_api/sns/v2/note'
2795
2744
  ];
2796
2745
  await page.route('**', async (route, request)=>{
@@ -2870,7 +2819,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2870
2819
  data: page.url()
2871
2820
  };
2872
2821
  }
2873
- await page.locator("#content-area .menu-container .publish-video .btn").click();
2822
+ await page.locator("#content-area .menu-container .publish-video a").click();
2874
2823
  await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
2875
2824
  hasText: /^上传图文$/
2876
2825
  }).click();
@@ -2887,15 +2836,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2887
2836
  await titleInstance.fill(params.title);
2888
2837
  const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
2889
2838
  await descInstance.click();
2890
- await descInstance.pressSequentially(params.content);
2891
- if (params.topic && params.topic.length > 0) for (const it of params.topic){
2892
- await descInstance.pressSequentially(`#${it}`);
2893
- await page.locator('.ql-mention-loading').waitFor({
2894
- state: 'detached'
2895
- });
2896
- await page.waitForTimeout(1000);
2897
- await page.locator('#quill-mention-item-0 .item-view-num').click();
2898
- }
2839
+ await descInstance.fill(params.content);
2899
2840
  const container = page.locator(".creator-container .content .scroll-content");
2900
2841
  await container.focus();
2901
2842
  await page.mouse.wheel(0, 500);
@@ -2981,13 +2922,16 @@ const xiaohongshuPublish = async (task, params)=>{
2981
2922
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
2982
2923
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2983
2924
  };
2984
- var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.0"}');
2925
+ var package_namespaceObject = {
2926
+ i8: "1.2.5"
2927
+ };
2985
2928
  class Action {
2986
2929
  constructor(task){
2987
2930
  this.task = task;
2988
2931
  }
2989
2932
  async bindTask(func, params) {
2990
2933
  let responseData;
2934
+ if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
2991
2935
  if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
2992
2936
  try {
2993
2937
  responseData = await func(this.task, params);