@iflyrpa/actions 1.2.6-beta.2 → 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
@@ -648,36 +648,6 @@ const searchXiaohongshuLocation = async (_task, params)=>{
648
648
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
649
649
  }
650
650
  };
651
- const searchXiaohongshuTopicList = async (_task, params)=>{
652
- const http = new Http({
653
- headers: {
654
- cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
655
- referer: "https://creator.xiaohongshu.com",
656
- origin: "https://creator.xiaohongshu.com"
657
- }
658
- });
659
- try {
660
- const result = await http.api({
661
- method: "post",
662
- url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
663
- data: {
664
- keyword: params.searchValue,
665
- suggest_topic_request: {
666
- title: "",
667
- desc: `#${params.searchValue}`
668
- },
669
- page: {
670
- page_size: 20,
671
- page: 1
672
- }
673
- },
674
- defaultErrorMsg: "话题搜索异常,请稍后重试。"
675
- });
676
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === result.code ? result.data.topic_info_dtos : [], '获取话题成功');
677
- } catch (error) {
678
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
679
- }
680
- };
681
651
  const mock_errnoMap = {
682
652
  20004020: "图片上传异常,请重新绑定账号后同步。",
683
653
  7115: "正文图片和封面图片推荐jpg、png格式。",
@@ -886,10 +856,6 @@ const rpa_rpaAction = async (task, params)=>{
886
856
  });
887
857
  } else await route.continue();
888
858
  });
889
- PopupListener(page, '.byte-modal.publish-exclusive-modal .title', "激励", '.byte-modal-close-icon', {
890
- checkInterval: 1000,
891
- stopAfterClick: false
892
- });
893
859
  const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
894
860
  await titleInstance.click();
895
861
  await titleInstance.fill(params.title);
@@ -2529,8 +2495,7 @@ class XsEncrypt {
2529
2495
  }
2530
2496
  }
2531
2497
  const xiaohongshuPublish_mock_errnoMap = {
2532
- 903: "账户已登出,需重新登陆重试!",
2533
- 902: "登录已过期,请重新登录!"
2498
+ 903: "账户已登出,需重新登陆重试!"
2534
2499
  };
2535
2500
  const xsEncrypt = new XsEncrypt();
2536
2501
  const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
@@ -2600,34 +2565,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
2600
2565
  };
2601
2566
  };
2602
2567
  const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
2603
- if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
2604
- if (!topic["id"]) {
2605
- const topicData = {
2606
- topic_names: topic["name"]
2607
- };
2608
- const topicDataStr = xsEncrypt.dumps(topicData);
2609
- const publishXt = Date.now().toString();
2610
- const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
2611
- let createTopic = await http.api({
2612
- method: "POST",
2613
- url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
2614
- headers: {
2615
- "x-s": publishXs,
2616
- "x-t": publishXt
2617
- },
2618
- data: topicData,
2619
- defaultErrorMsg: "话题创建异常,请稍后重试。"
2620
- });
2621
- Object.assign(topic, createTopic.data.topic_infos[0]);
2622
- }
2623
- }));
2624
2568
  const publishData = {
2625
2569
  common: {
2626
2570
  ats: [],
2627
2571
  biz_relations: [],
2628
2572
  desc: params?.content,
2629
2573
  goods_info: {},
2630
- hash_tag: params.topic || [],
2574
+ hash_tag: [],
2631
2575
  note_id: "",
2632
2576
  source: JSON.stringify({
2633
2577
  type: "web",
@@ -2745,7 +2689,6 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2745
2689
  '/api/galaxy/v2/creator/activity_center/list',
2746
2690
  '/web_api/sns/v5/creator/topic/template/list',
2747
2691
  '/web_api/sns/v5/creator/file/encryption',
2748
- '/web_api/sns/capa/postgw/topic/batch_customized',
2749
2692
  '/web_api/sns/v2/note'
2750
2693
  ];
2751
2694
  await page.route('**', async (route, request)=>{
@@ -2767,11 +2710,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2767
2710
  });
2768
2711
  return;
2769
2712
  }
2770
- const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
2713
+ const isNoteRequest = urlObj.pathname.includes(interceptUrls[4]);
2771
2714
  const xs = await (isNoteRequest ? (async ()=>{
2772
2715
  const publishData = JSON.parse(request.postData() || "");
2773
2716
  const publishDataStr = rpa_xsEncrypt.dumps(publishData);
2774
- return rpa_xsEncrypt.encryptXs(interceptUrls[5] + publishDataStr, a1Cookie, xt);
2717
+ return rpa_xsEncrypt.encryptXs(interceptUrls[4] + publishDataStr, a1Cookie, xt);
2775
2718
  })() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
2776
2719
  const newHeaders = {
2777
2720
  ...request.headers(),
@@ -2825,7 +2768,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2825
2768
  data: page.url()
2826
2769
  };
2827
2770
  }
2828
- await page.locator("#content-area .menu-container .publish-video .btn").click();
2771
+ await page.locator("#content-area .menu-container .publish-video a").click();
2829
2772
  await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
2830
2773
  hasText: /^上传图文$/
2831
2774
  }).click();
@@ -2842,15 +2785,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2842
2785
  await titleInstance.fill(params.title);
2843
2786
  const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
2844
2787
  await descInstance.click();
2845
- await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]\#/g, ""));
2846
- if (params.topic && params.topic.length > 0) for (const it of params.topic){
2847
- await descInstance.pressSequentially(`#${it["name"]}`);
2848
- await page.locator('.ql-mention-loading').waitFor({
2849
- state: 'detached'
2850
- });
2851
- await page.waitForTimeout(1000);
2852
- await page.locator('#quill-mention-item-0 .item-view-num').click();
2853
- }
2788
+ await descInstance.fill(params.content);
2854
2789
  const container = page.locator(".creator-container .content .scroll-content");
2855
2790
  await container.focus();
2856
2791
  await page.mouse.wheel(0, 500);
@@ -2859,8 +2794,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
2859
2794
  }), params.address.name);
2860
2795
  if (params.selfDeclaration) {
2861
2796
  await page.locator(".media-settings .flexbox").filter({
2862
- hasText: "内容类型声明"
2863
- }).locator(".d-select-placeholder").click();
2797
+ hasText: "自主声明"
2798
+ }).locator(".d-select-wrapper").click();
2864
2799
  const poperInstance = await getPoperInstance();
2865
2800
  const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
2866
2801
  if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
@@ -2936,13 +2871,16 @@ const xiaohongshuPublish = async (task, params)=>{
2936
2871
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
2937
2872
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2938
2873
  };
2939
- var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.1"}');
2874
+ var package_namespaceObject = {
2875
+ i8: "1.2.5"
2876
+ };
2940
2877
  class Action {
2941
2878
  constructor(task){
2942
2879
  this.task = task;
2943
2880
  }
2944
2881
  async bindTask(func, params) {
2945
2882
  let responseData;
2883
+ if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
2946
2884
  if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
2947
2885
  try {
2948
2886
  responseData = await func(this.task, params);
@@ -2971,9 +2909,6 @@ class Action {
2971
2909
  xiaohongshuPublish(params) {
2972
2910
  return this.bindTask(xiaohongshuPublish, params);
2973
2911
  }
2974
- searchXiaohongshuTopicList(params) {
2975
- return this.bindTask(searchXiaohongshuTopicList, params);
2976
- }
2977
2912
  searchXiaohongshuLocation(params) {
2978
2913
  return this.bindTask(searchXiaohongshuLocation, params);
2979
2914
  }