@iflyrpa/actions 1.2.6-beta.2 → 1.2.7
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 +16 -78
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +16 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -78
- 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格式。",
|
|
@@ -736,8 +706,11 @@ const mock_errnoMap = {
|
|
|
736
706
|
"头条账号状态异常,资料审核未通过,请前往头条号查看。"
|
|
737
707
|
],
|
|
738
708
|
2007: "文章发布失败,声明原创要求正文字数不少于 300 字,请修改后重试。",
|
|
709
|
+
2010: "无头条广告权限,请修改后重试。",
|
|
710
|
+
3103: "今日头条号发布次数已达上限,请明天再试。",
|
|
739
711
|
1053: "正文图片和封面图片推荐jpg、png格式。",
|
|
740
|
-
2005: "账号无【申明原创】权限,请关闭申明后重试。"
|
|
712
|
+
2005: "账号无【申明原创】权限,请关闭申明后重试。",
|
|
713
|
+
100004: "用户未登录或登陆已过期,请重新登陆后重试。"
|
|
741
714
|
};
|
|
742
715
|
const get3101DetailError = (errorList, message, saveType)=>{
|
|
743
716
|
let error = "";
|
|
@@ -934,10 +907,6 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
934
907
|
});
|
|
935
908
|
} else await route.continue();
|
|
936
909
|
});
|
|
937
|
-
PopupListener(page, '.byte-modal.publish-exclusive-modal .title', "激励", '.byte-modal-close-icon', {
|
|
938
|
-
checkInterval: 1000,
|
|
939
|
-
stopAfterClick: false
|
|
940
|
-
});
|
|
941
910
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
942
911
|
await titleInstance.click();
|
|
943
912
|
await titleInstance.fill(params.title);
|
|
@@ -2580,8 +2549,7 @@ class XsEncrypt {
|
|
|
2580
2549
|
}
|
|
2581
2550
|
}
|
|
2582
2551
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2583
|
-
903: "账户已登出,需重新登陆重试!"
|
|
2584
|
-
902: "登录已过期,请重新登录!"
|
|
2552
|
+
903: "账户已登出,需重新登陆重试!"
|
|
2585
2553
|
};
|
|
2586
2554
|
const xsEncrypt = new XsEncrypt();
|
|
2587
2555
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2651,34 +2619,13 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2651
2619
|
};
|
|
2652
2620
|
};
|
|
2653
2621
|
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
2622
|
const publishData = {
|
|
2676
2623
|
common: {
|
|
2677
2624
|
ats: [],
|
|
2678
2625
|
biz_relations: [],
|
|
2679
2626
|
desc: params?.content,
|
|
2680
2627
|
goods_info: {},
|
|
2681
|
-
hash_tag:
|
|
2628
|
+
hash_tag: [],
|
|
2682
2629
|
note_id: "",
|
|
2683
2630
|
source: JSON.stringify({
|
|
2684
2631
|
type: "web",
|
|
@@ -2796,7 +2743,6 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2796
2743
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2797
2744
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2798
2745
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2799
|
-
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2800
2746
|
'/web_api/sns/v2/note'
|
|
2801
2747
|
];
|
|
2802
2748
|
await page.route('**', async (route, request)=>{
|
|
@@ -2818,11 +2764,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2818
2764
|
});
|
|
2819
2765
|
return;
|
|
2820
2766
|
}
|
|
2821
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
2767
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[4]);
|
|
2822
2768
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
2823
2769
|
const publishData = JSON.parse(request.postData() || "");
|
|
2824
2770
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
2825
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
2771
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[4] + publishDataStr, a1Cookie, xt);
|
|
2826
2772
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
2827
2773
|
const newHeaders = {
|
|
2828
2774
|
...request.headers(),
|
|
@@ -2876,7 +2822,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2876
2822
|
data: page.url()
|
|
2877
2823
|
};
|
|
2878
2824
|
}
|
|
2879
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2825
|
+
await page.locator("#content-area .menu-container .publish-video a").click();
|
|
2880
2826
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2881
2827
|
hasText: /^上传图文$/
|
|
2882
2828
|
}).click();
|
|
@@ -2893,15 +2839,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2893
2839
|
await titleInstance.fill(params.title);
|
|
2894
2840
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2895
2841
|
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
|
-
}
|
|
2842
|
+
await descInstance.fill(params.content);
|
|
2905
2843
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2906
2844
|
await container.focus();
|
|
2907
2845
|
await page.mouse.wheel(0, 500);
|
|
@@ -2910,8 +2848,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2910
2848
|
}), params.address.name);
|
|
2911
2849
|
if (params.selfDeclaration) {
|
|
2912
2850
|
await page.locator(".media-settings .flexbox").filter({
|
|
2913
|
-
hasText: "
|
|
2914
|
-
}).locator(".d-select-
|
|
2851
|
+
hasText: "自主声明"
|
|
2852
|
+
}).locator(".d-select-wrapper").click();
|
|
2915
2853
|
const poperInstance = await getPoperInstance();
|
|
2916
2854
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
2917
2855
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -2987,13 +2925,16 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2987
2925
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
2988
2926
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2989
2927
|
};
|
|
2990
|
-
var package_namespaceObject =
|
|
2928
|
+
var package_namespaceObject = {
|
|
2929
|
+
i8: "1.2.6"
|
|
2930
|
+
};
|
|
2991
2931
|
class Action {
|
|
2992
2932
|
constructor(task){
|
|
2993
2933
|
this.task = task;
|
|
2994
2934
|
}
|
|
2995
2935
|
async bindTask(func, params) {
|
|
2996
2936
|
let responseData;
|
|
2937
|
+
if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
2997
2938
|
if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
|
|
2998
2939
|
try {
|
|
2999
2940
|
responseData = await func(this.task, params);
|
|
@@ -3022,9 +2963,6 @@ class Action {
|
|
|
3022
2963
|
xiaohongshuPublish(params) {
|
|
3023
2964
|
return this.bindTask(xiaohongshuPublish, params);
|
|
3024
2965
|
}
|
|
3025
|
-
searchXiaohongshuTopicList(params) {
|
|
3026
|
-
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
3027
|
-
}
|
|
3028
2966
|
searchXiaohongshuLocation(params) {
|
|
3029
2967
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
3030
2968
|
}
|