@iflyrpa/actions 3.0.0-beta.0 → 3.0.0-beta.1
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 +1 -1
package/dist/bundle.js
CHANGED
|
@@ -8736,9 +8736,7 @@ var __webpack_exports__ = {};
|
|
|
8736
8736
|
var package_namespaceObject = {
|
|
8737
8737
|
i8: "0.0.18"
|
|
8738
8738
|
};
|
|
8739
|
-
var package_namespaceObject_0 = {
|
|
8740
|
-
i8: "2.0.1"
|
|
8741
|
-
};
|
|
8739
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"3.0.0-beta.0"}');
|
|
8742
8740
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
8743
8741
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
8744
8742
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -23401,6 +23399,7 @@ var __webpack_exports__ = {};
|
|
|
23401
23399
|
}
|
|
23402
23400
|
}
|
|
23403
23401
|
errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
23402
|
+
if ("canceled" === errorResponse.message) errorResponse.message = "网络请求超时,请稍后重试!";
|
|
23404
23403
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
23405
23404
|
throw errorResponse;
|
|
23406
23405
|
});
|
|
@@ -42893,120 +42892,6 @@ var __webpack_exports__ = {};
|
|
|
42893
42892
|
if ("server" === params.actionType) return xiaohongshuLogin_rpa_server_rpaServer(task, params);
|
|
42894
42893
|
return executeAction(xiaohongshuLogin_rpa_rpaAction)(task, params);
|
|
42895
42894
|
};
|
|
42896
|
-
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
42897
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
42898
|
-
const commonCookies = {
|
|
42899
|
-
path: "/",
|
|
42900
|
-
sameSite: "lax",
|
|
42901
|
-
secure: false,
|
|
42902
|
-
domain: ".xiaohongshu.com",
|
|
42903
|
-
url: "https://creator.xiaohongshu.com",
|
|
42904
|
-
httpOnly: true
|
|
42905
|
-
};
|
|
42906
|
-
const page = await task.createPage({
|
|
42907
|
-
show: task.debug,
|
|
42908
|
-
url: params.url || "https://creator.xiaohongshu.com/publish/publish",
|
|
42909
|
-
cookies: params.cookies?.map((it)=>({
|
|
42910
|
-
...it,
|
|
42911
|
-
...commonCookies
|
|
42912
|
-
}))
|
|
42913
|
-
});
|
|
42914
|
-
await page.addInitScript(()=>{
|
|
42915
|
-
Object.defineProperty(navigator, "webdriver", {
|
|
42916
|
-
get: ()=>void 0
|
|
42917
|
-
});
|
|
42918
|
-
window.chrome = {
|
|
42919
|
-
runtime: {}
|
|
42920
|
-
};
|
|
42921
|
-
const originalQuery = window.navigator.permissions.query;
|
|
42922
|
-
window.navigator.permissions.query = (parameters)=>"notifications" === parameters.name ? Promise.resolve({
|
|
42923
|
-
state: Notification.permission
|
|
42924
|
-
}) : originalQuery(parameters);
|
|
42925
|
-
Object.defineProperty(navigator, "plugins", {
|
|
42926
|
-
get: ()=>[
|
|
42927
|
-
1,
|
|
42928
|
-
2,
|
|
42929
|
-
3,
|
|
42930
|
-
4,
|
|
42931
|
-
5
|
|
42932
|
-
]
|
|
42933
|
-
});
|
|
42934
|
-
Object.defineProperty(navigator, "languages", {
|
|
42935
|
-
get: ()=>[
|
|
42936
|
-
"zh-CN",
|
|
42937
|
-
"zh",
|
|
42938
|
-
"en"
|
|
42939
|
-
]
|
|
42940
|
-
});
|
|
42941
|
-
});
|
|
42942
|
-
await updateTaskState?.({
|
|
42943
|
-
state: types_TaskState.ACTION,
|
|
42944
|
-
connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
|
|
42945
|
-
sessionId: task.sessionId
|
|
42946
|
-
});
|
|
42947
|
-
const tmpCachePath = task.getTmpPath();
|
|
42948
|
-
try {
|
|
42949
|
-
await page.waitForSelector("#CreatorPlatform", {
|
|
42950
|
-
state: "visible"
|
|
42951
|
-
});
|
|
42952
|
-
} catch (error) {
|
|
42953
|
-
return {
|
|
42954
|
-
code: 414,
|
|
42955
|
-
message: "登录失效",
|
|
42956
|
-
data: page.url()
|
|
42957
|
-
};
|
|
42958
|
-
}
|
|
42959
|
-
await page.locator("#content-area .menu-container .publish-video .btn-wrapper .btn-inner").click();
|
|
42960
|
-
await page.locator('.header-tabs .creator-tab:not([style*="-9999px"])').filter({
|
|
42961
|
-
hasText: /^上传图文$/
|
|
42962
|
-
}).click();
|
|
42963
|
-
const images = await Promise.all(params.banners.map((url)=>{
|
|
42964
|
-
const fileName = getFilenameFromUrl(url);
|
|
42965
|
-
return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
42966
|
-
}));
|
|
42967
|
-
const fileChooser = await page.$("input.upload-input");
|
|
42968
|
-
if (fileChooser) await fileChooser.setInputFiles(images);
|
|
42969
|
-
const titleInstance = page.locator(".input input");
|
|
42970
|
-
await titleInstance.waitFor({
|
|
42971
|
-
state: "visible",
|
|
42972
|
-
timeout: 50000
|
|
42973
|
-
});
|
|
42974
|
-
await titleInstance.click();
|
|
42975
|
-
await titleInstance.fill(params.title);
|
|
42976
|
-
const descInstance = page.locator(".editor-container .tiptap.ProseMirror");
|
|
42977
|
-
await descInstance.click();
|
|
42978
|
-
await descInstance.pressSequentially(params.content.replace(/#.*?\[.*?]#/g, ""));
|
|
42979
|
-
await page.waitForFunction(()=>{
|
|
42980
|
-
const publishBtn = Array.from(document.querySelectorAll("button")).find((b)=>b.textContent?.trim() === "发布");
|
|
42981
|
-
const uploading = document.querySelector(".progress-container");
|
|
42982
|
-
return !!publishBtn && !uploading;
|
|
42983
|
-
}, {
|
|
42984
|
-
timeout: 180000,
|
|
42985
|
-
polling: 2000
|
|
42986
|
-
});
|
|
42987
|
-
const response = await new Promise((resolve, reject)=>{
|
|
42988
|
-
const handleResponse = async (response)=>{
|
|
42989
|
-
if (response.url().includes("/web_api/sns/v2/note")) {
|
|
42990
|
-
const jsonResponse = await response.json();
|
|
42991
|
-
page.off("response", handleResponse);
|
|
42992
|
-
if (jsonResponse?.success) resolve(jsonResponse?.data?.id);
|
|
42993
|
-
else reject(new Error(jsonResponse?.msg || "发布失败"));
|
|
42994
|
-
}
|
|
42995
|
-
};
|
|
42996
|
-
page.on("response", handleResponse);
|
|
42997
|
-
page.locator(".publish-page-publish-btn button").filter({
|
|
42998
|
-
hasText: "发布"
|
|
42999
|
-
}).click();
|
|
43000
|
-
});
|
|
43001
|
-
await updateTaskState?.({
|
|
43002
|
-
state: types_TaskState.SUCCESS,
|
|
43003
|
-
result: {
|
|
43004
|
-
response
|
|
43005
|
-
}
|
|
43006
|
-
});
|
|
43007
|
-
await page.close();
|
|
43008
|
-
return success(response);
|
|
43009
|
-
};
|
|
43010
42895
|
const FictionalRendition = classic_schemas_object({
|
|
43011
42896
|
type: literal("fictional-rendition")
|
|
43012
42897
|
});
|
|
@@ -43053,7 +42938,11 @@ var __webpack_exports__ = {};
|
|
|
43053
42938
|
coProduceBind: classic_schemas_boolean().optional(),
|
|
43054
42939
|
originalBind: classic_schemas_boolean().optional()
|
|
43055
42940
|
});
|
|
43056
|
-
const xiaohongshuPublish = async (_task, _params)=>
|
|
42941
|
+
const xiaohongshuPublish = async (_task, _params)=>({
|
|
42942
|
+
code: 414,
|
|
42943
|
+
data: "",
|
|
42944
|
+
message: "临时维护:小红书发布政策调整,本平台小红书发布功能临时暂停服务并进行维护调整,暂时无法正常发布,敬请理解知悉。"
|
|
42945
|
+
});
|
|
43057
42946
|
const xiaohongshuWebCommentAction_xsEncrypt = new Xhshow();
|
|
43058
42947
|
const xiaohongshuWebCommentAction = async (_task, params)=>{
|
|
43059
42948
|
if (DisabledReq) return utils_response(414, "点赞相关操作失败", {});
|