@iflyrpa/actions 1.2.6 → 1.2.8
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 +78 -10
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +78 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -10
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -648,6 +648,36 @@ const searchXiaohongshuLocation = async (_task, params)=>{
|
|
|
648
648
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
649
649
|
}
|
|
650
650
|
};
|
|
651
|
+
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
652
|
+
const http = new Http({
|
|
653
|
+
headers: {
|
|
654
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
655
|
+
referer: "https://creator.xiaohongshu.com",
|
|
656
|
+
origin: "https://creator.xiaohongshu.com"
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
try {
|
|
660
|
+
const result = await http.api({
|
|
661
|
+
method: "post",
|
|
662
|
+
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
663
|
+
data: {
|
|
664
|
+
keyword: params.searchValue,
|
|
665
|
+
suggest_topic_request: {
|
|
666
|
+
title: "",
|
|
667
|
+
desc: `#${params.searchValue}`
|
|
668
|
+
},
|
|
669
|
+
page: {
|
|
670
|
+
page_size: 20,
|
|
671
|
+
page: 1
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
defaultErrorMsg: "话题搜索异常,请稍后重试。"
|
|
675
|
+
});
|
|
676
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 === result.code ? result.data.topic_info_dtos : [], '获取话题成功');
|
|
677
|
+
} catch (error) {
|
|
678
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)([]);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
651
681
|
const mock_errnoMap = {
|
|
652
682
|
20004020: "图片上传异常,请重新绑定账号后同步。",
|
|
653
683
|
7115: "正文图片和封面图片推荐jpg、png格式。",
|
|
@@ -658,8 +688,11 @@ const mock_errnoMap = {
|
|
|
658
688
|
"头条账号状态异常,资料审核未通过,请前往头条号查看。"
|
|
659
689
|
],
|
|
660
690
|
2007: "文章发布失败,声明原创要求正文字数不少于 300 字,请修改后重试。",
|
|
691
|
+
2010: "无头条广告权限,请修改后重试。",
|
|
692
|
+
3103: "今日头条号发布次数已达上限,请明天再试。",
|
|
661
693
|
1053: "正文图片和封面图片推荐jpg、png格式。",
|
|
662
|
-
2005: "账号无【申明原创】权限,请关闭申明后重试。"
|
|
694
|
+
2005: "账号无【申明原创】权限,请关闭申明后重试。",
|
|
695
|
+
100004: "用户未登录或登陆已过期,请重新登陆后重试。"
|
|
663
696
|
};
|
|
664
697
|
const get3101DetailError = (errorList, message, saveType)=>{
|
|
665
698
|
let error = "";
|
|
@@ -2495,7 +2528,9 @@ class XsEncrypt {
|
|
|
2495
2528
|
}
|
|
2496
2529
|
}
|
|
2497
2530
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
2498
|
-
|
|
2531
|
+
915: "所属C端账号手机号被修改,请重新登录",
|
|
2532
|
+
903: "账户已登出,需重新登陆重试!",
|
|
2533
|
+
902: "登录已过期,请重新登录!"
|
|
2499
2534
|
};
|
|
2500
2535
|
const xsEncrypt = new XsEncrypt();
|
|
2501
2536
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -2565,13 +2600,34 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2565
2600
|
};
|
|
2566
2601
|
};
|
|
2567
2602
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
2603
|
+
if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
|
|
2604
|
+
if (!topic["id"]) {
|
|
2605
|
+
const topicData = {
|
|
2606
|
+
topic_names: topic["name"]
|
|
2607
|
+
};
|
|
2608
|
+
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
2609
|
+
const publishXt = Date.now().toString();
|
|
2610
|
+
const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
|
|
2611
|
+
let createTopic = await http.api({
|
|
2612
|
+
method: "POST",
|
|
2613
|
+
url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
|
|
2614
|
+
headers: {
|
|
2615
|
+
"x-s": publishXs,
|
|
2616
|
+
"x-t": publishXt
|
|
2617
|
+
},
|
|
2618
|
+
data: topicData,
|
|
2619
|
+
defaultErrorMsg: "话题创建异常,请稍后重试。"
|
|
2620
|
+
});
|
|
2621
|
+
Object.assign(topic, createTopic.data.topic_infos[0]);
|
|
2622
|
+
}
|
|
2623
|
+
}));
|
|
2568
2624
|
const publishData = {
|
|
2569
2625
|
common: {
|
|
2570
2626
|
ats: [],
|
|
2571
2627
|
biz_relations: [],
|
|
2572
2628
|
desc: params?.content,
|
|
2573
2629
|
goods_info: {},
|
|
2574
|
-
hash_tag: [],
|
|
2630
|
+
hash_tag: params.topic || [],
|
|
2575
2631
|
note_id: "",
|
|
2576
2632
|
source: JSON.stringify({
|
|
2577
2633
|
type: "web",
|
|
@@ -2689,6 +2745,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2689
2745
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
2690
2746
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
2691
2747
|
'/web_api/sns/v5/creator/file/encryption',
|
|
2748
|
+
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
2692
2749
|
'/web_api/sns/v2/note'
|
|
2693
2750
|
];
|
|
2694
2751
|
await page.route('**', async (route, request)=>{
|
|
@@ -2710,11 +2767,11 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2710
2767
|
});
|
|
2711
2768
|
return;
|
|
2712
2769
|
}
|
|
2713
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
2770
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[5]);
|
|
2714
2771
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
2715
2772
|
const publishData = JSON.parse(request.postData() || "");
|
|
2716
2773
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
2717
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
2774
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[5] + publishDataStr, a1Cookie, xt);
|
|
2718
2775
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
2719
2776
|
const newHeaders = {
|
|
2720
2777
|
...request.headers(),
|
|
@@ -2768,7 +2825,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2768
2825
|
data: page.url()
|
|
2769
2826
|
};
|
|
2770
2827
|
}
|
|
2771
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
2828
|
+
await page.locator("#content-area .menu-container .publish-video .btn").click();
|
|
2772
2829
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2773
2830
|
hasText: /^上传图文$/
|
|
2774
2831
|
}).click();
|
|
@@ -2785,7 +2842,15 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2785
2842
|
await titleInstance.fill(params.title);
|
|
2786
2843
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
2787
2844
|
await descInstance.click();
|
|
2788
|
-
await descInstance.
|
|
2845
|
+
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]\#/g, ""));
|
|
2846
|
+
if (params.topic && params.topic.length > 0) for (const it of params.topic){
|
|
2847
|
+
await descInstance.pressSequentially(`#${it["name"]}`);
|
|
2848
|
+
await page.locator('.ql-mention-loading').waitFor({
|
|
2849
|
+
state: 'detached'
|
|
2850
|
+
});
|
|
2851
|
+
await page.waitForTimeout(1000);
|
|
2852
|
+
await page.locator('#quill-mention-item-0 .item-view-num').click();
|
|
2853
|
+
}
|
|
2789
2854
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
2790
2855
|
await container.focus();
|
|
2791
2856
|
await page.mouse.wheel(0, 500);
|
|
@@ -2794,8 +2859,8 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2794
2859
|
}), params.address.name);
|
|
2795
2860
|
if (params.selfDeclaration) {
|
|
2796
2861
|
await page.locator(".media-settings .flexbox").filter({
|
|
2797
|
-
hasText: "
|
|
2798
|
-
}).locator(".d-select-
|
|
2862
|
+
hasText: "内容类型声明"
|
|
2863
|
+
}).locator(".d-select-placeholder").click();
|
|
2799
2864
|
const poperInstance = await getPoperInstance();
|
|
2800
2865
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
2801
2866
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -2872,7 +2937,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2872
2937
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2873
2938
|
};
|
|
2874
2939
|
var package_namespaceObject = {
|
|
2875
|
-
i8: "1.2.
|
|
2940
|
+
i8: "1.2.7"
|
|
2876
2941
|
};
|
|
2877
2942
|
class Action {
|
|
2878
2943
|
constructor(task){
|
|
@@ -2909,6 +2974,9 @@ class Action {
|
|
|
2909
2974
|
xiaohongshuPublish(params) {
|
|
2910
2975
|
return this.bindTask(xiaohongshuPublish, params);
|
|
2911
2976
|
}
|
|
2977
|
+
searchXiaohongshuTopicList(params) {
|
|
2978
|
+
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
2979
|
+
}
|
|
2912
2980
|
searchXiaohongshuLocation(params) {
|
|
2913
2981
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
2914
2982
|
}
|