@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.mjs
CHANGED
|
@@ -1128,7 +1128,10 @@ const weixinPublish_mock_errnoMap = {
|
|
|
1128
1128
|
153201: "不支持发布审核中或转码中的视频",
|
|
1129
1129
|
200007: "登陆失败,请重新登陆账户后重试。",
|
|
1130
1130
|
64703: "摘要超出120字长度限制,请修改摘要后重试。",
|
|
1131
|
-
"-4": "不支持发布审核中或转码中的视频"
|
|
1131
|
+
"-4": "不支持发布审核中或转码中的视频",
|
|
1132
|
+
"-2": "不支持发布审核中或转码中的视频",
|
|
1133
|
+
770001: "不支持发布审核中或转码中的视频",
|
|
1134
|
+
200074: "系统繁忙,请稍后重试!"
|
|
1132
1135
|
};
|
|
1133
1136
|
const ignoreErrno = [
|
|
1134
1137
|
154019
|
|
@@ -2492,7 +2495,8 @@ class XsEncrypt {
|
|
|
2492
2495
|
}
|
|
2493
2496
|
}
|
|
2494
2497
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2495
|
-
903: "账户已登出,需重新登陆重试!"
|
|
2498
|
+
903: "账户已登出,需重新登陆重试!",
|
|
2499
|
+
902: "登录已过期,请重新登录!"
|
|
2496
2500
|
};
|
|
2497
2501
|
const xsEncrypt = new XsEncrypt();
|
|
2498
2502
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2562,13 +2566,62 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2562
2566
|
};
|
|
2563
2567
|
};
|
|
2564
2568
|
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
|
+
}));
|
|
2565
2618
|
const publishData = {
|
|
2566
2619
|
common: {
|
|
2567
2620
|
ats: [],
|
|
2568
2621
|
biz_relations: [],
|
|
2569
|
-
desc: params?.content,
|
|
2622
|
+
desc: params?.content + (params?.topic?.map((it)=>`#${it}[话题]#`).join("") || ""),
|
|
2570
2623
|
goods_info: {},
|
|
2571
|
-
hash_tag:
|
|
2624
|
+
hash_tag: topicDesc,
|
|
2572
2625
|
note_id: "",
|
|
2573
2626
|
source: JSON.stringify({
|
|
2574
2627
|
type: "web",
|
|
@@ -2686,6 +2739,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2686
2739
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2687
2740
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2688
2741
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2742
|
+
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2689
2743
|
'/web_api/sns/v2/note'
|
|
2690
2744
|
];
|
|
2691
2745
|
await page.route('**', async (route, request)=>{
|
|
@@ -2765,7 +2819,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2765
2819
|
data: page.url()
|
|
2766
2820
|
};
|
|
2767
2821
|
}
|
|
2768
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2822
|
+
await page.locator("#content-area .menu-container .publish-video .btn").click();
|
|
2769
2823
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2770
2824
|
hasText: /^上传图文$/
|
|
2771
2825
|
}).click();
|
|
@@ -2782,7 +2836,15 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2782
2836
|
await titleInstance.fill(params.title);
|
|
2783
2837
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2784
2838
|
await descInstance.click();
|
|
2785
|
-
await descInstance.
|
|
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
|
+
}
|
|
2786
2848
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2787
2849
|
await container.focus();
|
|
2788
2850
|
await page.mouse.wheel(0, 500);
|
|
@@ -2868,9 +2930,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2868
2930
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2869
2931
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2870
2932
|
};
|
|
2871
|
-
var package_namespaceObject = {
|
|
2872
|
-
i8: "1.2.5"
|
|
2873
|
-
};
|
|
2933
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.0"}');
|
|
2874
2934
|
class Action {
|
|
2875
2935
|
constructor(task){
|
|
2876
2936
|
this.task = task;
|