@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
|
@@ -20,7 +20,6 @@ export interface XiaohongshuPublishParams extends ActiomCommonParams {
|
|
|
20
20
|
content: string;
|
|
21
21
|
address?: Xiaohongshu.Location;
|
|
22
22
|
selfDeclaration?: SelfDeclaration;
|
|
23
|
-
topic?: Xiaohongshu.Topic[];
|
|
24
23
|
visibleRange: "public" | "private";
|
|
25
24
|
isImmediatelyPublish?: boolean;
|
|
26
25
|
scheduledPublish?: string;
|
package/dist/bundle.js
CHANGED
|
@@ -13583,36 +13583,6 @@ var __webpack_exports__ = {};
|
|
|
13583
13583
|
return success([]);
|
|
13584
13584
|
}
|
|
13585
13585
|
};
|
|
13586
|
-
const searchXiaohongshuTopicList = async (_task, params)=>{
|
|
13587
|
-
const http = new Http({
|
|
13588
|
-
headers: {
|
|
13589
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
13590
|
-
referer: "https://creator.xiaohongshu.com",
|
|
13591
|
-
origin: "https://creator.xiaohongshu.com"
|
|
13592
|
-
}
|
|
13593
|
-
});
|
|
13594
|
-
try {
|
|
13595
|
-
const result = await http.api({
|
|
13596
|
-
method: "post",
|
|
13597
|
-
url: "https://edith.xiaohongshu.com/web_api/sns/v1/search/topic",
|
|
13598
|
-
data: {
|
|
13599
|
-
keyword: params.searchValue,
|
|
13600
|
-
suggest_topic_request: {
|
|
13601
|
-
title: "",
|
|
13602
|
-
desc: `#${params.searchValue}`
|
|
13603
|
-
},
|
|
13604
|
-
page: {
|
|
13605
|
-
page_size: 20,
|
|
13606
|
-
page: 1
|
|
13607
|
-
}
|
|
13608
|
-
},
|
|
13609
|
-
defaultErrorMsg: "话题搜索异常,请稍后重试。"
|
|
13610
|
-
});
|
|
13611
|
-
return success(0 === result.code ? result.data.topic_info_dtos : [], '获取话题成功');
|
|
13612
|
-
} catch (error) {
|
|
13613
|
-
return success([]);
|
|
13614
|
-
}
|
|
13615
|
-
};
|
|
13616
13586
|
const mock_errnoMap = {
|
|
13617
13587
|
20004020: "图片上传异常,请重新绑定账号后同步。",
|
|
13618
13588
|
7115: "正文图片和封面图片推荐jpg、png格式。",
|
|
@@ -13821,10 +13791,6 @@ var __webpack_exports__ = {};
|
|
|
13821
13791
|
});
|
|
13822
13792
|
} else await route.continue();
|
|
13823
13793
|
});
|
|
13824
|
-
PopupListener(page, '.byte-modal.publish-exclusive-modal .title', "激励", '.byte-modal-close-icon', {
|
|
13825
|
-
checkInterval: 1000,
|
|
13826
|
-
stopAfterClick: false
|
|
13827
|
-
});
|
|
13828
13794
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
13829
13795
|
await titleInstance.click();
|
|
13830
13796
|
await titleInstance.fill(params.title);
|
|
@@ -15467,8 +15433,7 @@ var __webpack_exports__ = {};
|
|
|
15467
15433
|
}
|
|
15468
15434
|
}
|
|
15469
15435
|
const xiaohongshuPublish_mock_errnoMap = {
|
|
15470
|
-
903: "账户已登出,需重新登陆重试!"
|
|
15471
|
-
902: "登录已过期,请重新登录!"
|
|
15436
|
+
903: "账户已登出,需重新登陆重试!"
|
|
15472
15437
|
};
|
|
15473
15438
|
const xsEncrypt = new XsEncrypt();
|
|
15474
15439
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
@@ -15538,34 +15503,13 @@ var __webpack_exports__ = {};
|
|
|
15538
15503
|
};
|
|
15539
15504
|
};
|
|
15540
15505
|
const coverInfos = await Promise.all(params.banners.map((it, idx)=>uploadFile(it, idx)));
|
|
15541
|
-
if (params.topic && params.topic.length > 0) await Promise.all(params.topic.map(async (topic)=>{
|
|
15542
|
-
if (!topic["id"]) {
|
|
15543
|
-
const topicData = {
|
|
15544
|
-
topic_names: topic["name"]
|
|
15545
|
-
};
|
|
15546
|
-
const topicDataStr = xsEncrypt.dumps(topicData);
|
|
15547
|
-
const publishXt = Date.now().toString();
|
|
15548
|
-
const publishXs = await xsEncrypt.encryptXs(`/web_api/sns/capa/postgw/topic/batch_customized${topicDataStr}`, a1Cookie, publishXt);
|
|
15549
|
-
let createTopic = await http.api({
|
|
15550
|
-
method: "POST",
|
|
15551
|
-
url: "https://edith.xiaohongshu.com/web_api/sns/capa/postgw/topic/batch_customized",
|
|
15552
|
-
headers: {
|
|
15553
|
-
"x-s": publishXs,
|
|
15554
|
-
"x-t": publishXt
|
|
15555
|
-
},
|
|
15556
|
-
data: topicData,
|
|
15557
|
-
defaultErrorMsg: "话题创建异常,请稍后重试。"
|
|
15558
|
-
});
|
|
15559
|
-
Object.assign(topic, createTopic.data.topic_infos[0]);
|
|
15560
|
-
}
|
|
15561
|
-
}));
|
|
15562
15506
|
const publishData = {
|
|
15563
15507
|
common: {
|
|
15564
15508
|
ats: [],
|
|
15565
15509
|
biz_relations: [],
|
|
15566
15510
|
desc: params?.content,
|
|
15567
15511
|
goods_info: {},
|
|
15568
|
-
hash_tag:
|
|
15512
|
+
hash_tag: [],
|
|
15569
15513
|
note_id: "",
|
|
15570
15514
|
source: JSON.stringify({
|
|
15571
15515
|
type: "web",
|
|
@@ -15683,7 +15627,6 @@ var __webpack_exports__ = {};
|
|
|
15683
15627
|
'/api/galaxy/v2/creator/activity_center/list',
|
|
15684
15628
|
'/web_api/sns/v5/creator/topic/template/list',
|
|
15685
15629
|
'/web_api/sns/v5/creator/file/encryption',
|
|
15686
|
-
'/web_api/sns/capa/postgw/topic/batch_customized',
|
|
15687
15630
|
'/web_api/sns/v2/note'
|
|
15688
15631
|
];
|
|
15689
15632
|
await page.route('**', async (route, request)=>{
|
|
@@ -15705,11 +15648,11 @@ var __webpack_exports__ = {};
|
|
|
15705
15648
|
});
|
|
15706
15649
|
return;
|
|
15707
15650
|
}
|
|
15708
|
-
const isNoteRequest = urlObj.pathname.includes(interceptUrls[
|
|
15651
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[4]);
|
|
15709
15652
|
const xs = await (isNoteRequest ? (async ()=>{
|
|
15710
15653
|
const publishData = JSON.parse(request.postData() || "");
|
|
15711
15654
|
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
15712
|
-
return rpa_xsEncrypt.encryptXs(interceptUrls[
|
|
15655
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[4] + publishDataStr, a1Cookie, xt);
|
|
15713
15656
|
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
15714
15657
|
const newHeaders = {
|
|
15715
15658
|
...request.headers(),
|
|
@@ -15763,7 +15706,7 @@ var __webpack_exports__ = {};
|
|
|
15763
15706
|
data: page.url()
|
|
15764
15707
|
};
|
|
15765
15708
|
}
|
|
15766
|
-
await page.locator("#content-area .menu-container .publish-video
|
|
15709
|
+
await page.locator("#content-area .menu-container .publish-video a").click();
|
|
15767
15710
|
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
15768
15711
|
hasText: /^上传图文$/
|
|
15769
15712
|
}).click();
|
|
@@ -15780,15 +15723,7 @@ var __webpack_exports__ = {};
|
|
|
15780
15723
|
await titleInstance.fill(params.title);
|
|
15781
15724
|
const descInstance = page.locator(".editor-container #quillEditor .ql-editor");
|
|
15782
15725
|
await descInstance.click();
|
|
15783
|
-
await descInstance.
|
|
15784
|
-
if (params.topic && params.topic.length > 0) for (const it of params.topic){
|
|
15785
|
-
await descInstance.pressSequentially(`#${it["name"]}`);
|
|
15786
|
-
await page.locator('.ql-mention-loading').waitFor({
|
|
15787
|
-
state: 'detached'
|
|
15788
|
-
});
|
|
15789
|
-
await page.waitForTimeout(1000);
|
|
15790
|
-
await page.locator('#quill-mention-item-0 .item-view-num').click();
|
|
15791
|
-
}
|
|
15726
|
+
await descInstance.fill(params.content);
|
|
15792
15727
|
const container = page.locator(".creator-container .content .scroll-content");
|
|
15793
15728
|
await container.focus();
|
|
15794
15729
|
await page.mouse.wheel(0, 500);
|
|
@@ -15797,8 +15732,8 @@ var __webpack_exports__ = {};
|
|
|
15797
15732
|
}), params.address.name);
|
|
15798
15733
|
if (params.selfDeclaration) {
|
|
15799
15734
|
await page.locator(".media-settings .flexbox").filter({
|
|
15800
|
-
hasText: "
|
|
15801
|
-
}).locator(".d-select-
|
|
15735
|
+
hasText: "自主声明"
|
|
15736
|
+
}).locator(".d-select-wrapper").click();
|
|
15802
15737
|
const poperInstance = await getPoperInstance();
|
|
15803
15738
|
const selfDeclarationInstance = poperInstance.locator(".d-options .d-option");
|
|
15804
15739
|
if ("fictional-rendition" === params.selfDeclaration.type) await selfDeclarationInstance.filter({
|
|
@@ -15874,13 +15809,16 @@ var __webpack_exports__ = {};
|
|
|
15874
15809
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
15875
15810
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
15876
15811
|
};
|
|
15877
|
-
var package_namespaceObject =
|
|
15812
|
+
var package_namespaceObject = {
|
|
15813
|
+
i8: "1.2.5"
|
|
15814
|
+
};
|
|
15878
15815
|
class Action {
|
|
15879
15816
|
constructor(task){
|
|
15880
15817
|
this.task = task;
|
|
15881
15818
|
}
|
|
15882
15819
|
async bindTask(func, params) {
|
|
15883
15820
|
let responseData;
|
|
15821
|
+
if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
|
|
15884
15822
|
if ("object" == typeof params && null !== params) params.cookies = params?.cookies ?? [];
|
|
15885
15823
|
try {
|
|
15886
15824
|
responseData = await func(this.task, params);
|
|
@@ -15909,9 +15847,6 @@ var __webpack_exports__ = {};
|
|
|
15909
15847
|
xiaohongshuPublish(params) {
|
|
15910
15848
|
return this.bindTask(xiaohongshuPublish, params);
|
|
15911
15849
|
}
|
|
15912
|
-
searchXiaohongshuTopicList(params) {
|
|
15913
|
-
return this.bindTask(searchXiaohongshuTopicList, params);
|
|
15914
|
-
}
|
|
15915
15850
|
searchXiaohongshuLocation(params) {
|
|
15916
15851
|
return this.bindTask(searchXiaohongshuLocation, params);
|
|
15917
15852
|
}
|