@iflyrpa/actions 1.2.2 → 1.2.4
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 +32 -6
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -233,7 +233,8 @@ const errnoMap = {
|
|
|
233
233
|
20040033: "封面图片推荐 jpg、png格式,宽高在372×284-5000×5000 范围内。",
|
|
234
234
|
2004005714: "网络环境异常,请检查网络后重试发布。",
|
|
235
235
|
401100032: "异常,请检查图片(如:格式、版权、合规性等)。",
|
|
236
|
-
20040034: "封面图片推荐jpg、png格式,不支持gif格式。"
|
|
236
|
+
20040034: "封面图片推荐jpg、png格式,不支持gif格式。",
|
|
237
|
+
20040124: "服务器异常,请稍后重试!"
|
|
237
238
|
};
|
|
238
239
|
const mockAction = async (task, params)=>{
|
|
239
240
|
const { baijiahaoSingleCover, baijiahaoMultCover, baijiahaoCoverType } = params.settingInfo;
|
|
@@ -825,6 +826,18 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
825
826
|
data: page.url()
|
|
826
827
|
};
|
|
827
828
|
}
|
|
829
|
+
const interceptUrls = [
|
|
830
|
+
'/mp/agw/article/publish'
|
|
831
|
+
];
|
|
832
|
+
await page.route('**', async (route, request)=>{
|
|
833
|
+
const url = new URL(request.url());
|
|
834
|
+
if (interceptUrls.some((pattern)=>url.pathname.includes(pattern))) {
|
|
835
|
+
url.searchParams.set('aid', '1');
|
|
836
|
+
await route.continue({
|
|
837
|
+
url: url.toString()
|
|
838
|
+
});
|
|
839
|
+
} else await route.continue();
|
|
840
|
+
});
|
|
828
841
|
const titleInstance = page.locator(".publish-editor-title-wrapper .publish-editor-title textarea");
|
|
829
842
|
await titleInstance.click();
|
|
830
843
|
await titleInstance.fill(params.title);
|
|
@@ -890,7 +903,8 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
890
903
|
const adContainer = page.locator(".form-container .edit-cell .edit-label").filter({
|
|
891
904
|
hasText: "投放广告"
|
|
892
905
|
}).locator("xpath=..");
|
|
893
|
-
await adContainer.
|
|
906
|
+
const isAdOptionVisible = await adContainer.isVisible();
|
|
907
|
+
if (isAdOptionVisible) await adContainer.locator(`label.byte-radio:has(input[value="${getAddTypeValue(params.settingInfo.toutiaoAd)}"])`).click();
|
|
894
908
|
if (params.settingInfo.toutiaoOriginal.includes("exclusive")) {
|
|
895
909
|
const exclusiveContainer = page.locator(".form-container .edit-cell .edit-label").filter({
|
|
896
910
|
hasText: "声明首发"
|
|
@@ -911,6 +925,11 @@ const rpa_rpaAction = async (task, params)=>{
|
|
|
911
925
|
hasText: "预览并发布"
|
|
912
926
|
}).click();
|
|
913
927
|
});
|
|
928
|
+
if ('no' == params.settingInfo.toutiaoAd) {
|
|
929
|
+
await page.waitForTimeout(200);
|
|
930
|
+
const confirmBtn = page.locator('div.byte-modal-footer button.byte-btn-primary:has-text("确定")');
|
|
931
|
+
if (await confirmBtn.isVisible()) await confirmBtn.click();
|
|
932
|
+
}
|
|
914
933
|
if ("publish" === params.saveType) {
|
|
915
934
|
await page.locator(".publish-footer button").filter({
|
|
916
935
|
hasText: "确认发布"
|
|
@@ -2013,7 +2032,9 @@ class XsEncrypt {
|
|
|
2013
2032
|
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
2014
2033
|
}
|
|
2015
2034
|
}
|
|
2016
|
-
const xiaohongshuPublish_mock_errnoMap = {
|
|
2035
|
+
const xiaohongshuPublish_mock_errnoMap = {
|
|
2036
|
+
903: "账户已登出,需重新登陆重试!"
|
|
2037
|
+
};
|
|
2017
2038
|
const xsEncrypt = new XsEncrypt();
|
|
2018
2039
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
2019
2040
|
const tmpCachePath = task.getTmpPath();
|
|
@@ -2057,6 +2078,11 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2057
2078
|
});
|
|
2058
2079
|
const coverIds = coverIdInfo.data.uploadTempPermits[0].fileIds;
|
|
2059
2080
|
const ossToken = coverIdInfo.data.uploadTempPermits[0].token;
|
|
2081
|
+
if (!coverIds || !ossToken) return {
|
|
2082
|
+
code: 200,
|
|
2083
|
+
message: "图片上传失败,请稍后重试!",
|
|
2084
|
+
data: ""
|
|
2085
|
+
};
|
|
2060
2086
|
const uploadFile = async (url, index)=>{
|
|
2061
2087
|
const fileName = (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.getFilenameFromUrl)(url);
|
|
2062
2088
|
const localUrl = await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.downloadImage)(url, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, fileName));
|
|
@@ -2175,7 +2201,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
2175
2201
|
},
|
|
2176
2202
|
defaultErrorMsg: "文章发布异常,请稍后重试。"
|
|
2177
2203
|
});
|
|
2178
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data
|
|
2204
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id);
|
|
2179
2205
|
};
|
|
2180
2206
|
const rpa_xsEncrypt = new XsEncrypt();
|
|
2181
2207
|
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -2281,7 +2307,7 @@ const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
|
2281
2307
|
};
|
|
2282
2308
|
}
|
|
2283
2309
|
await page.locator("#content-area .menu-container .publish-video a").click();
|
|
2284
|
-
await page.locator(
|
|
2310
|
+
await page.locator('.creator-container .header .creator-tab:not([style*="-9999px"]) .title').filter({
|
|
2285
2311
|
hasText: /^上传图文$/
|
|
2286
2312
|
}).click();
|
|
2287
2313
|
const images = await Promise.all(params.banners.map((url)=>{
|
|
@@ -2384,7 +2410,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
2384
2410
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
2385
2411
|
};
|
|
2386
2412
|
var package_namespaceObject = {
|
|
2387
|
-
i8: "1.2.
|
|
2413
|
+
i8: "1.2.3"
|
|
2388
2414
|
};
|
|
2389
2415
|
class Action {
|
|
2390
2416
|
constructor(task){
|