@iflyrpa/actions 1.2.6-beta.0 → 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 -0
- package/dist/bundle.js +81 -12
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +81 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -12
- 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);
|
|
@@ -1176,7 +1210,10 @@ const weixinPublish_mock_errnoMap = {
|
|
|
1176
1210
|
153201: "不支持发布审核中或转码中的视频",
|
|
1177
1211
|
200007: "登陆失败,请重新登陆账户后重试。",
|
|
1178
1212
|
64703: "摘要超出120字长度限制,请修改摘要后重试。",
|
|
1179
|
-
"-4": "不支持发布审核中或转码中的视频"
|
|
1213
|
+
"-4": "不支持发布审核中或转码中的视频",
|
|
1214
|
+
"-2": "不支持发布审核中或转码中的视频",
|
|
1215
|
+
770001: "不支持发布审核中或转码中的视频",
|
|
1216
|
+
200074: "系统繁忙,请稍后重试!"
|
|
1180
1217
|
};
|
|
1181
1218
|
const ignoreErrno = [
|
|
1182
1219
|
154019
|
|
@@ -2543,7 +2580,8 @@ class XsEncrypt {
|
|
|
2543
2580
|
}
|
|
2544
2581
|
}
|
|
2545
2582
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2546
|
-
903: "账户已登出,需重新登陆重试!"
|
|
2583
|
+
903: "账户已登出,需重新登陆重试!",
|
|
2584
|
+
902: "登录已过期,请重新登录!"
|
|
2547
2585
|
};
|
|
2548
2586
|
const xsEncrypt = new XsEncrypt();
|
|
2549
2587
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2613,13 +2651,34 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2613
2651
|
};
|
|
2614
2652
|
};
|
|
2615
2653
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
2654
|
+
if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
|
|
2655
|
+
if (!topic["id"]) {
|
|
2656
|
+
const topicData = {
|
|
2657
|
+
topic_names: topic["name"]
|
|
2658
|
+
};
|
|
2659
|
+
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2660
|
+
const publishXt = Date.now().toString();
|
|
2661
|
+
const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
|
|
2662
|
+
let createTopic = await http.api({
|
|
2663
|
+
method: "POST",
|
|
2664
|
+
url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
|
|
2665
|
+
headers: {
|
|
2666
|
+
"x-s": publishXs,
|
|
2667
|
+
"x-t": publishXt
|
|
2668
|
+
},
|
|
2669
|
+
data: topicData,
|
|
2670
|
+
defaultErrorMsg: "话题创建异常,请稍后重试。"
|
|
2671
|
+
});
|
|
2672
|
+
Object.assign(topic, createTopic.data.topic_infos[0]);
|
|
2673
|
+
}
|
|
2674
|
+
}));
|
|
2616
2675
|
const publishData = {
|
|
2617
2676
|
common: {
|
|
2618
2677
|
ats: [],
|
|
2619
2678
|
biz_relations: [],
|
|
2620
2679
|
desc: params?.content,
|
|
2621
2680
|
goods_info: {},
|
|
2622
|
-
hash_tag: [],
|
|
2681
|
+
hash_tag: params.topic || [],
|
|
2623
2682
|
note_id: "",
|
|
2624
2683
|
source: JSON.stringify({
|
|
2625
2684
|
type: "web",
|
|
@@ -2737,6 +2796,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2737
2796
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2738
2797
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2739
2798
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2799
|
+
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2740
2800
|
'/web_api/sns/v2/note'
|
|
2741
2801
|
];
|
|
2742
2802
|
await page.route('**', async (route, request)=>{
|
|
@@ -2758,11 +2818,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2758
2818
|
});
|
|
2759
2819
|
return;
|
|
2760
2820
|
}
|
|
2761
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
2821
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
|
|
2762
2822
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
2763
2823
|
const publishData = JSON.parse(request.postData() || "");
|
|
2764
2824
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
2765
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
2825
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[5] + publishDataStr, a1Cookie, xt);
|
|
2766
2826
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
2767
2827
|
const newHeaders = {
|
|
2768
2828
|
...request.headers(),
|
|
@@ -2816,7 +2876,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2816
2876
|
data: page.url()
|
|
2817
2877
|
};
|
|
2818
2878
|
}
|
|
2819
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2879
|
+
await page.locator("#content-area .menu-container .publish-video .btn").click();
|
|
2820
2880
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2821
2881
|
hasText: /^上传图文$/
|
|
2822
2882
|
}).click();
|
|
@@ -2833,7 +2893,15 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2833
2893
|
await titleInstance.fill(params.title);
|
|
2834
2894
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2835
2895
|
await descInstance.click();
|
|
2836
|
-
await descInstance.
|
|
2896
|
+
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]\#/g, ""));
|
|
2897
|
+
if (params.topic && params.topic.length > 0) for (const it of params.topic){
|
|
2898
|
+
await descInstance.pressSequentially(`#${it["name"]}`);
|
|
2899
|
+
await page.locator('.ql-mention-loading').waitFor({
|
|
2900
|
+
state: 'detached'
|
|
2901
|
+
});
|
|
2902
|
+
await page.waitForTimeout(1000);
|
|
2903
|
+
await page.locator('#quill-mention-item-0 .item-view-num').click();
|
|
2904
|
+
}
|
|
2837
2905
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2838
2906
|
await container.focus();
|
|
2839
2907
|
await page.mouse.wheel(0, 500);
|
|
@@ -2842,8 +2910,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2842
2910
|
}), params.address.name);
|
|
2843
2911
|
if (params.selfDeclaration) {
|
|
2844
2912
|
await page.locator(".media-settings .flexbox").filter({
|
|
2845
|
-
hasText: "
|
|
2846
|
-
}).locator(".d-select-
|
|
2913
|
+
hasText: "内容类型声明"
|
|
2914
|
+
}).locator(".d-select-placeholder").click();
|
|
2847
2915
|
const poperInstance = await getPoperInstance();
|
|
2848
2916
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
2849
2917
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -2919,9 +2987,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2919
2987
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2920
2988
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2921
2989
|
};
|
|
2922
|
-
var package_namespaceObject = {
|
|
2923
|
-
i8: "1.2.5"
|
|
2924
|
-
};
|
|
2990
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.6-beta.1"}');
|
|
2925
2991
|
class Action {
|
|
2926
2992
|
constructor(task){
|
|
2927
2993
|
this.task = task;
|
|
@@ -2956,6 +3022,9 @@ class Action {
|
|
|
2956
3022
|
xiaohongshuPublish(params) {
|
|
2957
3023
|
return this.bindTask(xiaohongshuPublish, params);
|
|
2958
3024
|
}
|
|
3025
|
+
searchXiaohongshuTopicList(params) {
|
|
3026
|
+
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
3027
|
+
}
|
|
2959
3028
|
searchXiaohongshuLocation(params) {
|
|
2960
3029
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
2961
3030
|
}
|