@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/actions/xiaohongshuPublish/index.d.ts +0 -1
- package/dist/bundle.js +12 -77
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +12 -77
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -77
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -6
- package/package.json +2 -2
- package/dist/actions/searchXiaohongshuTopicList/index.d.ts +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ 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";
|
|
8
7
|
import { type ToutiaoPublishParams } from "./actions/toutiaoPublish";
|
|
9
8
|
import { type WeitoutiaoPublishParams } from "./actions/weitoutiaoPublish";
|
|
10
9
|
import { type WeixinPublishParams } from "./actions/weixinPublish";
|
|
@@ -19,7 +18,6 @@ export declare class Action {
|
|
|
19
18
|
baijiahaoPublish(params: BaijiahaoPublishParams): Promise<ResponseData<string>>;
|
|
20
19
|
getBaijiahaoActivity(params: GetBaijiahaoActivityParams): Promise<ResponseData<import("./actions/getBaijiahaoActivity").ActivityData[]>>;
|
|
21
20
|
xiaohongshuPublish(params: XiaohongshuPublishParams): Promise<ResponseData<string>>;
|
|
22
|
-
searchXiaohongshuTopicList(params: SearchXiaohongshuTopicListParams): Promise<ResponseData<import("./types").Xiaohongshu.Topic[]>>;
|
|
23
21
|
searchXiaohongshuLocation(params: searchXiaohongshuLocationParams): Promise<ResponseData<import("./types").Xiaohongshu.Location[]>>;
|
|
24
22
|
weixinmpPublish(params: WeixinmpPublishParams): Promise<ResponseData<any>>;
|
|
25
23
|
weitoutiaoPublish(params: WeitoutiaoPublishParams): Promise<ResponseData<any>>;
|
package/dist/index.js
CHANGED
|
@@ -696,36 +696,6 @@ 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
|
-
};
|
|
729
699
|
const mock_errnoMap = {
|
|
730
700
|
20004020: "图片上传异常,请重新绑定账号后同步。",
|
|
731
701
|
7115: "正文图片和封面图片推荐jpg、png格式。",
|
|
@@ -934,10 +904,6 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
934
904
|
});
|
|
935
905
|
} else await route.continue();
|
|
936
906
|
});
|
|
937
|
-
PopupListener(page, '.byte-modal.publish-exclusive-modal .title', "激励", '.byte-modal-close-icon', {
|
|
938
|
-
checkInterval: 1000,
|
|
939
|
-
stopAfterClick: false
|
|
940
|
-
});
|
|
941
907
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
942
908
|
await titleInstance.click();
|
|
943
909
|
await titleInstance.fill(params.title);
|
|
@@ -2580,8 +2546,7 @@ class XsEncrypt {
|
|
|
2580
2546
|
}
|
|
2581
2547
|
}
|
|
2582
2548
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2583
|
-
903: "账户已登出,需重新登陆重试!"
|
|
2584
|
-
902: "登录已过期,请重新登录!"
|
|
2549
|
+
903: "账户已登出,需重新登陆重试!"
|
|
2585
2550
|
};
|
|
2586
2551
|
const xsEncrypt = new XsEncrypt();
|
|
2587
2552
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2651,34 +2616,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2651
2616
|
};
|
|
2652
2617
|
};
|
|
2653
2618
|
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
|
-
}));
|
|
2675
2619
|
const publishData = {
|
|
2676
2620
|
common: {
|
|
2677
2621
|
ats: [],
|
|
2678
2622
|
biz_relations: [],
|
|
2679
2623
|
desc: params?.content,
|
|
2680
2624
|
goods_info: {},
|
|
2681
|
-
hash_tag:
|
|
2625
|
+
hash_tag: [],
|
|
2682
2626
|
note_id: "",
|
|
2683
2627
|
source: JSON.stringify({
|
|
2684
2628
|
type: "web",
|
|
@@ -2796,7 +2740,6 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2796
2740
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2797
2741
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2798
2742
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2799
|
-
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2800
2743
|
'/web_api/sns/v2/note'
|
|
2801
2744
|
];
|
|
2802
2745
|
await page.route('**', async (route, request)=>{
|
|
@@ -2818,11 +2761,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2818
2761
|
});
|
|
2819
2762
|
return;
|
|
2820
2763
|
}
|
|
2821
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
2764
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[4]);
|
|
2822
2765
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
2823
2766
|
const publishData = JSON.parse(request.postData() || "");
|
|
2824
2767
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
2825
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
2768
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[4] + publishDataStr, a1Cookie, xt);
|
|
2826
2769
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
2827
2770
|
const newHeaders = {
|
|
2828
2771
|
...request.headers(),
|
|
@@ -2876,7 +2819,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2876
2819
|
data: page.url()
|
|
2877
2820
|
};
|
|
2878
2821
|
}
|
|
2879
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2822
|
+
await page.locator("#content-area .menu-container .publish-video a").click();
|
|
2880
2823
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2881
2824
|
hasText: /^上传图文$/
|
|
2882
2825
|
}).click();
|
|
@@ -2893,15 +2836,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2893
2836
|
await titleInstance.fill(params.title);
|
|
2894
2837
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2895
2838
|
await descInstance.click();
|
|
2896
|
-
await descInstance.
|
|
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
|
-
}
|
|
2839
|
+
await descInstance.fill(params.content);
|
|
2905
2840
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2906
2841
|
await container.focus();
|
|
2907
2842
|
await page.mouse.wheel(0, 500);
|
|
@@ -2910,8 +2845,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2910
2845
|
}), params.address.name);
|
|
2911
2846
|
if (params.selfDeclaration) {
|
|
2912
2847
|
await page.locator(".media-settings .flexbox").filter({
|
|
2913
|
-
hasText: "
|
|
2914
|
-
}).locator(".d-select-
|
|
2848
|
+
hasText: "自主声明"
|
|
2849
|
+
}).locator(".d-select-wrapper").click();
|
|
2915
2850
|
const poperInstance = await getPoperInstance();
|
|
2916
2851
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
2917
2852
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -2987,13 +2922,16 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2987
2922
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2988
2923
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2989
2924
|
};
|
|
2990
|
-
var package_namespaceObject =
|
|
2925
|
+
var package_namespaceObject = {
|
|
2926
|
+
i8: "1.2.5"
|
|
2927
|
+
};
|
|
2991
2928
|
class Action {
|
|
2992
2929
|
constructor(task){
|
|
2993
2930
|
this.task = task;
|
|
2994
2931
|
}
|
|
2995
2932
|
async bindTask(func, params) {
|
|
2996
2933
|
let responseData;
|
|
2934
|
+
if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
2997
2935
|
if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
|
|
2998
2936
|
try {
|
|
2999
2937
|
responseData = await func(this.task, params);
|
|
@@ -3022,9 +2960,6 @@ class Action {
|
|
|
3022
2960
|
xiaohongshuPublish(params) {
|
|
3023
2961
|
return this.bindTask(xiaohongshuPublish, params);
|
|
3024
2962
|
}
|
|
3025
|
-
searchXiaohongshuTopicList(params) {
|
|
3026
|
-
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
3027
|
-
}
|
|
3028
2963
|
searchXiaohongshuLocation(params) {
|
|
3029
2964
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
3030
2965
|
}
|