@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.mjs CHANGED
@@ -2495,8 +2495,7 @@ class XsEncrypt {
2495
2495
  }
2496
2496
  }
2497
2497
  const xiaohongshuPublish_mock_errnoMap = {
2498
- 903: "账户已登出,需重新登陆重试!",
2499
- 902: "登录已过期,请重新登录!"
2498
+ 903: "账户已登出,需重新登陆重试!"
2500
2499
  };
2501
2500
  const xsEncrypt = new XsEncrypt();
2502
2501
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
@@ -2566,62 +2565,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
2566
2565
  };
2567
2566
  };
2568
2567
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
2569
- const searchTopic = async (topic)=>await http.api({
2570
- method: "post",
2571
- url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
2572
- data: {
2573
- keyword: topic,
2574
- suggest_topic_request: {
2575
- title: "",
2576
- desc: `#${topic}`
2577
- },
2578
- page: {
2579
- page_size: 20,
2580
- page: 1
2581
- }
2582
- },
2583
- defaultErrorMsg: "话题搜索异常,请稍后重试。"
2584
- });
2585
- let topicDesc = [];
2586
- params.topic && params.topic.length > 0 && await Promise.all(params.topic.map(async (topic)=>{
2587
- let topicInfo = {
2588
- id: null,
2589
- name: null,
2590
- type: "topic"
2591
- };
2592
- const _topicInfo = await searchTopic(topic);
2593
- if (0 === _topicInfo.data.topic_info_dtos.length || _topicInfo.data.topic_info_dtos[0].name !== topic) {
2594
- const topicData = {
2595
- topic_names: topic
2596
- };
2597
- const topicDataStr = xsEncrypt.dumps(topicData);
2598
- const publishXt = Date.now().toString();
2599
- const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
2600
- let createTopic = await http.api({
2601
- method: "POST",
2602
- url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
2603
- headers: {
2604
- "x-s": publishXs,
2605
- "x-t": publishXt
2606
- },
2607
- data: topicData,
2608
- defaultErrorMsg: "话题创建异常,请稍后重试。"
2609
- });
2610
- Object.assign(topicInfo, createTopic.data.topic_infos[0]);
2611
- } else {
2612
- topicInfo.id = _topicInfo.data.topic_info_dtos[0].id;
2613
- topicInfo.name = _topicInfo.data.topic_info_dtos[0].name;
2614
- topicInfo.link = _topicInfo.data.topic_info_dtos[0].link;
2615
- }
2616
- topicDesc.push(topicInfo);
2617
- }));
2618
2568
  const publishData = {
2619
2569
  common: {
2620
2570
  ats: [],
2621
2571
  biz_relations: [],
2622
- desc: params?.content + (params?.topic?.map((it)=>`#${it}[话题]#`).join("") || ""),
2572
+ desc: params?.content,
2623
2573
  goods_info: {},
2624
- hash_tag: topicDesc,
2574
+ hash_tag: [],
2625
2575
  note_id: "",
2626
2576
  source: JSON.stringify({
2627
2577
  type: "web",
@@ -2739,7 +2689,6 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2739
2689
  '/api/galaxy/v2/creator/activity_center/list',
2740
2690
  '/web_api/sns/v5/creator/topic/template/list',
2741
2691
  '/web_api/sns/v5/creator/file/encryption',
2742
- '/web_api/sns/capa/postgw/topic/batch_customized',
2743
2692
  '/web_api/sns/v2/note'
2744
2693
  ];
2745
2694
  await page.route('**', async (route, request)=>{
@@ -2819,7 +2768,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2819
2768
  data: page.url()
2820
2769
  };
2821
2770
  }
2822
- await page.locator("#content-area .menu-container .publish-video .btn").click();
2771
+ await page.locator("#content-area .menu-container .publish-video a").click();
2823
2772
  await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
2824
2773
  hasText: /^上传图文$/
2825
2774
  }).click();
@@ -2836,15 +2785,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2836
2785
  await titleInstance.fill(params.title);
2837
2786
  const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
2838
2787
  await descInstance.click();
2839
- await descInstance.pressSequentially(params.content);
2840
- if (params.topic && params.topic.length > 0) for (const it of params.topic){
2841
- await descInstance.pressSequentially(`#${it}`);
2842
- await page.locator('.ql-mention-loading').waitFor({
2843
- state: 'detached'
2844
- });
2845
- await page.waitForTimeout(1000);
2846
- await page.locator('#quill-mention-item-0 .item-view-num').click();
2847
- }
2788
+ await descInstance.fill(params.content);
2848
2789
  const container = page.locator(".creator-container .content .scroll-content");
2849
2790
  await container.focus();
2850
2791
  await page.mouse.wheel(0, 500);
@@ -2930,13 +2871,16 @@ const xiaohongshuPublish = async (task, params)=>{
2930
2871
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
2931
2872
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2932
2873
  };
2933
- var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.0"}');
2874
+ var package_namespaceObject = {
2875
+ i8: "1.2.5"
2876
+ };
2934
2877
  class Action {
2935
2878
  constructor(task){
2936
2879
  this.task = task;
2937
2880
  }
2938
2881
  async bindTask(func, params) {
2939
2882
  let responseData;
2883
+ if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
2940
2884
  if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
2941
2885
  try {
2942
2886
  responseData = await func(this.task, params);