@iflyrpa/actions 1.2.1 → 1.2.3
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/bundle.js +62 -2
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -13760,6 +13760,18 @@ var __webpack_exports__ = {};
|
|
|
13760
13760
|
data: page.url()
|
|
13761
13761
|
};
|
|
13762
13762
|
}
|
|
13763
|
+
const interceptUrls = [
|
|
13764
|
+
'/mp/agw/article/publish'
|
|
13765
|
+
];
|
|
13766
|
+
await page.route('**', async (route, request)=>{
|
|
13767
|
+
const url = new URL(request.url());
|
|
13768
|
+
if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
|
|
13769
|
+
url.searchParams.set('aid', '1');
|
|
13770
|
+
await route.continue({
|
|
13771
|
+
url: url.toString()
|
|
13772
|
+
});
|
|
13773
|
+
} else await route.continue();
|
|
13774
|
+
});
|
|
13763
13775
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
13764
13776
|
await titleInstance.click();
|
|
13765
13777
|
await titleInstance.fill(params.title);
|
|
@@ -13825,7 +13837,8 @@ var __webpack_exports__ = {};
|
|
|
13825
13837
|
const adContainer = page.locator(".form-container .edit-cell .edit-label").filter({
|
|
13826
13838
|
hasText: "投放广告"
|
|
13827
13839
|
}).locator("xpath=..");
|
|
13828
|
-
await adContainer.
|
|
13840
|
+
const isAdOptionVisible = await adContainer.isVisible();
|
|
13841
|
+
if (isAdOptionVisible) await adContainer.locator(`label.byte-radio:has(input[value="${getAddTypeValue(params.settingInfo.toutiaoAd)}"])`).click();
|
|
13829
13842
|
if (params.settingInfo.toutiaoOriginal.includes("exclusive")) {
|
|
13830
13843
|
const exclusiveContainer = page.locator(".form-container .edit-cell .edit-label").filter({
|
|
13831
13844
|
hasText: "声明首发"
|
|
@@ -13846,6 +13859,11 @@ var __webpack_exports__ = {};
|
|
|
13846
13859
|
hasText: "预览并发布"
|
|
13847
13860
|
}).click();
|
|
13848
13861
|
});
|
|
13862
|
+
if ('no' == params.settingInfo.toutiaoAd) {
|
|
13863
|
+
await page.waitForTimeout(200);
|
|
13864
|
+
const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
|
|
13865
|
+
if (await confirmBtn.isVisible()) await confirmBtn.click();
|
|
13866
|
+
}
|
|
13849
13867
|
if ("publish" === params.saveType) {
|
|
13850
13868
|
await page.locator(".publish-footer button").filter({
|
|
13851
13869
|
hasText: "确认发布"
|
|
@@ -15115,6 +15133,7 @@ var __webpack_exports__ = {};
|
|
|
15115
15133
|
});
|
|
15116
15134
|
return success(publishResult.data.id);
|
|
15117
15135
|
};
|
|
15136
|
+
const rpa_xsEncrypt = new XsEncrypt();
|
|
15118
15137
|
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
15119
15138
|
const commonCookies = {
|
|
15120
15139
|
path: "/",
|
|
@@ -15133,6 +15152,47 @@ var __webpack_exports__ = {};
|
|
|
15133
15152
|
})) || []
|
|
15134
15153
|
});
|
|
15135
15154
|
const tmpCachePath = task.getTmpPath();
|
|
15155
|
+
const interceptUrls = [
|
|
15156
|
+
'/api/media/v1/upload/creator/permit',
|
|
15157
|
+
'/api/galaxy/v2/creator/activity_center/list',
|
|
15158
|
+
'/web_api/sns/v5/creator/topic/template/list',
|
|
15159
|
+
'/web_api/sns/v5/creator/file/encryption',
|
|
15160
|
+
'/web_api/sns/v2/note'
|
|
15161
|
+
];
|
|
15162
|
+
await page.route('**', async (route, request)=>{
|
|
15163
|
+
const url = request.url();
|
|
15164
|
+
if (interceptUrls.some((pattern)=>url.includes(pattern))) {
|
|
15165
|
+
const urlObj = new URL(url);
|
|
15166
|
+
const fetchCoverUrl = urlObj.pathname + urlObj.search;
|
|
15167
|
+
const xt = Date.now().toString();
|
|
15168
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
15169
|
+
if (!a1Cookie) {
|
|
15170
|
+
await route.fulfill({
|
|
15171
|
+
status: 200,
|
|
15172
|
+
contentType: 'application/json',
|
|
15173
|
+
body: JSON.stringify({
|
|
15174
|
+
code: 200,
|
|
15175
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
15176
|
+
data: ""
|
|
15177
|
+
})
|
|
15178
|
+
});
|
|
15179
|
+
return;
|
|
15180
|
+
}
|
|
15181
|
+
const isNoteRequest = urlObj.pathname.includes(interceptUrls[4]);
|
|
15182
|
+
const xs = await (isNoteRequest ? (async ()=>{
|
|
15183
|
+
const publishData = JSON.parse(request.postData() || "");
|
|
15184
|
+
const publishDataStr = rpa_xsEncrypt.dumps(publishData);
|
|
15185
|
+
return rpa_xsEncrypt.encryptXs(interceptUrls[4] + publishDataStr, a1Cookie, xt);
|
|
15186
|
+
})() : rpa_xsEncrypt.encryptXs(fetchCoverUrl, a1Cookie, xt));
|
|
15187
|
+
const newHeaders = {
|
|
15188
|
+
...request.headers(),
|
|
15189
|
+
'x-s': xs
|
|
15190
|
+
};
|
|
15191
|
+
await route.continue({
|
|
15192
|
+
headers: newHeaders
|
|
15193
|
+
});
|
|
15194
|
+
} else await route.continue();
|
|
15195
|
+
});
|
|
15136
15196
|
const selectAddress = async (selector, address)=>{
|
|
15137
15197
|
const instance = "string" == typeof selector ? page.locator(selector) : selector;
|
|
15138
15198
|
await instance.click();
|
|
@@ -15280,7 +15340,7 @@ var __webpack_exports__ = {};
|
|
|
15280
15340
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
15281
15341
|
};
|
|
15282
15342
|
var package_namespaceObject = {
|
|
15283
|
-
i8: "1.2.
|
|
15343
|
+
i8: "1.2.2"
|
|
15284
15344
|
};
|
|
15285
15345
|
class Action {
|
|
15286
15346
|
constructor(task){
|