@iflyrpa/actions 3.0.0-beta.0 → 3.0.0-beta.2
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 +7 -118
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +7 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5489,9 +5489,7 @@ var __webpack_exports__ = {};
|
|
|
5489
5489
|
});
|
|
5490
5490
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
5491
5491
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
5492
|
-
var package_namespaceObject = {
|
|
5493
|
-
i8: "2.0.1"
|
|
5494
|
-
};
|
|
5492
|
+
var package_namespaceObject = JSON.parse('{"i8":"3.0.0-beta.1"}');
|
|
5495
5493
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
5496
5494
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
5497
5495
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -5642,6 +5640,7 @@ var __webpack_exports__ = {};
|
|
|
5642
5640
|
}
|
|
5643
5641
|
}
|
|
5644
5642
|
errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
5643
|
+
if ("canceled" === errorResponse.message) errorResponse.message = "网络请求超时,请稍后重试!";
|
|
5645
5644
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
5646
5645
|
throw errorResponse;
|
|
5647
5646
|
});
|
|
@@ -23235,120 +23234,6 @@ var __webpack_exports__ = {};
|
|
|
23235
23234
|
if ("server" === params.actionType) return xiaohongshuLogin_rpa_server_rpaServer(task, params);
|
|
23236
23235
|
return executeAction(xiaohongshuLogin_rpa_rpaAction)(task, params);
|
|
23237
23236
|
};
|
|
23238
|
-
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
23239
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
23240
|
-
const commonCookies = {
|
|
23241
|
-
path: "/",
|
|
23242
|
-
sameSite: "lax",
|
|
23243
|
-
secure: false,
|
|
23244
|
-
domain: ".xiaohongshu.com",
|
|
23245
|
-
url: "https://creator.xiaohongshu.com",
|
|
23246
|
-
httpOnly: true
|
|
23247
|
-
};
|
|
23248
|
-
const page = await task.createPage({
|
|
23249
|
-
show: task.debug,
|
|
23250
|
-
url: params.url || "https://creator.xiaohongshu.com/publish/publish",
|
|
23251
|
-
cookies: params.cookies?.map((it)=>({
|
|
23252
|
-
...it,
|
|
23253
|
-
...commonCookies
|
|
23254
|
-
}))
|
|
23255
|
-
});
|
|
23256
|
-
await page.addInitScript(()=>{
|
|
23257
|
-
Object.defineProperty(navigator, "webdriver", {
|
|
23258
|
-
get: ()=>void 0
|
|
23259
|
-
});
|
|
23260
|
-
window.chrome = {
|
|
23261
|
-
runtime: {}
|
|
23262
|
-
};
|
|
23263
|
-
const originalQuery = window.navigator.permissions.query;
|
|
23264
|
-
window.navigator.permissions.query = (parameters)=>"notifications" === parameters.name ? Promise.resolve({
|
|
23265
|
-
state: Notification.permission
|
|
23266
|
-
}) : originalQuery(parameters);
|
|
23267
|
-
Object.defineProperty(navigator, "plugins", {
|
|
23268
|
-
get: ()=>[
|
|
23269
|
-
1,
|
|
23270
|
-
2,
|
|
23271
|
-
3,
|
|
23272
|
-
4,
|
|
23273
|
-
5
|
|
23274
|
-
]
|
|
23275
|
-
});
|
|
23276
|
-
Object.defineProperty(navigator, "languages", {
|
|
23277
|
-
get: ()=>[
|
|
23278
|
-
"zh-CN",
|
|
23279
|
-
"zh",
|
|
23280
|
-
"en"
|
|
23281
|
-
]
|
|
23282
|
-
});
|
|
23283
|
-
});
|
|
23284
|
-
await updateTaskState?.({
|
|
23285
|
-
state: share_namespaceObject.TaskState.ACTION,
|
|
23286
|
-
connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
|
|
23287
|
-
sessionId: task.sessionId
|
|
23288
|
-
});
|
|
23289
|
-
const tmpCachePath = task.getTmpPath();
|
|
23290
|
-
try {
|
|
23291
|
-
await page.waitForSelector("#CreatorPlatform", {
|
|
23292
|
-
state: "visible"
|
|
23293
|
-
});
|
|
23294
|
-
} catch (error) {
|
|
23295
|
-
return {
|
|
23296
|
-
code: 414,
|
|
23297
|
-
message: "登录失效",
|
|
23298
|
-
data: page.url()
|
|
23299
|
-
};
|
|
23300
|
-
}
|
|
23301
|
-
await page.locator("#content-area .menu-container .publish-video .btn-wrapper .btn-inner").click();
|
|
23302
|
-
await page.locator('.header-tabs .creator-tab:not([style*="-9999px"])').filter({
|
|
23303
|
-
hasText: /^上传图文$/
|
|
23304
|
-
}).click();
|
|
23305
|
-
const images = await Promise.all(params.banners.map((url)=>{
|
|
23306
|
-
const fileName = (0, share_namespaceObject.getFilenameFromUrl)(url);
|
|
23307
|
-
return (0, share_namespaceObject.downloadImage)(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
23308
|
-
}));
|
|
23309
|
-
const fileChooser = await page.$("input.upload-input");
|
|
23310
|
-
if (fileChooser) await fileChooser.setInputFiles(images);
|
|
23311
|
-
const titleInstance = page.locator(".input input");
|
|
23312
|
-
await titleInstance.waitFor({
|
|
23313
|
-
state: "visible",
|
|
23314
|
-
timeout: 50000
|
|
23315
|
-
});
|
|
23316
|
-
await titleInstance.click();
|
|
23317
|
-
await titleInstance.fill(params.title);
|
|
23318
|
-
const descInstance = page.locator(".editor-container .tiptap.ProseMirror");
|
|
23319
|
-
await descInstance.click();
|
|
23320
|
-
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, ""));
|
|
23321
|
-
await page.waitForFunction(()=>{
|
|
23322
|
-
const publishBtn = Array.from(document.querySelectorAll("button")).find((b)=>b.textContent?.trim() === "发布");
|
|
23323
|
-
const uploading = document.querySelector(".progress-container");
|
|
23324
|
-
return !!publishBtn && !uploading;
|
|
23325
|
-
}, {
|
|
23326
|
-
timeout: 180000,
|
|
23327
|
-
polling: 2000
|
|
23328
|
-
});
|
|
23329
|
-
const response = await new Promise((resolve, reject)=>{
|
|
23330
|
-
const handleResponse = async (response)=>{
|
|
23331
|
-
if (response.url().includes("/web_api/sns/v2/note")) {
|
|
23332
|
-
const jsonResponse = await response.json();
|
|
23333
|
-
page.off("response", handleResponse);
|
|
23334
|
-
if (jsonResponse?.success) resolve(jsonResponse?.data?.id);
|
|
23335
|
-
else reject(new Error(jsonResponse?.msg || "发布失败"));
|
|
23336
|
-
}
|
|
23337
|
-
};
|
|
23338
|
-
page.on("response", handleResponse);
|
|
23339
|
-
page.locator(".publish-page-publish-btn button").filter({
|
|
23340
|
-
hasText: "发布"
|
|
23341
|
-
}).click();
|
|
23342
|
-
});
|
|
23343
|
-
await updateTaskState?.({
|
|
23344
|
-
state: share_namespaceObject.TaskState.SUCCESS,
|
|
23345
|
-
result: {
|
|
23346
|
-
response
|
|
23347
|
-
}
|
|
23348
|
-
});
|
|
23349
|
-
await page.close();
|
|
23350
|
-
return (0, share_namespaceObject.success)(response);
|
|
23351
|
-
};
|
|
23352
23237
|
const FictionalRendition = schemas_object({
|
|
23353
23238
|
type: literal("fictional-rendition")
|
|
23354
23239
|
});
|
|
@@ -23395,7 +23280,11 @@ var __webpack_exports__ = {};
|
|
|
23395
23280
|
coProduceBind: schemas_boolean().optional(),
|
|
23396
23281
|
originalBind: schemas_boolean().optional()
|
|
23397
23282
|
});
|
|
23398
|
-
const xiaohongshuPublish = async (_task, _params)=>
|
|
23283
|
+
const xiaohongshuPublish = async (_task, _params)=>({
|
|
23284
|
+
code: 414,
|
|
23285
|
+
data: "",
|
|
23286
|
+
message: "临时维护:小红书发布政策调整,本平台小红书发布功能临时暂停服务并进行维护调整,暂时无法正常发布,敬请理解知悉。"
|
|
23287
|
+
});
|
|
23399
23288
|
const xiaohongshuWebCommentAction_xsEncrypt = new Xhshow();
|
|
23400
23289
|
const xiaohongshuWebCommentAction = async (_task, params)=>{
|
|
23401
23290
|
if (DisabledReq) return (0, share_namespaceObject.response)(414, "点赞相关操作失败", {});
|