@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.mjs
CHANGED
|
@@ -5433,9 +5433,7 @@ function __webpack_require__(moduleId) {
|
|
|
5433
5433
|
return module;
|
|
5434
5434
|
};
|
|
5435
5435
|
})();
|
|
5436
|
-
var package_namespaceObject = {
|
|
5437
|
-
i8: "2.0.1"
|
|
5438
|
-
};
|
|
5436
|
+
var package_namespaceObject = JSON.parse('{"i8":"3.0.0-beta.1"}');
|
|
5439
5437
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5440
5438
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5441
5439
|
const http = new Http({
|
|
@@ -5571,6 +5569,7 @@ class Http {
|
|
|
5571
5569
|
}
|
|
5572
5570
|
}
|
|
5573
5571
|
errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
5572
|
+
if ("canceled" === errorResponse.message) errorResponse.message = "网络请求超时,请稍后重试!";
|
|
5574
5573
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
5575
5574
|
throw errorResponse;
|
|
5576
5575
|
});
|
|
@@ -23150,120 +23149,6 @@ const xiaohongshuLogin = async (task, params)=>{
|
|
|
23150
23149
|
if ("server" === params.actionType) return xiaohongshuLogin_rpa_server_rpaServer(task, params);
|
|
23151
23150
|
return executeAction(xiaohongshuLogin_rpa_rpaAction)(task, params);
|
|
23152
23151
|
};
|
|
23153
|
-
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
23154
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
23155
|
-
const commonCookies = {
|
|
23156
|
-
path: "/",
|
|
23157
|
-
sameSite: "lax",
|
|
23158
|
-
secure: false,
|
|
23159
|
-
domain: ".xiaohongshu.com",
|
|
23160
|
-
url: "https://creator.xiaohongshu.com",
|
|
23161
|
-
httpOnly: true
|
|
23162
|
-
};
|
|
23163
|
-
const page = await task.createPage({
|
|
23164
|
-
show: task.debug,
|
|
23165
|
-
url: params.url || "https://creator.xiaohongshu.com/publish/publish",
|
|
23166
|
-
cookies: params.cookies?.map((it)=>({
|
|
23167
|
-
...it,
|
|
23168
|
-
...commonCookies
|
|
23169
|
-
}))
|
|
23170
|
-
});
|
|
23171
|
-
await page.addInitScript(()=>{
|
|
23172
|
-
Object.defineProperty(navigator, "webdriver", {
|
|
23173
|
-
get: ()=>void 0
|
|
23174
|
-
});
|
|
23175
|
-
window.chrome = {
|
|
23176
|
-
runtime: {}
|
|
23177
|
-
};
|
|
23178
|
-
const originalQuery = window.navigator.permissions.query;
|
|
23179
|
-
window.navigator.permissions.query = (parameters)=>"notifications" === parameters.name ? Promise.resolve({
|
|
23180
|
-
state: Notification.permission
|
|
23181
|
-
}) : originalQuery(parameters);
|
|
23182
|
-
Object.defineProperty(navigator, "plugins", {
|
|
23183
|
-
get: ()=>[
|
|
23184
|
-
1,
|
|
23185
|
-
2,
|
|
23186
|
-
3,
|
|
23187
|
-
4,
|
|
23188
|
-
5
|
|
23189
|
-
]
|
|
23190
|
-
});
|
|
23191
|
-
Object.defineProperty(navigator, "languages", {
|
|
23192
|
-
get: ()=>[
|
|
23193
|
-
"zh-CN",
|
|
23194
|
-
"zh",
|
|
23195
|
-
"en"
|
|
23196
|
-
]
|
|
23197
|
-
});
|
|
23198
|
-
});
|
|
23199
|
-
await updateTaskState?.({
|
|
23200
|
-
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.ACTION,
|
|
23201
|
-
connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
|
|
23202
|
-
sessionId: task.sessionId
|
|
23203
|
-
});
|
|
23204
|
-
const tmpCachePath = task.getTmpPath();
|
|
23205
|
-
try {
|
|
23206
|
-
await page.waitForSelector("#CreatorPlatform", {
|
|
23207
|
-
state: "visible"
|
|
23208
|
-
});
|
|
23209
|
-
} catch (error) {
|
|
23210
|
-
return {
|
|
23211
|
-
code: 414,
|
|
23212
|
-
message: "登录失效",
|
|
23213
|
-
data: page.url()
|
|
23214
|
-
};
|
|
23215
|
-
}
|
|
23216
|
-
await page.locator("#content-area .menu-container .publish-video .btn-wrapper .btn-inner").click();
|
|
23217
|
-
await page.locator('.header-tabs .creator-tab:not([style*="-9999px"])').filter({
|
|
23218
|
-
hasText: /^上传图文$/
|
|
23219
|
-
}).click();
|
|
23220
|
-
const images = await Promise.all(params.banners.map((url)=>{
|
|
23221
|
-
const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
|
|
23222
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
|
|
23223
|
-
}));
|
|
23224
|
-
const fileChooser = await page.$("input.upload-input");
|
|
23225
|
-
if (fileChooser) await fileChooser.setInputFiles(images);
|
|
23226
|
-
const titleInstance = page.locator(".input input");
|
|
23227
|
-
await titleInstance.waitFor({
|
|
23228
|
-
state: "visible",
|
|
23229
|
-
timeout: 50000
|
|
23230
|
-
});
|
|
23231
|
-
await titleInstance.click();
|
|
23232
|
-
await titleInstance.fill(params.title);
|
|
23233
|
-
const descInstance = page.locator(".editor-container .tiptap.ProseMirror");
|
|
23234
|
-
await descInstance.click();
|
|
23235
|
-
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, ""));
|
|
23236
|
-
await page.waitForFunction(()=>{
|
|
23237
|
-
const publishBtn = Array.from(document.querySelectorAll("button")).find((b)=>b.textContent?.trim() === "发布");
|
|
23238
|
-
const uploading = document.querySelector(".progress-container");
|
|
23239
|
-
return !!publishBtn && !uploading;
|
|
23240
|
-
}, {
|
|
23241
|
-
timeout: 180000,
|
|
23242
|
-
polling: 2000
|
|
23243
|
-
});
|
|
23244
|
-
const response = await new Promise((resolve, reject)=>{
|
|
23245
|
-
const handleResponse = async (response)=>{
|
|
23246
|
-
if (response.url().includes("/web_api/sns/v2/note")) {
|
|
23247
|
-
const jsonResponse = await response.json();
|
|
23248
|
-
page.off("response", handleResponse);
|
|
23249
|
-
if (jsonResponse?.success) resolve(jsonResponse?.data?.id);
|
|
23250
|
-
else reject(new Error(jsonResponse?.msg || "发布失败"));
|
|
23251
|
-
}
|
|
23252
|
-
};
|
|
23253
|
-
page.on("response", handleResponse);
|
|
23254
|
-
page.locator(".publish-page-publish-btn button").filter({
|
|
23255
|
-
hasText: "发布"
|
|
23256
|
-
}).click();
|
|
23257
|
-
});
|
|
23258
|
-
await updateTaskState?.({
|
|
23259
|
-
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
23260
|
-
result: {
|
|
23261
|
-
response
|
|
23262
|
-
}
|
|
23263
|
-
});
|
|
23264
|
-
await page.close();
|
|
23265
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(response);
|
|
23266
|
-
};
|
|
23267
23152
|
const FictionalRendition = schemas_object({
|
|
23268
23153
|
type: literal("fictional-rendition")
|
|
23269
23154
|
});
|
|
@@ -23310,7 +23195,11 @@ const XiaohongshuPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
|
23310
23195
|
coProduceBind: schemas_boolean().optional(),
|
|
23311
23196
|
originalBind: schemas_boolean().optional()
|
|
23312
23197
|
});
|
|
23313
|
-
const xiaohongshuPublish = async (_task, _params)=>
|
|
23198
|
+
const xiaohongshuPublish = async (_task, _params)=>({
|
|
23199
|
+
code: 414,
|
|
23200
|
+
data: "",
|
|
23201
|
+
message: "临时维护:小红书发布政策调整,本平台小红书发布功能临时暂停服务并进行维护调整,暂时无法正常发布,敬请理解知悉。"
|
|
23202
|
+
});
|
|
23314
23203
|
const xiaohongshuWebCommentAction_xsEncrypt = new Xhshow();
|
|
23315
23204
|
const xiaohongshuWebCommentAction = async (_task, params)=>{
|
|
23316
23205
|
if (DisabledReq) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "点赞相关操作失败", {});
|