@iflyrpa/actions 4.0.0-beta.1 → 4.0.0-beta.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 +103 -39
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +103 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5434,7 +5434,7 @@ function __webpack_require__(moduleId) {
|
|
|
5434
5434
|
return module;
|
|
5435
5435
|
};
|
|
5436
5436
|
})();
|
|
5437
|
-
var package_namespaceObject = JSON.parse('{"i8":"3.0.
|
|
5437
|
+
var package_namespaceObject = JSON.parse('{"i8":"3.0.7-beta.3"}');
|
|
5438
5438
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5439
5439
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5440
5440
|
const http = new Http({
|
|
@@ -14514,19 +14514,25 @@ const mock_mockAction = async (task, params)=>{
|
|
|
14514
14514
|
task.logger.info("========== api调用完成 ==========");
|
|
14515
14515
|
task.logger.info(`decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
14516
14516
|
if (needsVerification(decision)) {
|
|
14517
|
+
const details = [
|
|
14518
|
+
publishResult.status_msg,
|
|
14519
|
+
decision?.verify_title,
|
|
14520
|
+
decision?.verify_desc
|
|
14521
|
+
].filter(Boolean).join(" ");
|
|
14522
|
+
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
14517
14523
|
task.logger.warn(`TaskId:${task.taskId},检测到需要验证,准备返回验证信息`);
|
|
14518
|
-
|
|
14519
|
-
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.
|
|
14524
|
+
const mockData = {
|
|
14525
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
14526
|
+
error: message,
|
|
14520
14527
|
result: {
|
|
14521
|
-
|
|
14528
|
+
data: decision,
|
|
14529
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
14522
14530
|
}
|
|
14523
|
-
}
|
|
14524
|
-
|
|
14531
|
+
};
|
|
14532
|
+
await updateTaskState?.(mockData);
|
|
14525
14533
|
return {
|
|
14526
14534
|
code: 0,
|
|
14527
|
-
data:
|
|
14528
|
-
result: decision
|
|
14529
|
-
},
|
|
14535
|
+
data: mockData,
|
|
14530
14536
|
message: "操作成功"
|
|
14531
14537
|
};
|
|
14532
14538
|
}
|
|
@@ -15226,15 +15232,41 @@ const rpaAction_Server = async (task, params)=>{
|
|
|
15226
15232
|
}
|
|
15227
15233
|
task.logger?.info("准备发布...");
|
|
15228
15234
|
await page.waitForTimeout(1000);
|
|
15229
|
-
const
|
|
15235
|
+
const result = await new Promise((resolve, reject)=>{
|
|
15230
15236
|
const handleResponse = async (res)=>{
|
|
15231
15237
|
if (res.url().includes("/web/api/media/aweme/create_v2")) {
|
|
15232
15238
|
task.logger?.info("匹配到发布接口响应");
|
|
15239
|
+
let decision = null;
|
|
15240
|
+
try {
|
|
15241
|
+
const headers = await res.allHeaders();
|
|
15242
|
+
decision = parseVerifyPassportDecision(headers["x-tt-verify-passport-decision"]);
|
|
15243
|
+
} catch (error) {
|
|
15244
|
+
task.logger?.warn(`解析验证决策头失败: ${error}`);
|
|
15245
|
+
}
|
|
15233
15246
|
const jsonResponse = await res.json();
|
|
15234
15247
|
task.logger?.info(`发布接口响应数据: ${JSON.stringify(jsonResponse)}`);
|
|
15235
15248
|
page.off("response", handleResponse);
|
|
15236
|
-
if (
|
|
15237
|
-
|
|
15249
|
+
if (needsVerification(decision)) {
|
|
15250
|
+
task.logger?.warn("检测到需要二次验证,文章未真正发布");
|
|
15251
|
+
resolve({
|
|
15252
|
+
itemId: "",
|
|
15253
|
+
decision
|
|
15254
|
+
});
|
|
15255
|
+
return;
|
|
15256
|
+
}
|
|
15257
|
+
if (jsonResponse?.status_code !== 0) {
|
|
15258
|
+
reject(new Error(jsonResponse?.status_msg || "发布失败"));
|
|
15259
|
+
return;
|
|
15260
|
+
}
|
|
15261
|
+
const itemId = jsonResponse?.data?.item_id || jsonResponse?.item_id || "";
|
|
15262
|
+
if (!itemId) {
|
|
15263
|
+
reject(new Error(jsonResponse?.status_msg || "发布异常:未返回作品ID,文章可能未真正发布"));
|
|
15264
|
+
return;
|
|
15265
|
+
}
|
|
15266
|
+
resolve({
|
|
15267
|
+
itemId,
|
|
15268
|
+
decision: null
|
|
15269
|
+
});
|
|
15238
15270
|
}
|
|
15239
15271
|
};
|
|
15240
15272
|
page.on("response", handleResponse);
|
|
@@ -15256,20 +15288,42 @@ const rpaAction_Server = async (task, params)=>{
|
|
|
15256
15288
|
await page.close();
|
|
15257
15289
|
return null;
|
|
15258
15290
|
});
|
|
15259
|
-
if (!
|
|
15291
|
+
if (!result) return {
|
|
15260
15292
|
code: 414,
|
|
15261
15293
|
message: "发布失败",
|
|
15262
15294
|
data: ""
|
|
15263
15295
|
};
|
|
15264
|
-
|
|
15296
|
+
if (needsVerification(result.decision)) {
|
|
15297
|
+
const decision = result.decision;
|
|
15298
|
+
const details = [
|
|
15299
|
+
decision?.verify_title,
|
|
15300
|
+
decision?.verify_desc
|
|
15301
|
+
].filter(Boolean).join(" ");
|
|
15302
|
+
const message = `发布失败,需要二次验证${details ? `:${details}` : ""}`;
|
|
15303
|
+
task.logger?.warn(message);
|
|
15304
|
+
await updateTaskState?.({
|
|
15305
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
15306
|
+
error: message,
|
|
15307
|
+
result: {
|
|
15308
|
+
data: decision
|
|
15309
|
+
}
|
|
15310
|
+
});
|
|
15311
|
+
await page.close();
|
|
15312
|
+
return {
|
|
15313
|
+
code: 414,
|
|
15314
|
+
message,
|
|
15315
|
+
data: ""
|
|
15316
|
+
};
|
|
15317
|
+
}
|
|
15318
|
+
task.logger?.info(`✓ 发布成功,item_id: ${result.itemId}`);
|
|
15265
15319
|
await updateTaskState?.({
|
|
15266
15320
|
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
15267
15321
|
result: {
|
|
15268
|
-
response
|
|
15322
|
+
response: result.itemId
|
|
15269
15323
|
}
|
|
15270
15324
|
});
|
|
15271
15325
|
await page.close();
|
|
15272
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(
|
|
15326
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(result.itemId);
|
|
15273
15327
|
};
|
|
15274
15328
|
const DouyinPublishParamsSchema = ActionCommonParamsSchema.extend({
|
|
15275
15329
|
title: schemas_string(),
|
|
@@ -16049,26 +16103,26 @@ async function getToutiaoData(_task, params) {
|
|
|
16049
16103
|
const http = new Http({
|
|
16050
16104
|
headers: {
|
|
16051
16105
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
16052
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
16106
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish",
|
|
16107
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
|
|
16108
|
+
}
|
|
16109
|
+
});
|
|
16110
|
+
const totalData = await http.api({
|
|
16111
|
+
method: "get",
|
|
16112
|
+
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
16113
|
+
params: {
|
|
16114
|
+
app_id: 1231
|
|
16115
|
+
}
|
|
16116
|
+
});
|
|
16117
|
+
await new Promise((r)=>setTimeout(r, 1000));
|
|
16118
|
+
const contentDataYesterday = await http.api({
|
|
16119
|
+
method: "get",
|
|
16120
|
+
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
16121
|
+
params: {
|
|
16122
|
+
type: 0,
|
|
16123
|
+
app_id: 1231
|
|
16053
16124
|
}
|
|
16054
16125
|
});
|
|
16055
|
-
const [totalData, contentDataYesterday] = await Promise.all([
|
|
16056
|
-
http.api({
|
|
16057
|
-
method: "get",
|
|
16058
|
-
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
16059
|
-
params: {
|
|
16060
|
-
app_id: 1231
|
|
16061
|
-
}
|
|
16062
|
-
}),
|
|
16063
|
-
http.api({
|
|
16064
|
-
method: "get",
|
|
16065
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
16066
|
-
params: {
|
|
16067
|
-
type: 0,
|
|
16068
|
-
app_id: 1231
|
|
16069
|
-
}
|
|
16070
|
-
})
|
|
16071
|
-
]);
|
|
16072
16126
|
const isSuccess = !!(totalData?.data?.statistic && contentDataYesterday?.author_stat);
|
|
16073
16127
|
if (!isSuccess || !totalData?.data || !contentDataYesterday?.author_stat) return types_errorResponse(totalData?.message || contentDataYesterday?.message || "头条号数据获取失败,请检查Cookie是否有效", 414);
|
|
16074
16128
|
const ttData = {
|
|
@@ -20241,8 +20295,10 @@ const toutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
20241
20295
|
tuwen_wtt_trans_flag: params.settingInfo?.toutiaoTransWtt ? "2" : "0",
|
|
20242
20296
|
info_source: sourceData,
|
|
20243
20297
|
...location ? {
|
|
20244
|
-
|
|
20245
|
-
|
|
20298
|
+
manual_selected_city: JSON.stringify({
|
|
20299
|
+
city: location.label,
|
|
20300
|
+
city_code: location.value
|
|
20301
|
+
})
|
|
20246
20302
|
} : null,
|
|
20247
20303
|
...params.settingInfo?.toutiaoCollectionId ? {
|
|
20248
20304
|
want_join_collection_id: params.settingInfo.toutiaoCollectionId
|
|
@@ -20292,6 +20348,12 @@ const toutiaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
20292
20348
|
claim_exclusive: toutiaoExclusive ? toutiaoExclusive : toutiaoOriginal?.includes("exclusive") ? 1 : 0
|
|
20293
20349
|
};
|
|
20294
20350
|
task._timerRecord.PrePublish = Date.now();
|
|
20351
|
+
task.logger.info(`[toutiaoPublish] ${"draft" === params.saveType ? "同步草稿" : "发布文章"}参数`, {
|
|
20352
|
+
saveType: params.saveType,
|
|
20353
|
+
title: params.title,
|
|
20354
|
+
extra: extraData,
|
|
20355
|
+
publishData
|
|
20356
|
+
});
|
|
20295
20357
|
const msToken = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
20296
20358
|
let publishOption = {};
|
|
20297
20359
|
if (msToken) {
|
|
@@ -21487,8 +21549,8 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
21487
21549
|
headers
|
|
21488
21550
|
});
|
|
21489
21551
|
const proxyHttp = new Http(...args);
|
|
21490
|
-
|
|
21491
|
-
const responseData = response
|
|
21552
|
+
const baseRespFinder = (response)=>{
|
|
21553
|
+
const responseData = response?.data;
|
|
21492
21554
|
const msgType = "draft" === params.saveType ? "同步" : "发布";
|
|
21493
21555
|
if (response && responseData?.base_resp && 0 !== responseData.base_resp.ret && !ignoreErrno.includes(responseData.base_resp.ret)) {
|
|
21494
21556
|
const errmsg = weixinPublish_mock_errnoMap[responseData.base_resp.ret] || response.config.defaultErrorMsg || responseData.base_resp.err_msg || `文章${msgType}异常,请稍后重试。`;
|
|
@@ -21498,7 +21560,9 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
|
|
|
21498
21560
|
data: responseData
|
|
21499
21561
|
};
|
|
21500
21562
|
}
|
|
21501
|
-
}
|
|
21563
|
+
};
|
|
21564
|
+
http.addResponseInterceptor(baseRespFinder);
|
|
21565
|
+
proxyHttp.addResponseInterceptor(baseRespFinder);
|
|
21502
21566
|
await http.api({
|
|
21503
21567
|
method: "get",
|
|
21504
21568
|
url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",
|