@iflyrpa/actions 1.2.31 → 1.2.32-beta.0
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/actions/douyinLogin/index.d.ts +5 -0
- package/dist/actions/douyinLogin/rpa-server.d.ts +2 -0
- package/dist/bundle.js +357 -19
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +352 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -13
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +27 -3
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -7637,8 +7637,8 @@ var __webpack_exports__ = {};
|
|
|
7637
7637
|
const redirectUrl = response.headers.location;
|
|
7638
7638
|
if (redirectUrl) external_node_https_namespaceObject.get(redirectUrl, handleResponse).on("error", handleError);
|
|
7639
7639
|
else reject({
|
|
7640
|
-
code:
|
|
7641
|
-
message:
|
|
7640
|
+
code: 414,
|
|
7641
|
+
message: `图片下载失败: 跳转地址 Url:${url} 无效`
|
|
7642
7642
|
});
|
|
7643
7643
|
} else if (200 === response.statusCode) {
|
|
7644
7644
|
const fileStream = external_node_fs_namespaceObject.createWriteStream(savePath);
|
|
@@ -7655,18 +7655,17 @@ var __webpack_exports__ = {};
|
|
|
7655
7655
|
});
|
|
7656
7656
|
});
|
|
7657
7657
|
} else {
|
|
7658
|
-
console.log("图片下载失败:", response.statusCode);
|
|
7659
7658
|
response.resume();
|
|
7660
7659
|
reject({
|
|
7661
7660
|
code: 500,
|
|
7662
|
-
message:
|
|
7661
|
+
message: `图片下载失败 Url:${url},状态码: ${response.statusCode}`
|
|
7663
7662
|
});
|
|
7664
7663
|
}
|
|
7665
7664
|
};
|
|
7666
7665
|
const handleError = (error)=>{
|
|
7667
7666
|
let customMessage = {
|
|
7668
7667
|
code: 500,
|
|
7669
|
-
message: "
|
|
7668
|
+
message: "发生未知错误,请检查网络连接或稍后重试!"
|
|
7670
7669
|
};
|
|
7671
7670
|
switch(error.code){
|
|
7672
7671
|
case "ECONNRESET":
|
|
@@ -7702,7 +7701,7 @@ var __webpack_exports__ = {};
|
|
|
7702
7701
|
default:
|
|
7703
7702
|
break;
|
|
7704
7703
|
}
|
|
7705
|
-
customMessage.message =
|
|
7704
|
+
customMessage.message = `请求图片 Url:${url} 时 ${customMessage.message}`;
|
|
7706
7705
|
customMessage.extra = {
|
|
7707
7706
|
url
|
|
7708
7707
|
};
|
|
@@ -27147,6 +27146,10 @@ var __webpack_exports__ = {};
|
|
|
27147
27146
|
articleId: classic_schemas_string().optional(),
|
|
27148
27147
|
saveType: classic_schemas_string().optional()
|
|
27149
27148
|
});
|
|
27149
|
+
ActionCommonParamsSchema.extend({
|
|
27150
|
+
id: classic_schemas_string().optional(),
|
|
27151
|
+
userAgent: classic_schemas_string().optional()
|
|
27152
|
+
});
|
|
27150
27153
|
var types_ExecutionState = /*#__PURE__*/ function(ExecutionState) {
|
|
27151
27154
|
ExecutionState["RUNNING"] = "RUNNING";
|
|
27152
27155
|
ExecutionState["SCAN_WAITING"] = "SCAN_WAITING";
|
|
@@ -27163,13 +27166,31 @@ var __webpack_exports__ = {};
|
|
|
27163
27166
|
message,
|
|
27164
27167
|
data: null
|
|
27165
27168
|
});
|
|
27169
|
+
const MockPublish = false;
|
|
27166
27170
|
const rpa_server_scanRetryMaxCount = 60;
|
|
27167
27171
|
const rpa_server_waitQrcodeResultMaxTime = 2000 * rpa_server_scanRetryMaxCount;
|
|
27168
|
-
const rpaServer = async (task,
|
|
27172
|
+
const rpaServer = async (task, params)=>{
|
|
27169
27173
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
27170
27174
|
let executionState;
|
|
27175
|
+
let proxyUrl;
|
|
27176
|
+
if (params.localIP) {
|
|
27177
|
+
const args = [
|
|
27178
|
+
params.localIP,
|
|
27179
|
+
params.proxyLoc,
|
|
27180
|
+
params.accountId
|
|
27181
|
+
];
|
|
27182
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
27183
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
27184
|
+
logger: task.logger
|
|
27185
|
+
});
|
|
27186
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
27187
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
27188
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
27189
|
+
}
|
|
27171
27190
|
const page = await task.createPage({
|
|
27172
|
-
url: "https://passport.baidu.com/v2/?login"
|
|
27191
|
+
url: "https://passport.baidu.com/v2/?login",
|
|
27192
|
+
proxyUrl,
|
|
27193
|
+
userAgent: params.userAgent
|
|
27173
27194
|
});
|
|
27174
27195
|
task.steelBrowser?.on("disconnected", ()=>{
|
|
27175
27196
|
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
@@ -27622,6 +27643,18 @@ var __webpack_exports__ = {};
|
|
|
27622
27643
|
const isDraft = "draft" === params.saveType;
|
|
27623
27644
|
const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
|
|
27624
27645
|
task._timerRecord.PrePublish = Date.now();
|
|
27646
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
27647
|
+
if (MockPublish) {
|
|
27648
|
+
const message = `文章模拟发布成功 ${http.proxyInfo}`;
|
|
27649
|
+
const data = "123456789";
|
|
27650
|
+
await updateTaskState?.({
|
|
27651
|
+
state: types_TaskState.SUCCESS,
|
|
27652
|
+
result: {
|
|
27653
|
+
response: data
|
|
27654
|
+
}
|
|
27655
|
+
});
|
|
27656
|
+
return success(data, message);
|
|
27657
|
+
}
|
|
27625
27658
|
const res = await proxyHttp.api({
|
|
27626
27659
|
method: "post",
|
|
27627
27660
|
url: saveUrl,
|
|
@@ -27640,7 +27673,6 @@ var __webpack_exports__ = {};
|
|
|
27640
27673
|
const isSuccess = 0 === res.errno;
|
|
27641
27674
|
const data = res?.ret?.article_id;
|
|
27642
27675
|
const message = isSuccess ? isDraft ? "文章同步成功!" : `文章发布成功!${res.proxyInfo || ""}` : res.errmsg || (isDraft ? "文章同步失败,请稍后重试。" : "文章发布失败,请稍后重试。");
|
|
27643
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
27644
27676
|
if (!isSuccess) {
|
|
27645
27677
|
await updateTaskState?.({
|
|
27646
27678
|
state: types_TaskState.FAILED,
|
|
@@ -29179,6 +29211,214 @@ var __webpack_exports__ = {};
|
|
|
29179
29211
|
};
|
|
29180
29212
|
return success(data, message);
|
|
29181
29213
|
};
|
|
29214
|
+
const douyinLogin_rpa_server_scanRetryMaxCount = 60;
|
|
29215
|
+
const douyinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * douyinLogin_rpa_server_scanRetryMaxCount;
|
|
29216
|
+
const rpa_server_rpaServer = async (task, params)=>{
|
|
29217
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
29218
|
+
let executionState;
|
|
29219
|
+
let proxyUrl;
|
|
29220
|
+
if (params.localIP) {
|
|
29221
|
+
const args = [
|
|
29222
|
+
params.localIP,
|
|
29223
|
+
params.proxyLoc,
|
|
29224
|
+
params.accountId
|
|
29225
|
+
];
|
|
29226
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
29227
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
29228
|
+
logger: task.logger
|
|
29229
|
+
});
|
|
29230
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
29231
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
29232
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
29233
|
+
}
|
|
29234
|
+
const page = await task.createPage({
|
|
29235
|
+
url: "https://www.douyin.com/aisearch",
|
|
29236
|
+
proxyUrl,
|
|
29237
|
+
userAgent: params.userAgent
|
|
29238
|
+
});
|
|
29239
|
+
await page.waitForLoadState("domcontentloaded");
|
|
29240
|
+
await page.goto("about:blank");
|
|
29241
|
+
await page.goBack();
|
|
29242
|
+
task.steelBrowser?.on("disconnected", ()=>{
|
|
29243
|
+
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
29244
|
+
});
|
|
29245
|
+
await updateTaskState?.({
|
|
29246
|
+
state: types_TaskState.WAIT_SCAN,
|
|
29247
|
+
connectAddress: task.steelConnector?.getProxyUrl(task.sessionId || "", "v1/sessions/debug"),
|
|
29248
|
+
sessionId: task.sessionId
|
|
29249
|
+
});
|
|
29250
|
+
const userInfo = {
|
|
29251
|
+
uniqueId: "",
|
|
29252
|
+
avatar: "",
|
|
29253
|
+
name: ""
|
|
29254
|
+
};
|
|
29255
|
+
await new Promise((resolve, reject)=>{
|
|
29256
|
+
let finished = false;
|
|
29257
|
+
const timer = setTimeout(async ()=>{
|
|
29258
|
+
cleanup();
|
|
29259
|
+
executionState = types_ExecutionState.TIMEOUT;
|
|
29260
|
+
await updateTaskState?.({
|
|
29261
|
+
state: types_TaskState.TIMEOUT,
|
|
29262
|
+
error: "等待扫码登录超时"
|
|
29263
|
+
});
|
|
29264
|
+
resolve();
|
|
29265
|
+
}, douyinLogin_rpa_server_waitQrcodeResultMaxTime);
|
|
29266
|
+
const cleanup = ()=>{
|
|
29267
|
+
if (finished) return;
|
|
29268
|
+
finished = true;
|
|
29269
|
+
clearTimeout(timer);
|
|
29270
|
+
page.off("response", handleWebCommon);
|
|
29271
|
+
page.off("response", handleCheckQR);
|
|
29272
|
+
task.steelBrowser?.off("disconnected", handleBrowserClosed);
|
|
29273
|
+
};
|
|
29274
|
+
const handleBrowserClosed = ()=>{
|
|
29275
|
+
cleanup();
|
|
29276
|
+
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
29277
|
+
resolve();
|
|
29278
|
+
};
|
|
29279
|
+
const handleWebCommon = async (resp)=>{
|
|
29280
|
+
try {
|
|
29281
|
+
const url = resp.url();
|
|
29282
|
+
if (url.includes("/web/common")) {
|
|
29283
|
+
cleanup();
|
|
29284
|
+
const headers = resp.headers();
|
|
29285
|
+
const xmst = headers["x-ms-token"];
|
|
29286
|
+
const date = headers["x-tt-timestamp"];
|
|
29287
|
+
if (xmst && date) {
|
|
29288
|
+
const mstExpirDate = new Date(1000 * Number(date) + 604800000);
|
|
29289
|
+
const msToken = {
|
|
29290
|
+
name: "msToken",
|
|
29291
|
+
value: xmst,
|
|
29292
|
+
domain: ".bytedance.com",
|
|
29293
|
+
expires: mstExpirDate.getTime() / 1000,
|
|
29294
|
+
httpOnly: true,
|
|
29295
|
+
path: "/",
|
|
29296
|
+
sameSite: "None",
|
|
29297
|
+
secure: true
|
|
29298
|
+
};
|
|
29299
|
+
await page.context().addCookies([
|
|
29300
|
+
msToken
|
|
29301
|
+
]);
|
|
29302
|
+
await updateTaskState?.({
|
|
29303
|
+
state: types_TaskState.CONFIRMED
|
|
29304
|
+
});
|
|
29305
|
+
}
|
|
29306
|
+
executionState = types_ExecutionState.SUCCESS;
|
|
29307
|
+
resolve();
|
|
29308
|
+
} else if (url.includes("aweme/v1/creator/user/info")) try {
|
|
29309
|
+
const jsonUserInfo = await resp.json();
|
|
29310
|
+
userInfo.name = jsonUserInfo.user_profile.nick_name ?? "";
|
|
29311
|
+
userInfo.avatar = jsonUserInfo.user_profile.avatar_url ?? "";
|
|
29312
|
+
} catch (e) {
|
|
29313
|
+
task.logger.warn("无法解析用户信息:", {
|
|
29314
|
+
url,
|
|
29315
|
+
error: e
|
|
29316
|
+
});
|
|
29317
|
+
}
|
|
29318
|
+
} catch (err) {
|
|
29319
|
+
cleanup();
|
|
29320
|
+
reject(err);
|
|
29321
|
+
}
|
|
29322
|
+
};
|
|
29323
|
+
const handleCheckQR = async (response)=>{
|
|
29324
|
+
try {
|
|
29325
|
+
const url = response.url();
|
|
29326
|
+
if (!url.includes("/check_qrconnect/")) return;
|
|
29327
|
+
let jsonResponse;
|
|
29328
|
+
try {
|
|
29329
|
+
const text = await response.text();
|
|
29330
|
+
if (!text) {
|
|
29331
|
+
task.logger.warn("Empty response body:", {
|
|
29332
|
+
url
|
|
29333
|
+
});
|
|
29334
|
+
return;
|
|
29335
|
+
}
|
|
29336
|
+
jsonResponse = JSON.parse(text);
|
|
29337
|
+
} catch (e) {
|
|
29338
|
+
task.logger.warn("Failed to parse json:", {
|
|
29339
|
+
url,
|
|
29340
|
+
error: e
|
|
29341
|
+
});
|
|
29342
|
+
return;
|
|
29343
|
+
}
|
|
29344
|
+
if ("scanned" === jsonResponse.data.status) await updateTaskState?.({
|
|
29345
|
+
state: types_TaskState.SCANNED
|
|
29346
|
+
});
|
|
29347
|
+
if (jsonResponse.data?.status === "confirmed") {
|
|
29348
|
+
userInfo.uniqueId = jsonResponse.data.user_data?.user_id_str || "";
|
|
29349
|
+
page.off("response", handleCheckQR);
|
|
29350
|
+
page.on("response", handleWebCommon);
|
|
29351
|
+
}
|
|
29352
|
+
} catch (err) {
|
|
29353
|
+
cleanup();
|
|
29354
|
+
reject(err);
|
|
29355
|
+
}
|
|
29356
|
+
};
|
|
29357
|
+
task.steelBrowser?.on("disconnected", handleBrowserClosed);
|
|
29358
|
+
page.on("response", handleCheckQR);
|
|
29359
|
+
});
|
|
29360
|
+
if (void 0 === executionState) return {
|
|
29361
|
+
code: 500,
|
|
29362
|
+
message: "未知错误",
|
|
29363
|
+
data: {}
|
|
29364
|
+
};
|
|
29365
|
+
switch(executionState){
|
|
29366
|
+
case types_ExecutionState.BROWSER_CLOSED:
|
|
29367
|
+
{
|
|
29368
|
+
const msg = "浏览器已关闭,任务中断!";
|
|
29369
|
+
await updateTaskState?.({
|
|
29370
|
+
state: types_TaskState.FAILED,
|
|
29371
|
+
error: "浏览器已关闭"
|
|
29372
|
+
});
|
|
29373
|
+
return {
|
|
29374
|
+
code: 414,
|
|
29375
|
+
message: msg,
|
|
29376
|
+
data: {}
|
|
29377
|
+
};
|
|
29378
|
+
}
|
|
29379
|
+
case types_ExecutionState.TIMEOUT:
|
|
29380
|
+
{
|
|
29381
|
+
const msg = "等待用户扫码登录超时!";
|
|
29382
|
+
await updateTaskState?.({
|
|
29383
|
+
state: types_TaskState.TIMEOUT,
|
|
29384
|
+
error: msg
|
|
29385
|
+
});
|
|
29386
|
+
task.logger.info(msg);
|
|
29387
|
+
return {
|
|
29388
|
+
code: 414,
|
|
29389
|
+
message: msg,
|
|
29390
|
+
data: {}
|
|
29391
|
+
};
|
|
29392
|
+
}
|
|
29393
|
+
case types_ExecutionState.SUCCESS:
|
|
29394
|
+
await updateTaskState?.({
|
|
29395
|
+
state: types_TaskState.SUCCESS,
|
|
29396
|
+
result: {
|
|
29397
|
+
cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
|
|
29398
|
+
userInfo: userInfo
|
|
29399
|
+
}
|
|
29400
|
+
});
|
|
29401
|
+
return {
|
|
29402
|
+
code: 0,
|
|
29403
|
+
message: "成功",
|
|
29404
|
+
data: {
|
|
29405
|
+
cookie: JSON.stringify(await task.steelBrowserContext?.cookies()),
|
|
29406
|
+
userInfo
|
|
29407
|
+
}
|
|
29408
|
+
};
|
|
29409
|
+
default:
|
|
29410
|
+
return {
|
|
29411
|
+
code: 500,
|
|
29412
|
+
message: "任务执行中断",
|
|
29413
|
+
data: {}
|
|
29414
|
+
};
|
|
29415
|
+
}
|
|
29416
|
+
};
|
|
29417
|
+
const douyinLogin = async (task, params)=>{
|
|
29418
|
+
if ("mockApi" === params.actionType) return success({}, "暂不支持mockApi");
|
|
29419
|
+
if ("server" === params.actionType) return rpa_server_rpaServer(task, params);
|
|
29420
|
+
return executeAction(rpa_server_rpaServer)(task, params);
|
|
29421
|
+
};
|
|
29182
29422
|
const getBaijiahaoActivity = async (_task, params)=>{
|
|
29183
29423
|
const cookies = params.cookies ?? [];
|
|
29184
29424
|
const http = new Http({
|
|
@@ -31081,11 +31321,28 @@ var __webpack_exports__ = {};
|
|
|
31081
31321
|
};
|
|
31082
31322
|
const toutiaoLogin_rpa_server_scanRetryMaxCount = 60;
|
|
31083
31323
|
const toutiaoLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * toutiaoLogin_rpa_server_scanRetryMaxCount;
|
|
31084
|
-
const
|
|
31324
|
+
const toutiaoLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
31085
31325
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
31086
31326
|
let executionState;
|
|
31327
|
+
let proxyUrl;
|
|
31328
|
+
if (params.localIP) {
|
|
31329
|
+
const args = [
|
|
31330
|
+
params.localIP,
|
|
31331
|
+
params.proxyLoc,
|
|
31332
|
+
params.accountId
|
|
31333
|
+
];
|
|
31334
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
31335
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
31336
|
+
logger: task.logger
|
|
31337
|
+
});
|
|
31338
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
31339
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
31340
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
31341
|
+
}
|
|
31087
31342
|
const page = await task.createPage({
|
|
31088
|
-
url: "https://mp.toutiao.com/auth/page/login"
|
|
31343
|
+
url: "https://mp.toutiao.com/auth/page/login",
|
|
31344
|
+
proxyUrl,
|
|
31345
|
+
userAgent: params.userAgent
|
|
31089
31346
|
});
|
|
31090
31347
|
task.steelBrowser?.on("disconnected", ()=>{
|
|
31091
31348
|
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
@@ -31267,7 +31524,7 @@ var __webpack_exports__ = {};
|
|
|
31267
31524
|
const toutiaoLogin = async (task, params)=>{
|
|
31268
31525
|
if ("rpa" === params.actionType) return toutiaoLogin_rpa_rpaAction(task, params);
|
|
31269
31526
|
if ("mockApi" === params.actionType) return success({}, "暂不支持mockApi");
|
|
31270
|
-
if ("server" === params.actionType) return
|
|
31527
|
+
if ("server" === params.actionType) return toutiaoLogin_rpa_server_rpaServer(task, params);
|
|
31271
31528
|
return executeAction(toutiaoLogin_rpa_rpaAction)(task, params);
|
|
31272
31529
|
};
|
|
31273
31530
|
const GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
|
|
@@ -31484,6 +31741,18 @@ var __webpack_exports__ = {};
|
|
|
31484
31741
|
},
|
|
31485
31742
|
defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
|
|
31486
31743
|
};
|
|
31744
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
31745
|
+
if (MockPublish) {
|
|
31746
|
+
const message = `文章模拟发布成功 ${http.proxyInfo}`;
|
|
31747
|
+
const data = "123456789";
|
|
31748
|
+
await updateTaskState?.({
|
|
31749
|
+
state: types_TaskState.SUCCESS,
|
|
31750
|
+
result: {
|
|
31751
|
+
response: data
|
|
31752
|
+
}
|
|
31753
|
+
});
|
|
31754
|
+
return success(data, message);
|
|
31755
|
+
}
|
|
31487
31756
|
const publishResult = await proxyHttp.api(publishOption, {
|
|
31488
31757
|
retries: 3,
|
|
31489
31758
|
retryDelay: 500,
|
|
@@ -31492,7 +31761,6 @@ var __webpack_exports__ = {};
|
|
|
31492
31761
|
const isSuccess = 0 === publishResult.code;
|
|
31493
31762
|
const data = publishResult.data?.pgc_id;
|
|
31494
31763
|
const message = publishResult.message || (isSuccess ? "文章发布成功!" : "文章发布失败,未知错误。");
|
|
31495
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
31496
31764
|
if (!isSuccess) {
|
|
31497
31765
|
await updateTaskState?.({
|
|
31498
31766
|
state: types_TaskState.FAILED,
|
|
@@ -31518,7 +31786,7 @@ var __webpack_exports__ = {};
|
|
|
31518
31786
|
const commonCookies = {
|
|
31519
31787
|
path: "/",
|
|
31520
31788
|
secure: true,
|
|
31521
|
-
domain: "
|
|
31789
|
+
domain: "toutiao.com",
|
|
31522
31790
|
url: "https://mp.toutiao.com",
|
|
31523
31791
|
httpOnly: true
|
|
31524
31792
|
};
|
|
@@ -32084,11 +32352,28 @@ var __webpack_exports__ = {};
|
|
|
32084
32352
|
};
|
|
32085
32353
|
const weixinLogin_rpa_server_scanRetryMaxCount = 60;
|
|
32086
32354
|
const weixinLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * weixinLogin_rpa_server_scanRetryMaxCount;
|
|
32087
|
-
const weixinLogin_rpa_server_rpaServer = async (task,
|
|
32355
|
+
const weixinLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
32088
32356
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
32089
32357
|
let executionState;
|
|
32358
|
+
let proxyUrl;
|
|
32359
|
+
if (params.localIP) {
|
|
32360
|
+
const args = [
|
|
32361
|
+
params.localIP,
|
|
32362
|
+
params.proxyLoc,
|
|
32363
|
+
params.accountId
|
|
32364
|
+
];
|
|
32365
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
32366
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
32367
|
+
logger: task.logger
|
|
32368
|
+
});
|
|
32369
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
32370
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
32371
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
32372
|
+
}
|
|
32090
32373
|
const page = await task.createPage({
|
|
32091
|
-
url: "https://mp.weixin.qq.com/cgi-bin/loginpage"
|
|
32374
|
+
url: "https://mp.weixin.qq.com/cgi-bin/loginpage",
|
|
32375
|
+
proxyUrl,
|
|
32376
|
+
userAgent: params.userAgent
|
|
32092
32377
|
});
|
|
32093
32378
|
task.steelBrowser?.on("disconnected", ()=>{
|
|
32094
32379
|
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
@@ -33974,8 +34259,25 @@ var __webpack_exports__ = {};
|
|
|
33974
34259
|
const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
33975
34260
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
33976
34261
|
let executionState;
|
|
34262
|
+
let proxyUrl;
|
|
34263
|
+
if (params.localIP) {
|
|
34264
|
+
const args = [
|
|
34265
|
+
params.localIP,
|
|
34266
|
+
params.proxyLoc,
|
|
34267
|
+
params.accountId
|
|
34268
|
+
];
|
|
34269
|
+
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
34270
|
+
const ProxyAgentWithLogger = ProxyAgent.bind({
|
|
34271
|
+
logger: task.logger
|
|
34272
|
+
});
|
|
34273
|
+
const ProxyAgentResult = await ProxyAgentWithLogger(...args);
|
|
34274
|
+
task.logger?.info("==> 代理信息获取成功!");
|
|
34275
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
34276
|
+
}
|
|
33977
34277
|
const page = await task.createPage({
|
|
33978
|
-
url: "https://www.xiaohongshu.com/login"
|
|
34278
|
+
url: "https://www.xiaohongshu.com/login",
|
|
34279
|
+
proxyUrl,
|
|
34280
|
+
userAgent: params.userAgent
|
|
33979
34281
|
});
|
|
33980
34282
|
task.steelBrowser?.on("disconnected", ()=>{
|
|
33981
34283
|
executionState = types_ExecutionState.BROWSER_CLOSED;
|
|
@@ -34507,6 +34809,18 @@ var __webpack_exports__ = {};
|
|
|
34507
34809
|
publishData.common.business_binds = JSON.stringify(business_binds);
|
|
34508
34810
|
const publishXsHeader = mock_xsEncrypt.signHeadersPost("/web_api/sns/v2/note", recordCookie, "ugc", publishData);
|
|
34509
34811
|
task._timerRecord.PrePublish = Date.now();
|
|
34812
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
34813
|
+
if (MockPublish) {
|
|
34814
|
+
const message = `文章模拟发布成功 ${http.proxyInfo}`;
|
|
34815
|
+
const data = "123456789";
|
|
34816
|
+
await updateTaskState?.({
|
|
34817
|
+
state: types_TaskState.SUCCESS,
|
|
34818
|
+
result: {
|
|
34819
|
+
response: data
|
|
34820
|
+
}
|
|
34821
|
+
});
|
|
34822
|
+
return success(data, message);
|
|
34823
|
+
}
|
|
34510
34824
|
const publishResult = await proxyHttp.api({
|
|
34511
34825
|
method: "post",
|
|
34512
34826
|
url: "https://edith.xiaohongshu.com/web_api/sns/v2/note",
|
|
@@ -34521,7 +34835,6 @@ var __webpack_exports__ = {};
|
|
|
34521
34835
|
const isSuccess = publishResult.success;
|
|
34522
34836
|
const message = `文章发布${isSuccess ? "成功" : `失败,原因:${publishResult.msg}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
34523
34837
|
const data = isSuccess ? publishResult.data?.id || "" : "";
|
|
34524
|
-
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
34525
34838
|
if (!isSuccess) {
|
|
34526
34839
|
await updateTaskState?.({
|
|
34527
34840
|
state: types_TaskState.FAILED,
|
|
@@ -35054,6 +35367,17 @@ var __webpack_exports__ = {};
|
|
|
35054
35367
|
} catch (error) {
|
|
35055
35368
|
throw new Error("上传图片超时,请重试!");
|
|
35056
35369
|
}
|
|
35370
|
+
if (MockPublish) {
|
|
35371
|
+
const message = "文章模拟发布成功";
|
|
35372
|
+
const data = "123456789";
|
|
35373
|
+
await updateTaskState?.({
|
|
35374
|
+
state: types_TaskState.SUCCESS,
|
|
35375
|
+
result: {
|
|
35376
|
+
response: data
|
|
35377
|
+
}
|
|
35378
|
+
});
|
|
35379
|
+
return success(data, message);
|
|
35380
|
+
}
|
|
35057
35381
|
const response = await new Promise((resolve)=>{
|
|
35058
35382
|
const handleResponse = async (response)=>{
|
|
35059
35383
|
if (response.url().includes("/web_api/sns/v2/note")) {
|
|
@@ -35470,6 +35794,17 @@ var __webpack_exports__ = {};
|
|
|
35470
35794
|
});
|
|
35471
35795
|
publishXsHeader["x-s"] = rpa_server_mock_encode_mnsv2(ticket_mnsv2, "Windows", "object");
|
|
35472
35796
|
publishXsHeader["x-t"] = Date.now().toString();
|
|
35797
|
+
if (MockPublish) {
|
|
35798
|
+
const message = `文章模拟发布成功 ${http.proxyInfo}`;
|
|
35799
|
+
const data = "123456789";
|
|
35800
|
+
await updateTaskState?.({
|
|
35801
|
+
state: types_TaskState.SUCCESS,
|
|
35802
|
+
result: {
|
|
35803
|
+
response: data
|
|
35804
|
+
}
|
|
35805
|
+
});
|
|
35806
|
+
return success(data, message);
|
|
35807
|
+
}
|
|
35473
35808
|
const publishResult = await proxyHttp.api({
|
|
35474
35809
|
method: "post",
|
|
35475
35810
|
url: "https://edith.xiaohongshu.com/web_api/sns/v2/note",
|
|
@@ -36061,7 +36396,7 @@ var __webpack_exports__ = {};
|
|
|
36061
36396
|
return utils_response(isSuccess ? 0 : 414, message, data);
|
|
36062
36397
|
};
|
|
36063
36398
|
var package_namespaceObject = {
|
|
36064
|
-
i8: "1.2.
|
|
36399
|
+
i8: "1.2.31"
|
|
36065
36400
|
};
|
|
36066
36401
|
const ttConfigDataSchema = classic_schemas_object({
|
|
36067
36402
|
fansNum: classic_schemas_number(),
|
|
@@ -36188,6 +36523,9 @@ var __webpack_exports__ = {};
|
|
|
36188
36523
|
ToutiaoLogin(params) {
|
|
36189
36524
|
return this.bindTask(toutiaoLogin, params);
|
|
36190
36525
|
}
|
|
36526
|
+
DouyinLogin(params) {
|
|
36527
|
+
return this.bindTask(douyinLogin, params);
|
|
36528
|
+
}
|
|
36191
36529
|
XhsLogin(params) {
|
|
36192
36530
|
return this.bindTask(xiaohongshuLogin, params);
|
|
36193
36531
|
}
|