@iflyrpa/actions 1.2.6-beta.1 → 1.2.6-beta.2
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/searchXiaohongshuTopicList/index.d.ts +7 -0
- package/dist/actions/xiaohongshuPublish/index.d.ts +1 -1
- package/dist/bundle.js +50 -41
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +50 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -41
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type GetBaijiahaoActivityParams } from "./actions/getBaijiahaoActivity"
|
|
|
4
4
|
import { type GetToutiaoConfigParams } from "./actions/getToutiaoConfig";
|
|
5
5
|
import { type SearchToutiaoTopicListParams } from "./actions/searchToutiaoTopicList";
|
|
6
6
|
import { type searchXiaohongshuLocationParams } from "./actions/searchXiaohongshuLocation";
|
|
7
|
+
import { SearchXiaohongshuTopicListParams } from "./actions/searchXiaohongshuTopicList";
|
|
7
8
|
import { type ToutiaoPublishParams } from "./actions/toutiaoPublish";
|
|
8
9
|
import { type WeitoutiaoPublishParams } from "./actions/weitoutiaoPublish";
|
|
9
10
|
import { type WeixinPublishParams } from "./actions/weixinPublish";
|
|
@@ -18,6 +19,7 @@ export declare class Action {
|
|
|
18
19
|
baijiahaoPublish(params: BaijiahaoPublishParams): Promise<ResponseData<string>>;
|
|
19
20
|
getBaijiahaoActivity(params: GetBaijiahaoActivityParams): Promise<ResponseData<import("./actions/getBaijiahaoActivity").ActivityData[]>>;
|
|
20
21
|
xiaohongshuPublish(params: XiaohongshuPublishParams): Promise<ResponseData<string>>;
|
|
22
|
+
searchXiaohongshuTopicList(params: SearchXiaohongshuTopicListParams): Promise<ResponseData<import("./types").Xiaohongshu.Topic[]>>;
|
|
21
23
|
searchXiaohongshuLocation(params: searchXiaohongshuLocationParams): Promise<ResponseData<import("./types").Xiaohongshu.Location[]>>;
|
|
22
24
|
weixinmpPublish(params: WeixinmpPublishParams): Promise<ResponseData<any>>;
|
|
23
25
|
weitoutiaoPublish(params: WeitoutiaoPublishParams): Promise<ResponseData<any>>;
|
package/dist/index.js
CHANGED
|
@@ -696,6 +696,36 @@ const searchXiaohongshuLocation = async (_task, params)=>{
|
|
|
696
696
|
return (0, share_namespaceObject.success)([]);
|
|
697
697
|
}
|
|
698
698
|
};
|
|
699
|
+
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
700
|
+
const http = new Http({
|
|
701
|
+
headers: {
|
|
702
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
703
|
+
referer: "https://creator.xiaohongshu.com",
|
|
704
|
+
origin: "https://creator.xiaohongshu.com"
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
try {
|
|
708
|
+
const result = await http.api({
|
|
709
|
+
method: "post",
|
|
710
|
+
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
711
|
+
data: {
|
|
712
|
+
keyword: params.searchValue,
|
|
713
|
+
suggest_topic_request: {
|
|
714
|
+
title: "",
|
|
715
|
+
desc: `#${params.searchValue}`
|
|
716
|
+
},
|
|
717
|
+
page: {
|
|
718
|
+
page_size: 20,
|
|
719
|
+
page: 1
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
defaultErrorMsg: "话题搜索异常,请稍后重试。"
|
|
723
|
+
});
|
|
724
|
+
return (0, share_namespaceObject.success)(0 === result.code ? result.data.topic_info_dtos : [], '获取话题成功');
|
|
725
|
+
} catch (error) {
|
|
726
|
+
return (0, share_namespaceObject.success)([]);
|
|
727
|
+
}
|
|
728
|
+
};
|
|
699
729
|
const mock_errnoMap = {
|
|
700
730
|
20004020: "图片上传异常,请重新绑定账号后同步。",
|
|
701
731
|
7115: "正文图片和封面图片推荐jpg、png格式。",
|
|
@@ -904,6 +934,10 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
904
934
|
});
|
|
905
935
|
} else await route.continue();
|
|
906
936
|
});
|
|
937
|
+
PopupListener(page, '.byte-modal.publish-exclusive-modal .title', "激励", '.byte-modal-close-icon', {
|
|
938
|
+
checkInterval: 1000,
|
|
939
|
+
stopAfterClick: false
|
|
940
|
+
});
|
|
907
941
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
908
942
|
await titleInstance.click();
|
|
909
943
|
await titleInstance.fill(params.title);
|
|
@@ -2617,33 +2651,10 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2617
2651
|
};
|
|
2618
2652
|
};
|
|
2619
2653
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
2620
|
-
|
|
2621
|
-
|
|
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) {
|
|
2654
|
+
if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
|
|
2655
|
+
if (!topic["id"]) {
|
|
2645
2656
|
const topicData = {
|
|
2646
|
-
topic_names: topic
|
|
2657
|
+
topic_names: topic["name"]
|
|
2647
2658
|
};
|
|
2648
2659
|
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2649
2660
|
const publishXt = Date.now().toString();
|
|
@@ -2658,21 +2669,16 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2658
2669
|
data: topicData,
|
|
2659
2670
|
defaultErrorMsg: "话题创建异常,请稍后重试。"
|
|
2660
2671
|
});
|
|
2661
|
-
Object.assign(
|
|
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;
|
|
2672
|
+
Object.assign(topic, createTopic.data.topic_infos[0]);
|
|
2666
2673
|
}
|
|
2667
|
-
topicDesc.push(topicInfo);
|
|
2668
2674
|
}));
|
|
2669
2675
|
const publishData = {
|
|
2670
2676
|
common: {
|
|
2671
2677
|
ats: [],
|
|
2672
2678
|
biz_relations: [],
|
|
2673
|
-
desc: params?.content
|
|
2679
|
+
desc: params?.content,
|
|
2674
2680
|
goods_info: {},
|
|
2675
|
-
hash_tag:
|
|
2681
|
+
hash_tag: params.topic || [],
|
|
2676
2682
|
note_id: "",
|
|
2677
2683
|
source: JSON.stringify({
|
|
2678
2684
|
type: "web",
|
|
@@ -2812,11 +2818,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2812
2818
|
});
|
|
2813
2819
|
return;
|
|
2814
2820
|
}
|
|
2815
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
2821
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
|
|
2816
2822
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
2817
2823
|
const publishData = JSON.parse(request.postData() || "");
|
|
2818
2824
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
2819
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
2825
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[5] + publishDataStr, a1Cookie, xt);
|
|
2820
2826
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
2821
2827
|
const newHeaders = {
|
|
2822
2828
|
...request.headers(),
|
|
@@ -2887,9 +2893,9 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2887
2893
|
await titleInstance.fill(params.title);
|
|
2888
2894
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2889
2895
|
await descInstance.click();
|
|
2890
|
-
await descInstance.pressSequentially(params.content);
|
|
2896
|
+
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]\#/g, ""));
|
|
2891
2897
|
if (params.topic && params.topic.length > 0) for (const it of params.topic){
|
|
2892
|
-
await descInstance.pressSequentially(`#${it}`);
|
|
2898
|
+
await descInstance.pressSequentially(`#${it["name"]}`);
|
|
2893
2899
|
await page.locator('.ql-mention-loading').waitFor({
|
|
2894
2900
|
state: 'detached'
|
|
2895
2901
|
});
|
|
@@ -2904,8 +2910,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2904
2910
|
}), params.address.name);
|
|
2905
2911
|
if (params.selfDeclaration) {
|
|
2906
2912
|
await page.locator(".media-settings .flexbox").filter({
|
|
2907
|
-
hasText: "
|
|
2908
|
-
}).locator(".d-select-
|
|
2913
|
+
hasText: "内容类型声明"
|
|
2914
|
+
}).locator(".d-select-placeholder").click();
|
|
2909
2915
|
const poperInstance = await getPoperInstance();
|
|
2910
2916
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
2911
2917
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -2981,7 +2987,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2981
2987
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2982
2988
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2983
2989
|
};
|
|
2984
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.
|
|
2990
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.1"}');
|
|
2985
2991
|
class Action {
|
|
2986
2992
|
constructor(task){
|
|
2987
2993
|
this.task = task;
|
|
@@ -3016,6 +3022,9 @@ class Action {
|
|
|
3016
3022
|
xiaohongshuPublish(params) {
|
|
3017
3023
|
return this.bindTask(xiaohongshuPublish, params);
|
|
3018
3024
|
}
|
|
3025
|
+
searchXiaohongshuTopicList(params) {
|
|
3026
|
+
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
3027
|
+
}
|
|
3019
3028
|
searchXiaohongshuLocation(params) {
|
|
3020
3029
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
3021
3030
|
}
|