@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.
- package/dist/actions/xiaohongshuPublish/index.d.ts +1 -0
- package/dist/bundle.js +69 -9
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +69 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +69 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1176,7 +1176,10 @@ const weixinPublish_mock_errnoMap = {
|
|
|
1176
1176
|
153201: "不支持发布审核中或转码中的视频",
|
|
1177
1177
|
200007: "登陆失败,请重新登陆账户后重试。",
|
|
1178
1178
|
64703: "摘要超出120字长度限制,请修改摘要后重试。",
|
|
1179
|
-
"-4": "不支持发布审核中或转码中的视频"
|
|
1179
|
+
"-4": "不支持发布审核中或转码中的视频",
|
|
1180
|
+
"-2": "不支持发布审核中或转码中的视频",
|
|
1181
|
+
770001: "不支持发布审核中或转码中的视频",
|
|
1182
|
+
200074: "系统繁忙,请稍后重试!"
|
|
1180
1183
|
};
|
|
1181
1184
|
const ignoreErrno = [
|
|
1182
1185
|
154019
|
|
@@ -2543,7 +2546,8 @@ class XsEncrypt {
|
|
|
2543
2546
|
}
|
|
2544
2547
|
}
|
|
2545
2548
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2546
|
-
903: "账户已登出,需重新登陆重试!"
|
|
2549
|
+
903: "账户已登出,需重新登陆重试!",
|
|
2550
|
+
902: "登录已过期,请重新登录!"
|
|
2547
2551
|
};
|
|
2548
2552
|
const xsEncrypt = new XsEncrypt();
|
|
2549
2553
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2613,13 +2617,62 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2613
2617
|
};
|
|
2614
2618
|
};
|
|
2615
2619
|
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
|
+
}));
|
|
2616
2669
|
const publishData = {
|
|
2617
2670
|
common: {
|
|
2618
2671
|
ats: [],
|
|
2619
2672
|
biz_relations: [],
|
|
2620
|
-
desc: params?.content,
|
|
2673
|
+
desc: params?.content + (params?.topic?.map((it)=>`#${it}[话题]#`).join("") || ""),
|
|
2621
2674
|
goods_info: {},
|
|
2622
|
-
hash_tag:
|
|
2675
|
+
hash_tag: topicDesc,
|
|
2623
2676
|
note_id: "",
|
|
2624
2677
|
source: JSON.stringify({
|
|
2625
2678
|
type: "web",
|
|
@@ -2737,6 +2790,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2737
2790
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2738
2791
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2739
2792
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2793
|
+
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2740
2794
|
'/web_api/sns/v2/note'
|
|
2741
2795
|
];
|
|
2742
2796
|
await page.route('**', async (route, request)=>{
|
|
@@ -2816,7 +2870,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2816
2870
|
data: page.url()
|
|
2817
2871
|
};
|
|
2818
2872
|
}
|
|
2819
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2873
|
+
await page.locator("#content-area .menu-container .publish-video .btn").click();
|
|
2820
2874
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2821
2875
|
hasText: /^上传图文$/
|
|
2822
2876
|
}).click();
|
|
@@ -2833,7 +2887,15 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2833
2887
|
await titleInstance.fill(params.title);
|
|
2834
2888
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2835
2889
|
await descInstance.click();
|
|
2836
|
-
await descInstance.
|
|
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
|
+
}
|
|
2837
2899
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2838
2900
|
await container.focus();
|
|
2839
2901
|
await page.mouse.wheel(0, 500);
|
|
@@ -2919,9 +2981,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2919
2981
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2920
2982
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2921
2983
|
};
|
|
2922
|
-
var package_namespaceObject = {
|
|
2923
|
-
i8: "1.2.5"
|
|
2924
|
-
};
|
|
2984
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.0"}');
|
|
2925
2985
|
class Action {
|
|
2926
2986
|
constructor(task){
|
|
2927
2987
|
this.task = task;
|