@iflyrpa/actions 4.0.5 → 4.0.6-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/actions/searchAccountInfo/getDouyinInfo.d.ts +16 -0
- package/dist/actions/searchAccountInfo/getShipinhaoInfo.d.ts +14 -0
- package/dist/actions/searchAccountInfo/index.d.ts +4 -2
- package/dist/actions/searchAccountInfo/types.d.ts +21 -1
- package/dist/actions/searchPublishInfo/handleDouyinData.d.ts +17 -0
- package/dist/actions/searchPublishInfo/handleShipinhaoData.d.ts +17 -0
- package/dist/actions/searchPublishInfo/index.d.ts +7 -0
- package/dist/actions/searchPublishInfo/types.d.ts +97 -0
- package/dist/actions/shipinhaoPublish/uploader.d.ts +4 -0
- package/dist/actions/weixinPublish/index.d.ts +2 -2
- package/dist/actions/xiaohongshuPublish/index.d.ts +1 -1
- package/dist/bundle.js +1037 -527
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +79 -1
- package/dist/index.js +1053 -543
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1052 -544
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/utils/http.d.ts +1 -1
- package/dist/utils/proxy.d.ts +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
|
+
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ef37432b-1de8-5030-834a-59ecb3853f3c")}catch(e){}}();
|
|
2
4
|
var __webpack_modules__ = {
|
|
3
5
|
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
4
6
|
"use strict";
|
|
@@ -12474,6 +12476,8 @@ var __webpack_exports__ = {};
|
|
|
12474
12476
|
bjhConfigDataSchema: ()=>bjhConfigDataSchema,
|
|
12475
12477
|
Action: ()=>Action,
|
|
12476
12478
|
ProxyAgent: ()=>ProxyAgent,
|
|
12479
|
+
douyinConfigDataSchema: ()=>douyinConfigDataSchema,
|
|
12480
|
+
shipinhaoConfigDataSchema: ()=>shipinhaoConfigDataSchema,
|
|
12477
12481
|
version: ()=>package_namespaceObject_0.i8
|
|
12478
12482
|
});
|
|
12479
12483
|
var common_utils_namespaceObject = {};
|
|
@@ -12488,9 +12492,7 @@ var __webpack_exports__ = {};
|
|
|
12488
12492
|
var package_namespaceObject = {
|
|
12489
12493
|
i8: "0.1.2"
|
|
12490
12494
|
};
|
|
12491
|
-
var package_namespaceObject_0 = {
|
|
12492
|
-
i8: "4.0.5"
|
|
12493
|
-
};
|
|
12495
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.6-beta.1"}');
|
|
12494
12496
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
12495
12497
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
12496
12498
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -27124,15 +27126,14 @@ var __webpack_exports__ = {};
|
|
|
27124
27126
|
}
|
|
27125
27127
|
return `socks5h://${ip}:${port}`;
|
|
27126
27128
|
}
|
|
27127
|
-
async function ProxyAgent(task,
|
|
27129
|
+
async function ProxyAgent(task, addr, accountId, refresh) {
|
|
27128
27130
|
const http = new Http({
|
|
27129
27131
|
headers: {
|
|
27130
27132
|
"content-type": "application/json"
|
|
27131
27133
|
}
|
|
27132
27134
|
});
|
|
27133
27135
|
const params = {
|
|
27134
|
-
|
|
27135
|
-
addr: adr || null,
|
|
27136
|
+
addr: addr || null,
|
|
27136
27137
|
accountId: accountId
|
|
27137
27138
|
};
|
|
27138
27139
|
const ProxyInfo = await http.api({
|
|
@@ -27154,7 +27155,7 @@ var __webpack_exports__ = {};
|
|
|
27154
27155
|
data: ProxyInfo.data
|
|
27155
27156
|
}
|
|
27156
27157
|
};
|
|
27157
|
-
task.logger?.info(`请求代理:区域:${params.addr},
|
|
27158
|
+
task.logger?.info(`请求代理:区域:${params.addr}, AccountId:${params.accountId}, 返回代理信息: ${ProxyInfo.data ? `${ProxyInfo.data.proxyIp}:${ProxyInfo.data.proxyPort}` : "无可用代理"}`, loggerInfo);
|
|
27158
27159
|
const proxyAgent = "000000" === ProxyInfo.code && ProxyInfo.data ? {
|
|
27159
27160
|
ip: ProxyInfo.data.proxyIp,
|
|
27160
27161
|
port: ProxyInfo.data.proxyPort,
|
|
@@ -27171,16 +27172,16 @@ var __webpack_exports__ = {};
|
|
|
27171
27172
|
data: error
|
|
27172
27173
|
};
|
|
27173
27174
|
}
|
|
27174
|
-
constructor(config, logger,
|
|
27175
|
+
constructor(config, logger, addr, accountId, platform){
|
|
27175
27176
|
this.agentPromise = void 0;
|
|
27176
27177
|
this.apiClient = lib_axios.create({
|
|
27177
27178
|
...config
|
|
27178
27179
|
});
|
|
27179
27180
|
this.logger = logger;
|
|
27180
27181
|
this.platform = platform;
|
|
27181
|
-
if (
|
|
27182
|
+
if (addr) this.agentPromise = ProxyAgent({
|
|
27182
27183
|
logger
|
|
27183
|
-
},
|
|
27184
|
+
}, addr, accountId);
|
|
27184
27185
|
this.addResponseInterceptor(()=>void 0);
|
|
27185
27186
|
}
|
|
27186
27187
|
clearResponseInterceptors() {
|
|
@@ -27270,11 +27271,12 @@ var __webpack_exports__ = {};
|
|
|
27270
27271
|
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
27271
27272
|
errorString: stringifyError(error)
|
|
27272
27273
|
});
|
|
27273
|
-
_message =
|
|
27274
|
+
_message = `网络错误: ${error.message}`;
|
|
27274
27275
|
break;
|
|
27275
27276
|
}
|
|
27276
27277
|
}
|
|
27277
|
-
|
|
27278
|
+
if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
|
|
27279
|
+
else errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
27278
27280
|
if ("canceled" === errorResponse.message) {
|
|
27279
27281
|
const message = errorResponse.extra?.isProxyRequest ? "代理连接建立超时,请更换区域或稍后重试!" : "网络请求超时,请稍后重试!";
|
|
27280
27282
|
errorResponse.message = message;
|
|
@@ -32307,16 +32309,11 @@ var __webpack_exports__ = {};
|
|
|
32307
32309
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
32308
32310
|
let executionState;
|
|
32309
32311
|
let proxyUrl;
|
|
32310
|
-
if (params.
|
|
32311
|
-
|
|
32312
|
-
params.localIP,
|
|
32313
|
-
params.proxyLoc,
|
|
32314
|
-
params.accountId
|
|
32315
|
-
];
|
|
32316
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
32312
|
+
if (params.proxyLoc) {
|
|
32313
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
32317
32314
|
const ProxyAgentResult = await ProxyAgent({
|
|
32318
32315
|
logger: task.logger
|
|
32319
|
-
},
|
|
32316
|
+
}, params.proxyLoc, params.accountId);
|
|
32320
32317
|
task.logger?.info("==> 代理信息获取成功!");
|
|
32321
32318
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
32322
32319
|
}
|
|
@@ -32659,7 +32656,6 @@ var __webpack_exports__ = {};
|
|
|
32659
32656
|
},
|
|
32660
32657
|
task.logger,
|
|
32661
32658
|
params.proxyLoc,
|
|
32662
|
-
params.localIP,
|
|
32663
32659
|
params.accountId,
|
|
32664
32660
|
"baijiahao"
|
|
32665
32661
|
];
|
|
@@ -32865,7 +32861,6 @@ var __webpack_exports__ = {};
|
|
|
32865
32861
|
enverionment: task.enverionment || "development",
|
|
32866
32862
|
postId: params.articleId,
|
|
32867
32863
|
eip: proxyHttp.proxyInfo,
|
|
32868
|
-
proxyIp: params.localIP,
|
|
32869
32864
|
accountId: params.accountId,
|
|
32870
32865
|
uid: params.uid,
|
|
32871
32866
|
platform: "baijiahao",
|
|
@@ -33384,7 +33379,6 @@ var __webpack_exports__ = {};
|
|
|
33384
33379
|
},
|
|
33385
33380
|
_task.logger,
|
|
33386
33381
|
params.proxyLoc,
|
|
33387
|
-
params.localIP,
|
|
33388
33382
|
params.accountId
|
|
33389
33383
|
];
|
|
33390
33384
|
const http = new Http(...args);
|
|
@@ -34514,7 +34508,7 @@ var __webpack_exports__ = {};
|
|
|
34514
34508
|
heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
|
|
34515
34509
|
},
|
|
34516
34510
|
accountId: params.accountId,
|
|
34517
|
-
hasProxy: !!
|
|
34511
|
+
hasProxy: !!params.proxyLoc
|
|
34518
34512
|
});
|
|
34519
34513
|
}
|
|
34520
34514
|
const check = {
|
|
@@ -34537,7 +34531,6 @@ var __webpack_exports__ = {};
|
|
|
34537
34531
|
},
|
|
34538
34532
|
_task.logger,
|
|
34539
34533
|
params.proxyLoc,
|
|
34540
|
-
params.localIP,
|
|
34541
34534
|
params.accountId
|
|
34542
34535
|
];
|
|
34543
34536
|
const http = new Http(...args);
|
|
@@ -34568,7 +34561,7 @@ var __webpack_exports__ = {};
|
|
|
34568
34561
|
heapUsed: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB`,
|
|
34569
34562
|
heapTotal: `${Math.round(process.memoryUsage().heapTotal / 1024 / 1024)} MB`
|
|
34570
34563
|
},
|
|
34571
|
-
hasProxy: !!
|
|
34564
|
+
hasProxy: !!params.proxyLoc,
|
|
34572
34565
|
timeSinceLastLog: Date.now() - lastEnvLogTime
|
|
34573
34566
|
}
|
|
34574
34567
|
});
|
|
@@ -34966,7 +34959,6 @@ var __webpack_exports__ = {};
|
|
|
34966
34959
|
},
|
|
34967
34960
|
_task.logger,
|
|
34968
34961
|
params.proxyLoc,
|
|
34969
|
-
params.localIP,
|
|
34970
34962
|
params.accountId
|
|
34971
34963
|
];
|
|
34972
34964
|
const http = new Http(...args);
|
|
@@ -35053,7 +35045,6 @@ var __webpack_exports__ = {};
|
|
|
35053
35045
|
},
|
|
35054
35046
|
_task.logger,
|
|
35055
35047
|
params.proxyLoc,
|
|
35056
|
-
params.localIP,
|
|
35057
35048
|
params.accountId
|
|
35058
35049
|
];
|
|
35059
35050
|
const http = new Http(...args);
|
|
@@ -35144,7 +35135,6 @@ var __webpack_exports__ = {};
|
|
|
35144
35135
|
},
|
|
35145
35136
|
_task.logger,
|
|
35146
35137
|
params.proxyLoc,
|
|
35147
|
-
params.localIP,
|
|
35148
35138
|
params.accountId
|
|
35149
35139
|
];
|
|
35150
35140
|
const http = new Http(...args);
|
|
@@ -35230,7 +35220,6 @@ var __webpack_exports__ = {};
|
|
|
35230
35220
|
},
|
|
35231
35221
|
_task.logger,
|
|
35232
35222
|
params.proxyLoc,
|
|
35233
|
-
params.localIP,
|
|
35234
35223
|
params.accountId
|
|
35235
35224
|
];
|
|
35236
35225
|
const http = new Http(...args);
|
|
@@ -35314,7 +35303,6 @@ var __webpack_exports__ = {};
|
|
|
35314
35303
|
},
|
|
35315
35304
|
_task.logger,
|
|
35316
35305
|
params.proxyLoc,
|
|
35317
|
-
params.localIP,
|
|
35318
35306
|
params.accountId
|
|
35319
35307
|
];
|
|
35320
35308
|
const http = new Http(...args);
|
|
@@ -35410,7 +35398,6 @@ var __webpack_exports__ = {};
|
|
|
35410
35398
|
},
|
|
35411
35399
|
_task.logger,
|
|
35412
35400
|
params.proxyLoc,
|
|
35413
|
-
params.localIP,
|
|
35414
35401
|
params.accountId
|
|
35415
35402
|
];
|
|
35416
35403
|
const http = new Http(...args);
|
|
@@ -36061,7 +36048,6 @@ var __webpack_exports__ = {};
|
|
|
36061
36048
|
},
|
|
36062
36049
|
_task.logger,
|
|
36063
36050
|
params.proxyLoc,
|
|
36064
|
-
params.localIP,
|
|
36065
36051
|
params.accountId
|
|
36066
36052
|
];
|
|
36067
36053
|
const http = new Http(...args);
|
|
@@ -36207,7 +36193,6 @@ var __webpack_exports__ = {};
|
|
|
36207
36193
|
},
|
|
36208
36194
|
_task.logger,
|
|
36209
36195
|
params.proxyLoc,
|
|
36210
|
-
params.localIP,
|
|
36211
36196
|
params.accountId
|
|
36212
36197
|
];
|
|
36213
36198
|
const http = new Http(...args);
|
|
@@ -36295,7 +36280,6 @@ var __webpack_exports__ = {};
|
|
|
36295
36280
|
},
|
|
36296
36281
|
_task.logger,
|
|
36297
36282
|
params.proxyLoc,
|
|
36298
|
-
params.localIP,
|
|
36299
36283
|
params.accountId
|
|
36300
36284
|
];
|
|
36301
36285
|
const http = new Http(...args);
|
|
@@ -36383,7 +36367,6 @@ var __webpack_exports__ = {};
|
|
|
36383
36367
|
},
|
|
36384
36368
|
_task.logger,
|
|
36385
36369
|
params.proxyLoc,
|
|
36386
|
-
params.localIP,
|
|
36387
36370
|
params.accountId
|
|
36388
36371
|
];
|
|
36389
36372
|
const http = new Http(...args);
|
|
@@ -36604,7 +36587,6 @@ var __webpack_exports__ = {};
|
|
|
36604
36587
|
},
|
|
36605
36588
|
_task.logger,
|
|
36606
36589
|
params.proxyLoc,
|
|
36607
|
-
params.localIP,
|
|
36608
36590
|
params.accountId
|
|
36609
36591
|
];
|
|
36610
36592
|
const http = new Http(...args);
|
|
@@ -36966,16 +36948,11 @@ var __webpack_exports__ = {};
|
|
|
36966
36948
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
36967
36949
|
let executionState;
|
|
36968
36950
|
let proxyUrl;
|
|
36969
|
-
if (params.
|
|
36970
|
-
|
|
36971
|
-
params.localIP,
|
|
36972
|
-
params.proxyLoc,
|
|
36973
|
-
params.accountId
|
|
36974
|
-
];
|
|
36975
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
36951
|
+
if (params.proxyLoc) {
|
|
36952
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
36976
36953
|
const ProxyAgentResult = await ProxyAgent({
|
|
36977
36954
|
logger: task.logger
|
|
36978
|
-
},
|
|
36955
|
+
}, params.proxyLoc, params.accountId);
|
|
36979
36956
|
task.logger?.info("==> 代理信息获取成功!");
|
|
36980
36957
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
36981
36958
|
}
|
|
@@ -38513,400 +38490,419 @@ var __webpack_exports__ = {};
|
|
|
38513
38490
|
}
|
|
38514
38491
|
return randomString;
|
|
38515
38492
|
}
|
|
38493
|
+
function safeSerialize(obj) {
|
|
38494
|
+
if (!obj || "object" != typeof obj) return obj;
|
|
38495
|
+
try {
|
|
38496
|
+
return JSON.parse(JSON.stringify(obj));
|
|
38497
|
+
} catch (error) {
|
|
38498
|
+
return {};
|
|
38499
|
+
}
|
|
38500
|
+
}
|
|
38516
38501
|
const mock_mockAction = async (task, params)=>{
|
|
38517
38502
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
38518
|
-
if (!params.extraParam || !params.extraParam["security-sdk/
|
|
38519
|
-
|
|
38520
|
-
|
|
38521
|
-
|
|
38522
|
-
|
|
38523
|
-
|
|
38524
|
-
|
|
38525
|
-
|
|
38526
|
-
|
|
38527
|
-
|
|
38528
|
-
|
|
38529
|
-
|
|
38530
|
-
|
|
38531
|
-
|
|
38532
|
-
|
|
38533
|
-
|
|
38534
|
-
|
|
38535
|
-
|
|
38536
|
-
|
|
38537
|
-
|
|
38538
|
-
|
|
38539
|
-
|
|
38540
|
-
|
|
38541
|
-
|
|
38542
|
-
|
|
38543
|
-
|
|
38544
|
-
|
|
38545
|
-
|
|
38546
|
-
|
|
38547
|
-
|
|
38548
|
-
|
|
38549
|
-
|
|
38550
|
-
|
|
38551
|
-
|
|
38552
|
-
|
|
38553
|
-
|
|
38554
|
-
|
|
38555
|
-
|
|
38556
|
-
|
|
38557
|
-
|
|
38558
|
-
|
|
38559
|
-
|
|
38560
|
-
|
|
38561
|
-
|
|
38562
|
-
|
|
38563
|
-
|
|
38564
|
-
|
|
38565
|
-
|
|
38566
|
-
|
|
38567
|
-
|
|
38568
|
-
|
|
38569
|
-
|
|
38570
|
-
|
|
38571
|
-
|
|
38572
|
-
|
|
38573
|
-
|
|
38574
|
-
|
|
38575
|
-
|
|
38576
|
-
|
|
38577
|
-
|
|
38578
|
-
|
|
38579
|
-
|
|
38580
|
-
|
|
38581
|
-
|
|
38582
|
-
|
|
38583
|
-
|
|
38584
|
-
|
|
38585
|
-
|
|
38586
|
-
|
|
38587
|
-
|
|
38588
|
-
|
|
38589
|
-
|
|
38590
|
-
|
|
38591
|
-
|
|
38503
|
+
if (!params.extraParam || !params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || !params.extraParam["security-sdk/s_sdk_server_cert_key"] || !params.extraParam["security-sdk/s_sdk_crypt_sdk"]) return utils_response(414, "extraParam 参数缺失或不完整", "");
|
|
38504
|
+
let currentStep = "初始化";
|
|
38505
|
+
try {
|
|
38506
|
+
currentStep = "验证账号信息";
|
|
38507
|
+
const userAgent = params.userAgent || "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.38";
|
|
38508
|
+
const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
38509
|
+
if (!sessionidCookie) return {
|
|
38510
|
+
code: 414,
|
|
38511
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
38512
|
+
data: ""
|
|
38513
|
+
};
|
|
38514
|
+
currentStep = "准备请求参数";
|
|
38515
|
+
const headers = {
|
|
38516
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
38517
|
+
origin: "https://creator.douyin.com",
|
|
38518
|
+
referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
38519
|
+
Accept: "application/json, text/plain, */*",
|
|
38520
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
38521
|
+
"Content-Type": "application/json",
|
|
38522
|
+
pragma: "no-cache",
|
|
38523
|
+
"cache-control": "no-cache",
|
|
38524
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
38525
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
38526
|
+
"bd-ticket-guard-web-version": "2",
|
|
38527
|
+
"sec-ch-ua-mobile": "?0",
|
|
38528
|
+
"user-agent": userAgent,
|
|
38529
|
+
"sec-fetch-site": "same-origin",
|
|
38530
|
+
"sec-fetch-mode": "cors",
|
|
38531
|
+
"sec-fetch-dest": "empty",
|
|
38532
|
+
"accept-language": "zh-CN,zh;q=0.9",
|
|
38533
|
+
priority: "u=1, i"
|
|
38534
|
+
};
|
|
38535
|
+
const publishParams = {
|
|
38536
|
+
read_aid: "2906",
|
|
38537
|
+
aid: "1128",
|
|
38538
|
+
cookie_enabled: "true",
|
|
38539
|
+
screen_width: params.extraParam?.browserInfo.screen_width || "1920",
|
|
38540
|
+
screen_height: params.extraParam?.browserInfo.screen_height || "1080",
|
|
38541
|
+
browser_language: params.extraParam?.browserInfo.browser_language || "zh-CN",
|
|
38542
|
+
browser_platform: params.extraParam?.browserInfo.browser_platform || "Win32",
|
|
38543
|
+
browser_name: params.extraParam?.browserInfo.browser_name || "Mozilla",
|
|
38544
|
+
browser_version: userAgent,
|
|
38545
|
+
browser_online: "true",
|
|
38546
|
+
timezone_name: "Asia/Shanghai",
|
|
38547
|
+
support_h265: "1",
|
|
38548
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
38549
|
+
a_bogus: ""
|
|
38550
|
+
};
|
|
38551
|
+
task.logger.info(`[douyinPublish] publishParams ${JSON.stringify(publishParams)}`);
|
|
38552
|
+
const publishData = {
|
|
38553
|
+
item: {
|
|
38554
|
+
common: {
|
|
38555
|
+
text: params.content,
|
|
38556
|
+
text_extra: params.textExtra,
|
|
38557
|
+
activity: "[]",
|
|
38558
|
+
challenges: params.challengeIds || "[]",
|
|
38559
|
+
hashtag_source: "",
|
|
38560
|
+
mentions: "[]",
|
|
38561
|
+
music_id: params.musicId || "",
|
|
38562
|
+
music_end_time: 1000 * (params.musicDuration || 0),
|
|
38563
|
+
hot_sentence: params.hotSentence || "",
|
|
38564
|
+
visibility_type: Number(params.visibleRange) || 0,
|
|
38565
|
+
download: params.allowSave ? 1 : 0,
|
|
38566
|
+
timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
|
|
38567
|
+
media_type: Number(params.publishType) || 2,
|
|
38568
|
+
images: [],
|
|
38569
|
+
creation_id: ""
|
|
38570
|
+
},
|
|
38571
|
+
cover: {
|
|
38572
|
+
poster: ""
|
|
38573
|
+
},
|
|
38574
|
+
mix: params.mix ? {
|
|
38575
|
+
mix_id: params.mix.mix_id,
|
|
38576
|
+
mix_order: params.mix.mix_order || 0
|
|
38577
|
+
} : {},
|
|
38578
|
+
anchor: {},
|
|
38579
|
+
declare: {
|
|
38580
|
+
user_declare_info: "{}"
|
|
38581
|
+
}
|
|
38592
38582
|
}
|
|
38593
|
-
}
|
|
38594
|
-
|
|
38595
|
-
|
|
38596
|
-
|
|
38583
|
+
};
|
|
38584
|
+
const args = [
|
|
38585
|
+
{
|
|
38586
|
+
headers
|
|
38587
|
+
},
|
|
38588
|
+
task.logger,
|
|
38589
|
+
params.proxyLoc,
|
|
38590
|
+
params.accountId,
|
|
38591
|
+
"douyin"
|
|
38592
|
+
];
|
|
38593
|
+
const http = new Http({
|
|
38597
38594
|
headers
|
|
38598
|
-
}
|
|
38599
|
-
|
|
38600
|
-
|
|
38601
|
-
|
|
38602
|
-
|
|
38603
|
-
|
|
38604
|
-
|
|
38605
|
-
|
|
38606
|
-
|
|
38607
|
-
|
|
38608
|
-
|
|
38609
|
-
|
|
38610
|
-
|
|
38611
|
-
|
|
38612
|
-
|
|
38613
|
-
|
|
38614
|
-
|
|
38615
|
-
|
|
38616
|
-
|
|
38617
|
-
|
|
38618
|
-
|
|
38619
|
-
|
|
38620
|
-
|
|
38621
|
-
|
|
38622
|
-
|
|
38623
|
-
|
|
38595
|
+
});
|
|
38596
|
+
const proxyHttp = new Http(...args);
|
|
38597
|
+
const uploadedImgList = params.uploadedImgList ? JSON.parse(params.uploadedImgList) : [];
|
|
38598
|
+
if (uploadedImgList.length > 0) publishData.item.common.images = uploadedImgList;
|
|
38599
|
+
else {
|
|
38600
|
+
const tmpCachePath = task.getTmpPath();
|
|
38601
|
+
const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
|
|
38602
|
+
if (params.coverImage) {
|
|
38603
|
+
const cover = await uploader.uploadCover(params.coverImage);
|
|
38604
|
+
if (cover) {
|
|
38605
|
+
publishData.item.common.images.push({
|
|
38606
|
+
uri: cover.uri,
|
|
38607
|
+
width: cover.width,
|
|
38608
|
+
height: cover.height
|
|
38609
|
+
});
|
|
38610
|
+
publishData.item.cover = {
|
|
38611
|
+
poster: cover.uri
|
|
38612
|
+
};
|
|
38613
|
+
}
|
|
38614
|
+
}
|
|
38615
|
+
if (params.banners && params.banners.length > 0) {
|
|
38616
|
+
const banners = params.banners.filter((i)=>i !== params.coverImage);
|
|
38617
|
+
const uploadResults = await uploader.uploadImages(banners);
|
|
38618
|
+
publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
|
|
38619
|
+
uri: result.uri,
|
|
38620
|
+
width: result.width,
|
|
38621
|
+
height: result.height
|
|
38622
|
+
})));
|
|
38623
|
+
}
|
|
38624
|
+
}
|
|
38625
|
+
publishData.item.common.creation_id = generateRandomString(8) + Date.now();
|
|
38626
|
+
let decision = null;
|
|
38627
|
+
proxyHttp.addResponseInterceptor((response)=>{
|
|
38628
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
|
|
38629
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
|
|
38630
|
+
decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
|
|
38631
|
+
if (needsVerification(decision)) {
|
|
38632
|
+
task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
|
|
38633
|
+
return;
|
|
38634
|
+
}
|
|
38635
|
+
if (!response || !response.data) return;
|
|
38636
|
+
const responseData = response.data;
|
|
38637
|
+
if (response && responseData?.status_code && 0 !== responseData.status_code) {
|
|
38638
|
+
const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
|
|
38639
|
+
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
|
|
38640
|
+
return {
|
|
38641
|
+
code: errorCode,
|
|
38642
|
+
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
38643
|
+
data: responseData
|
|
38624
38644
|
};
|
|
38625
38645
|
}
|
|
38646
|
+
});
|
|
38647
|
+
task._timerRecord.PrePublish = Date.now();
|
|
38648
|
+
if (MockPublish) {
|
|
38649
|
+
const data = "123456789";
|
|
38650
|
+
const message = `图文模拟发布成功 ${http.proxyInfo}`;
|
|
38651
|
+
await updateTaskState?.({
|
|
38652
|
+
state: types_TaskState.SUCCESS,
|
|
38653
|
+
result: {
|
|
38654
|
+
response: data
|
|
38655
|
+
}
|
|
38656
|
+
});
|
|
38657
|
+
return utils_response(0, message, data);
|
|
38626
38658
|
}
|
|
38627
|
-
|
|
38628
|
-
|
|
38629
|
-
|
|
38630
|
-
|
|
38631
|
-
|
|
38632
|
-
|
|
38633
|
-
|
|
38634
|
-
|
|
38635
|
-
|
|
38636
|
-
|
|
38637
|
-
|
|
38638
|
-
|
|
38639
|
-
|
|
38640
|
-
|
|
38641
|
-
|
|
38642
|
-
|
|
38643
|
-
|
|
38644
|
-
|
|
38645
|
-
|
|
38659
|
+
let webProtectData;
|
|
38660
|
+
try {
|
|
38661
|
+
webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
38662
|
+
if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
|
|
38663
|
+
task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
|
|
38664
|
+
return utils_response(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
|
|
38665
|
+
}
|
|
38666
|
+
} catch (error) {
|
|
38667
|
+
task.logger.error(`解析 webProtectData 失败: ${error}`);
|
|
38668
|
+
return utils_response(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
|
|
38669
|
+
}
|
|
38670
|
+
let ticket = webProtectData.ticket;
|
|
38671
|
+
let ts_sign = webProtectData.ts_sign;
|
|
38672
|
+
const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
|
|
38673
|
+
if (serverDataCookie) try {
|
|
38674
|
+
const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
|
|
38675
|
+
if (decoded.ticket && decoded.ts_sign) {
|
|
38676
|
+
if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
|
|
38677
|
+
ticket = decoded.ticket;
|
|
38678
|
+
ts_sign = decoded.ts_sign;
|
|
38679
|
+
}
|
|
38680
|
+
} catch (error) {
|
|
38681
|
+
task.logger.info(`[douyinPublish] 解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
|
|
38646
38682
|
}
|
|
38647
|
-
|
|
38648
|
-
|
|
38649
|
-
|
|
38650
|
-
|
|
38651
|
-
|
|
38652
|
-
|
|
38653
|
-
|
|
38654
|
-
|
|
38655
|
-
|
|
38656
|
-
|
|
38683
|
+
let ec_privateKey;
|
|
38684
|
+
try {
|
|
38685
|
+
ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
|
|
38686
|
+
if (!ec_privateKey) {
|
|
38687
|
+
task.logger.error("[douyinPublish] ec_privateKey 为空");
|
|
38688
|
+
return utils_response(414, "安全参数 ec_privateKey 缺失,请重新获取后重试", "");
|
|
38689
|
+
}
|
|
38690
|
+
} catch (error) {
|
|
38691
|
+
task.logger.error(`[douyinPublish] 解析 ec_privateKey 失败: ${error}`);
|
|
38692
|
+
return utils_response(414, "安全参数 ec_privateKey 解析失败,请重新获取后重试", "");
|
|
38657
38693
|
}
|
|
38658
|
-
|
|
38659
|
-
|
|
38660
|
-
|
|
38661
|
-
|
|
38662
|
-
|
|
38663
|
-
|
|
38664
|
-
state: types_TaskState.SUCCESS,
|
|
38665
|
-
result: {
|
|
38666
|
-
response: data
|
|
38694
|
+
let certificate;
|
|
38695
|
+
try {
|
|
38696
|
+
certificate = JSON.parse(params.extraParam["security-sdk/s_sdk_server_cert_key"] || "{}").cert;
|
|
38697
|
+
if (!certificate) {
|
|
38698
|
+
task.logger.error("[douyinPublish] certificate 为空");
|
|
38699
|
+
return utils_response(414, "安全参数 certificate 缺失,请重新获取后重试", "");
|
|
38667
38700
|
}
|
|
38668
|
-
})
|
|
38669
|
-
|
|
38670
|
-
|
|
38671
|
-
let webProtectData;
|
|
38672
|
-
try {
|
|
38673
|
-
webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
38674
|
-
if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
|
|
38675
|
-
task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
|
|
38676
|
-
return utils_response(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
|
|
38701
|
+
} catch (error) {
|
|
38702
|
+
task.logger.error(`[douyinPublish] 解析 certificate 失败: ${error}`);
|
|
38703
|
+
return utils_response(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
|
|
38677
38704
|
}
|
|
38678
|
-
|
|
38679
|
-
|
|
38680
|
-
|
|
38681
|
-
|
|
38682
|
-
|
|
38683
|
-
|
|
38684
|
-
|
|
38685
|
-
|
|
38686
|
-
|
|
38687
|
-
|
|
38688
|
-
if (
|
|
38689
|
-
|
|
38690
|
-
|
|
38705
|
+
const ree_public_key = webProtectData.client_cert.replace("pub.", "");
|
|
38706
|
+
let bdTicketGuardClientData;
|
|
38707
|
+
try {
|
|
38708
|
+
bdTicketGuardClientData = getBdV2({
|
|
38709
|
+
ticket,
|
|
38710
|
+
ts_sign: ts_sign,
|
|
38711
|
+
ec_privateKey: ec_privateKey,
|
|
38712
|
+
certificate: certificate,
|
|
38713
|
+
bd_ticket_guard_ree_public_key: ree_public_key
|
|
38714
|
+
});
|
|
38715
|
+
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
38716
|
+
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
38717
|
+
return utils_response(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
38718
|
+
}
|
|
38719
|
+
} catch (error) {
|
|
38720
|
+
task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
|
|
38721
|
+
return utils_response(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
|
|
38691
38722
|
}
|
|
38692
|
-
|
|
38693
|
-
|
|
38694
|
-
|
|
38695
|
-
|
|
38696
|
-
|
|
38697
|
-
|
|
38698
|
-
|
|
38699
|
-
|
|
38700
|
-
|
|
38723
|
+
task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
|
|
38724
|
+
const publishQuery = {
|
|
38725
|
+
...publishParams,
|
|
38726
|
+
a_bogus: ""
|
|
38727
|
+
};
|
|
38728
|
+
const queryString = new URLSearchParams(publishQuery).toString();
|
|
38729
|
+
let aBogus;
|
|
38730
|
+
try {
|
|
38731
|
+
aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
|
|
38732
|
+
if (!aBogus || aBogus.length < 10) {
|
|
38733
|
+
task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
|
|
38734
|
+
return utils_response(414, "安全参数 a_bogus 生成失败,请重试", "");
|
|
38735
|
+
}
|
|
38736
|
+
} catch (error) {
|
|
38737
|
+
task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
|
|
38738
|
+
return utils_response(414, "安全参数 a_bogus 生成异常,请重试", "");
|
|
38701
38739
|
}
|
|
38702
|
-
|
|
38703
|
-
|
|
38704
|
-
|
|
38705
|
-
|
|
38706
|
-
|
|
38707
|
-
|
|
38708
|
-
|
|
38709
|
-
|
|
38710
|
-
|
|
38711
|
-
|
|
38740
|
+
publishQuery.a_bogus = aBogus;
|
|
38741
|
+
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
38742
|
+
let csrfToken;
|
|
38743
|
+
try {
|
|
38744
|
+
csrfToken = mock_generateCsrfTokenAdvanced({
|
|
38745
|
+
cookies: params.cookies,
|
|
38746
|
+
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
38747
|
+
method: "POST",
|
|
38748
|
+
userAgent
|
|
38749
|
+
});
|
|
38750
|
+
if (!csrfToken || csrfToken.length < 10) {
|
|
38751
|
+
task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
|
|
38752
|
+
return utils_response(414, "安全参数 csrfToken 生成失败,请重试", "");
|
|
38753
|
+
}
|
|
38754
|
+
task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
|
|
38755
|
+
} catch (error) {
|
|
38756
|
+
task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
|
|
38757
|
+
return utils_response(414, "安全参数 csrfToken 生成异常,请重试", "");
|
|
38712
38758
|
}
|
|
38713
|
-
|
|
38714
|
-
|
|
38715
|
-
|
|
38716
|
-
|
|
38717
|
-
|
|
38718
|
-
|
|
38719
|
-
|
|
38720
|
-
bdTicketGuardClientData = getBdV2({
|
|
38721
|
-
ticket,
|
|
38722
|
-
ts_sign: ts_sign,
|
|
38723
|
-
ec_privateKey: ec_privateKey,
|
|
38724
|
-
certificate: certificate,
|
|
38725
|
-
bd_ticket_guard_ree_public_key: ree_public_key
|
|
38726
|
-
});
|
|
38727
|
-
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
38728
|
-
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
38729
|
-
return utils_response(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
38759
|
+
let sessionDtrait;
|
|
38760
|
+
try {
|
|
38761
|
+
sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
|
|
38762
|
+
task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
|
|
38763
|
+
} catch (error) {
|
|
38764
|
+
task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
|
|
38765
|
+
return utils_response(414, "安全参数 sessionDtrait 生成异常,请重试", "");
|
|
38730
38766
|
}
|
|
38731
|
-
|
|
38732
|
-
|
|
38733
|
-
|
|
38734
|
-
|
|
38735
|
-
|
|
38736
|
-
|
|
38737
|
-
|
|
38738
|
-
|
|
38739
|
-
|
|
38740
|
-
|
|
38741
|
-
|
|
38742
|
-
|
|
38743
|
-
|
|
38744
|
-
|
|
38745
|
-
|
|
38746
|
-
|
|
38767
|
+
task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
|
|
38768
|
+
...headers,
|
|
38769
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
38770
|
+
"Content-Type": "application/json",
|
|
38771
|
+
Accept: "application/json, text/plain, */*",
|
|
38772
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
38773
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
38774
|
+
"bd-ticket-guard-version": "2",
|
|
38775
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
38776
|
+
"bd-ticket-guard-web-version": "2",
|
|
38777
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
38778
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
38779
|
+
})}`);
|
|
38780
|
+
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
38781
|
+
let publishResult;
|
|
38782
|
+
try {
|
|
38783
|
+
publishResult = await proxyHttp.api({
|
|
38784
|
+
method: "post",
|
|
38785
|
+
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
38786
|
+
data: publishData,
|
|
38787
|
+
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
38788
|
+
headers: {
|
|
38789
|
+
...headers,
|
|
38790
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
38791
|
+
"Content-Type": "application/json",
|
|
38792
|
+
Accept: "application/json, text/plain, */*",
|
|
38793
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
38794
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
38795
|
+
"bd-ticket-guard-version": "2",
|
|
38796
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
38797
|
+
"bd-ticket-guard-web-version": "2",
|
|
38798
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
38799
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
38800
|
+
}
|
|
38801
|
+
}, {
|
|
38802
|
+
timeout: 60000,
|
|
38803
|
+
retries: 3,
|
|
38804
|
+
retryDelay: 2000
|
|
38805
|
+
});
|
|
38806
|
+
} catch (error) {
|
|
38807
|
+
const handledError = Http.handleApiError(error);
|
|
38808
|
+
const isProxyOrNetworkError = [
|
|
38809
|
+
599,
|
|
38810
|
+
500,
|
|
38811
|
+
502,
|
|
38812
|
+
503,
|
|
38813
|
+
504
|
|
38814
|
+
].includes(handledError.code);
|
|
38815
|
+
if (isProxyOrNetworkError) {
|
|
38816
|
+
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
38817
|
+
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
38818
|
+
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38819
|
+
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
38820
|
+
await updateTaskState?.({
|
|
38821
|
+
state: types_TaskState.FAILED,
|
|
38822
|
+
error: message
|
|
38823
|
+
});
|
|
38824
|
+
return {
|
|
38825
|
+
code: 414,
|
|
38826
|
+
data: "",
|
|
38827
|
+
message
|
|
38828
|
+
};
|
|
38829
|
+
}
|
|
38830
|
+
throw error;
|
|
38747
38831
|
}
|
|
38748
|
-
|
|
38749
|
-
|
|
38750
|
-
|
|
38751
|
-
|
|
38752
|
-
|
|
38753
|
-
|
|
38754
|
-
|
|
38755
|
-
|
|
38756
|
-
|
|
38757
|
-
|
|
38758
|
-
|
|
38759
|
-
|
|
38760
|
-
|
|
38761
|
-
|
|
38762
|
-
|
|
38763
|
-
|
|
38764
|
-
|
|
38832
|
+
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
38833
|
+
if (needsVerification(decision)) {
|
|
38834
|
+
const details = [
|
|
38835
|
+
publishResult.status_msg,
|
|
38836
|
+
decision?.verify_title,
|
|
38837
|
+
decision?.verify_desc
|
|
38838
|
+
].filter(Boolean).join(" ");
|
|
38839
|
+
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38840
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
38841
|
+
const mockData = {
|
|
38842
|
+
state: types_TaskState.FAILED,
|
|
38843
|
+
error: message,
|
|
38844
|
+
result: {
|
|
38845
|
+
...safeDecision,
|
|
38846
|
+
data: decision,
|
|
38847
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
38848
|
+
}
|
|
38849
|
+
};
|
|
38850
|
+
await updateTaskState?.(mockData);
|
|
38851
|
+
return {
|
|
38852
|
+
code: 0,
|
|
38853
|
+
data: mockData,
|
|
38854
|
+
message: "操作成功"
|
|
38855
|
+
};
|
|
38765
38856
|
}
|
|
38766
|
-
|
|
38767
|
-
|
|
38768
|
-
|
|
38769
|
-
|
|
38770
|
-
|
|
38771
|
-
|
|
38772
|
-
|
|
38773
|
-
|
|
38774
|
-
|
|
38775
|
-
|
|
38776
|
-
task.logger.
|
|
38777
|
-
|
|
38778
|
-
|
|
38779
|
-
|
|
38780
|
-
|
|
38781
|
-
|
|
38782
|
-
"Content-Type": "application/json",
|
|
38783
|
-
Accept: "application/json, text/plain, */*",
|
|
38784
|
-
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
38785
|
-
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
38786
|
-
"bd-ticket-guard-version": "2",
|
|
38787
|
-
"bd-ticket-guard-web-sign-type": "1",
|
|
38788
|
-
"bd-ticket-guard-web-version": "2",
|
|
38789
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
38790
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
38791
|
-
})}`);
|
|
38792
|
-
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
38793
|
-
let publishResult;
|
|
38794
|
-
try {
|
|
38795
|
-
publishResult = await proxyHttp.api({
|
|
38796
|
-
method: "post",
|
|
38797
|
-
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
38798
|
-
data: publishData,
|
|
38799
|
-
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
38800
|
-
headers: {
|
|
38801
|
-
...headers,
|
|
38802
|
-
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
38803
|
-
"Content-Type": "application/json",
|
|
38804
|
-
Accept: "application/json, text/plain, */*",
|
|
38805
|
-
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
38806
|
-
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
38807
|
-
"bd-ticket-guard-version": "2",
|
|
38808
|
-
"bd-ticket-guard-web-sign-type": "1",
|
|
38809
|
-
"bd-ticket-guard-web-version": "2",
|
|
38810
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
38811
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
38812
|
-
}
|
|
38813
|
-
}, {
|
|
38814
|
-
timeout: 60000,
|
|
38815
|
-
retries: 3,
|
|
38816
|
-
retryDelay: 2000
|
|
38817
|
-
});
|
|
38818
|
-
} catch (error) {
|
|
38819
|
-
const handledError = Http.handleApiError(error);
|
|
38820
|
-
const isProxyOrNetworkError = [
|
|
38821
|
-
599,
|
|
38822
|
-
500,
|
|
38823
|
-
502,
|
|
38824
|
-
503,
|
|
38825
|
-
504
|
|
38826
|
-
].includes(handledError.code);
|
|
38827
|
-
if (isProxyOrNetworkError) {
|
|
38828
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
38829
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
38830
|
-
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38831
|
-
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
38857
|
+
reportLogger({
|
|
38858
|
+
token: params.huiwenToken || "",
|
|
38859
|
+
enverionment: task.enverionment || "development",
|
|
38860
|
+
postId: params.articleId,
|
|
38861
|
+
eip: proxyHttp.proxyInfo,
|
|
38862
|
+
accountId: params.accountId,
|
|
38863
|
+
uid: params.uid,
|
|
38864
|
+
platform: "douyin",
|
|
38865
|
+
publishParams: publishData
|
|
38866
|
+
});
|
|
38867
|
+
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
38868
|
+
const isSuccess = 0 === publishResult.status_code;
|
|
38869
|
+
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38870
|
+
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
38871
|
+
if (!isSuccess) {
|
|
38872
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
38832
38873
|
await updateTaskState?.({
|
|
38833
38874
|
state: types_TaskState.FAILED,
|
|
38834
|
-
error: message
|
|
38875
|
+
error: message,
|
|
38876
|
+
result: {
|
|
38877
|
+
...safeDecision,
|
|
38878
|
+
data: safeDecision,
|
|
38879
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
38880
|
+
}
|
|
38835
38881
|
});
|
|
38836
38882
|
return {
|
|
38837
38883
|
code: 414,
|
|
38838
|
-
data:
|
|
38884
|
+
data: safeDecision,
|
|
38839
38885
|
message
|
|
38840
38886
|
};
|
|
38841
38887
|
}
|
|
38842
|
-
|
|
38843
|
-
|
|
38844
|
-
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
38845
|
-
if (needsVerification(decision)) {
|
|
38846
|
-
const details = [
|
|
38847
|
-
publishResult.status_msg,
|
|
38848
|
-
decision?.verify_title,
|
|
38849
|
-
decision?.verify_desc
|
|
38850
|
-
].filter(Boolean).join(" ");
|
|
38851
|
-
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38852
|
-
let decisionObj = {};
|
|
38853
|
-
if (decision) decisionObj = decision;
|
|
38854
|
-
const mockData = {
|
|
38855
|
-
state: types_TaskState.FAILED,
|
|
38856
|
-
error: message,
|
|
38888
|
+
await updateTaskState?.({
|
|
38889
|
+
state: types_TaskState.SUCCESS,
|
|
38857
38890
|
result: {
|
|
38858
|
-
|
|
38859
|
-
data: decision,
|
|
38860
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
38891
|
+
response: data
|
|
38861
38892
|
}
|
|
38862
|
-
};
|
|
38863
|
-
|
|
38864
|
-
|
|
38865
|
-
|
|
38866
|
-
|
|
38867
|
-
|
|
38868
|
-
};
|
|
38869
|
-
}
|
|
38870
|
-
reportLogger({
|
|
38871
|
-
token: params.huiwenToken || "",
|
|
38872
|
-
enverionment: task.enverionment || "development",
|
|
38873
|
-
postId: params.articleId,
|
|
38874
|
-
eip: proxyHttp.proxyInfo,
|
|
38875
|
-
proxyIp: params.localIP,
|
|
38876
|
-
accountId: params.accountId,
|
|
38877
|
-
uid: params.uid,
|
|
38878
|
-
platform: "douyin",
|
|
38879
|
-
publishParams: publishData
|
|
38880
|
-
});
|
|
38881
|
-
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
38882
|
-
const isSuccess = 0 === publishResult.status_code;
|
|
38883
|
-
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
38884
|
-
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
38885
|
-
if (!isSuccess) {
|
|
38886
|
-
let decisionObj = {};
|
|
38887
|
-
if (decision) decisionObj = decision;
|
|
38893
|
+
});
|
|
38894
|
+
return utils_response(isSuccess ? 0 : 414, message, data);
|
|
38895
|
+
} catch (error) {
|
|
38896
|
+
const handledError = Http.handleApiError(error);
|
|
38897
|
+
const errorMsg = handledError.message || "发布失败";
|
|
38898
|
+
const errorCode = handledError.code || 500;
|
|
38899
|
+
task.logger.error(`[douyinPublish] 发布流程异常 (步骤: ${currentStep}): ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
38888
38900
|
await updateTaskState?.({
|
|
38889
38901
|
state: types_TaskState.FAILED,
|
|
38890
|
-
error:
|
|
38891
|
-
result: {
|
|
38892
|
-
...decisionObj,
|
|
38893
|
-
data: decision,
|
|
38894
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
38895
|
-
}
|
|
38902
|
+
error: `${currentStep}失败: ${errorMsg}`
|
|
38896
38903
|
});
|
|
38897
|
-
return
|
|
38898
|
-
code: 414,
|
|
38899
|
-
data,
|
|
38900
|
-
message
|
|
38901
|
-
};
|
|
38904
|
+
return utils_response(errorCode, errorMsg, "");
|
|
38902
38905
|
}
|
|
38903
|
-
await updateTaskState?.({
|
|
38904
|
-
state: types_TaskState.SUCCESS,
|
|
38905
|
-
result: {
|
|
38906
|
-
response: data
|
|
38907
|
-
}
|
|
38908
|
-
});
|
|
38909
|
-
return utils_response(isSuccess ? 0 : 414, message, data);
|
|
38910
38906
|
};
|
|
38911
38907
|
const douyinPublish_rpa_rpaAction = async (task, params)=>{
|
|
38912
38908
|
const commonCookies = {
|
|
@@ -39225,18 +39221,13 @@ var __webpack_exports__ = {};
|
|
|
39225
39221
|
return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
39226
39222
|
}));
|
|
39227
39223
|
let proxyUrl;
|
|
39228
|
-
if (params.
|
|
39229
|
-
|
|
39230
|
-
|
|
39231
|
-
params.proxyLoc,
|
|
39232
|
-
params.accountId
|
|
39233
|
-
];
|
|
39234
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
39235
|
-
const proxyAgentResult = await ProxyAgent({
|
|
39224
|
+
if (params.proxyLoc) {
|
|
39225
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
39226
|
+
const ProxyAgentResult = await ProxyAgent({
|
|
39236
39227
|
logger: task.logger
|
|
39237
|
-
},
|
|
39228
|
+
}, params.proxyLoc, params.accountId);
|
|
39238
39229
|
task.logger?.info("==> 代理信息获取成功!");
|
|
39239
|
-
proxyUrl =
|
|
39230
|
+
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
39240
39231
|
}
|
|
39241
39232
|
const commonCookies = {
|
|
39242
39233
|
path: "/",
|
|
@@ -40193,7 +40184,6 @@ var __webpack_exports__ = {};
|
|
|
40193
40184
|
},
|
|
40194
40185
|
_task.logger,
|
|
40195
40186
|
params.proxyLoc,
|
|
40196
|
-
params.localIP,
|
|
40197
40187
|
params.accountId
|
|
40198
40188
|
];
|
|
40199
40189
|
const http = new Http(...args);
|
|
@@ -40251,7 +40241,6 @@ var __webpack_exports__ = {};
|
|
|
40251
40241
|
},
|
|
40252
40242
|
_task.logger,
|
|
40253
40243
|
params.proxyLoc,
|
|
40254
|
-
params.localIP,
|
|
40255
40244
|
params.accountId
|
|
40256
40245
|
];
|
|
40257
40246
|
const http = new Http(...args);
|
|
@@ -40298,7 +40287,6 @@ var __webpack_exports__ = {};
|
|
|
40298
40287
|
},
|
|
40299
40288
|
_task.logger,
|
|
40300
40289
|
params.proxyLoc,
|
|
40301
|
-
params.localIP,
|
|
40302
40290
|
params.accountId
|
|
40303
40291
|
];
|
|
40304
40292
|
const http = new Http(...args);
|
|
@@ -40359,7 +40347,6 @@ var __webpack_exports__ = {};
|
|
|
40359
40347
|
},
|
|
40360
40348
|
_task.logger,
|
|
40361
40349
|
params.proxyLoc,
|
|
40362
|
-
params.localIP,
|
|
40363
40350
|
params.accountId
|
|
40364
40351
|
];
|
|
40365
40352
|
const http = new Http(...args);
|
|
@@ -40432,6 +40419,239 @@ var __webpack_exports__ = {};
|
|
|
40432
40419
|
};
|
|
40433
40420
|
return success(bjhData, "百家号平台数据获取成功!");
|
|
40434
40421
|
}
|
|
40422
|
+
async function getDouyinData(_task, params) {
|
|
40423
|
+
try {
|
|
40424
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40425
|
+
if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
|
|
40426
|
+
const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
|
|
40427
|
+
const headers = {
|
|
40428
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40429
|
+
referer: "https://creator.douyin.com/creator-micro/home",
|
|
40430
|
+
origin: "https://creator.douyin.com",
|
|
40431
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
|
40432
|
+
...csrfToken ? {
|
|
40433
|
+
"x-secsdk-csrf-token": csrfToken
|
|
40434
|
+
} : {}
|
|
40435
|
+
};
|
|
40436
|
+
const args = [
|
|
40437
|
+
{
|
|
40438
|
+
headers
|
|
40439
|
+
},
|
|
40440
|
+
_task.logger,
|
|
40441
|
+
params.proxyLoc,
|
|
40442
|
+
params.accountId
|
|
40443
|
+
];
|
|
40444
|
+
const http = new Http(...args);
|
|
40445
|
+
const toNum = (val)=>{
|
|
40446
|
+
if (null == val) return 0;
|
|
40447
|
+
const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
|
|
40448
|
+
return Number.isNaN(n) ? 0 : n;
|
|
40449
|
+
};
|
|
40450
|
+
const userProfileP = http.api({
|
|
40451
|
+
method: "get",
|
|
40452
|
+
url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
|
|
40453
|
+
params: {
|
|
40454
|
+
device_platform: "webapp",
|
|
40455
|
+
aid: "6383",
|
|
40456
|
+
channel: "channel_pc_web",
|
|
40457
|
+
pc_client_type: "1",
|
|
40458
|
+
version_code: "170400",
|
|
40459
|
+
version_name: "17.4.0",
|
|
40460
|
+
cookie_enabled: "true",
|
|
40461
|
+
platform: "PC"
|
|
40462
|
+
}
|
|
40463
|
+
}, {
|
|
40464
|
+
retries: 3,
|
|
40465
|
+
retryDelay: 100,
|
|
40466
|
+
timeout: 10000
|
|
40467
|
+
}).catch((e)=>{
|
|
40468
|
+
_task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
|
|
40469
|
+
return null;
|
|
40470
|
+
});
|
|
40471
|
+
const overviewP = http.api({
|
|
40472
|
+
method: "get",
|
|
40473
|
+
url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
|
|
40474
|
+
params: {
|
|
40475
|
+
last_days_type: 1,
|
|
40476
|
+
aid: 2906,
|
|
40477
|
+
app_name: "aweme_creator_platform",
|
|
40478
|
+
device_platform: "web"
|
|
40479
|
+
}
|
|
40480
|
+
}, {
|
|
40481
|
+
retries: 3,
|
|
40482
|
+
retryDelay: 100,
|
|
40483
|
+
timeout: 5000
|
|
40484
|
+
}).catch((e)=>{
|
|
40485
|
+
_task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
|
|
40486
|
+
return null;
|
|
40487
|
+
});
|
|
40488
|
+
const [userProfile, overview] = await Promise.all([
|
|
40489
|
+
userProfileP,
|
|
40490
|
+
overviewP
|
|
40491
|
+
]);
|
|
40492
|
+
let fansNum = 0;
|
|
40493
|
+
let favedNum = 0;
|
|
40494
|
+
let followingNum = 0;
|
|
40495
|
+
if (userProfile?.status_code === 0 && userProfile.user) {
|
|
40496
|
+
const user = userProfile.user;
|
|
40497
|
+
fansNum = toNum(user.follower_count);
|
|
40498
|
+
followingNum = toNum(user.following_count);
|
|
40499
|
+
favedNum = toNum(user.total_favorited);
|
|
40500
|
+
} else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
|
|
40501
|
+
const ov = overview?.data;
|
|
40502
|
+
const douyinData = {
|
|
40503
|
+
fansNum,
|
|
40504
|
+
favedNum,
|
|
40505
|
+
fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
|
|
40506
|
+
watchNumLastWeek: toNum(ov?.play?.last_period_incr),
|
|
40507
|
+
likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
|
|
40508
|
+
commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
|
|
40509
|
+
shareNumLastWeek: toNum(ov?.share?.last_period_incr),
|
|
40510
|
+
visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
|
|
40511
|
+
};
|
|
40512
|
+
return success(douyinData, "抖音平台数据获取成功!");
|
|
40513
|
+
} catch (error) {
|
|
40514
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40515
|
+
const err = error;
|
|
40516
|
+
_task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
|
|
40517
|
+
return types_errorResponse(err.message, err.code);
|
|
40518
|
+
}
|
|
40519
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40520
|
+
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
40521
|
+
return types_errorResponse(errMsg || "抖音账号数据获取失败");
|
|
40522
|
+
}
|
|
40523
|
+
}
|
|
40524
|
+
async function getShipinhaoData(_task, params) {
|
|
40525
|
+
try {
|
|
40526
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40527
|
+
if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
|
|
40528
|
+
const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
40529
|
+
const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
40530
|
+
const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
40531
|
+
const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
40532
|
+
const headers = {
|
|
40533
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40534
|
+
referer: "https://channels.weixin.qq.com/platform",
|
|
40535
|
+
origin: "https://channels.weixin.qq.com",
|
|
40536
|
+
"content-type": "application/json",
|
|
40537
|
+
"X-WECHAT-UIN": uinCookie,
|
|
40538
|
+
...deviceIdCookie ? {
|
|
40539
|
+
"finger-print-device-id": deviceIdCookie
|
|
40540
|
+
} : {}
|
|
40541
|
+
};
|
|
40542
|
+
const args = [
|
|
40543
|
+
{
|
|
40544
|
+
headers
|
|
40545
|
+
},
|
|
40546
|
+
_task.logger,
|
|
40547
|
+
params.proxyLoc,
|
|
40548
|
+
params.accountId
|
|
40549
|
+
];
|
|
40550
|
+
const http = new Http(...args);
|
|
40551
|
+
const authData = await http.api({
|
|
40552
|
+
method: "post",
|
|
40553
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
40554
|
+
params: {
|
|
40555
|
+
_aid: aid,
|
|
40556
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
40557
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
40558
|
+
},
|
|
40559
|
+
data: {
|
|
40560
|
+
timestamp: Date.now().toString(),
|
|
40561
|
+
_log_finder_uin: "",
|
|
40562
|
+
_log_finder_id: finderId,
|
|
40563
|
+
rawKeyBuff: "",
|
|
40564
|
+
pluginSessionId: null,
|
|
40565
|
+
scene: 7,
|
|
40566
|
+
reqScene: 7
|
|
40567
|
+
}
|
|
40568
|
+
}, {
|
|
40569
|
+
retries: 3,
|
|
40570
|
+
retryDelay: 100,
|
|
40571
|
+
timeout: 5000
|
|
40572
|
+
});
|
|
40573
|
+
const AUTH_ERROR_CODES = [
|
|
40574
|
+
300333,
|
|
40575
|
+
300334,
|
|
40576
|
+
300330,
|
|
40577
|
+
300331,
|
|
40578
|
+
300332
|
|
40579
|
+
];
|
|
40580
|
+
if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
|
|
40581
|
+
_task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
|
|
40582
|
+
return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
|
|
40583
|
+
}
|
|
40584
|
+
if (authData.errCode) {
|
|
40585
|
+
_task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
|
|
40586
|
+
return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
|
|
40587
|
+
}
|
|
40588
|
+
const finderUser = authData.data?.finderUser;
|
|
40589
|
+
const now = new Date();
|
|
40590
|
+
const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
|
|
40591
|
+
const startTs = Math.floor(yesterday.getTime() / 1000);
|
|
40592
|
+
const endTs = startTs + 86400;
|
|
40593
|
+
_task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
|
|
40594
|
+
let fansNumYesterday = 0;
|
|
40595
|
+
let playNumYesterday = 0;
|
|
40596
|
+
let likeNumYesterday = 0;
|
|
40597
|
+
let commentNumYesterday = 0;
|
|
40598
|
+
try {
|
|
40599
|
+
const statsData = await http.api({
|
|
40600
|
+
method: "post",
|
|
40601
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
|
|
40602
|
+
params: {
|
|
40603
|
+
_aid: aid,
|
|
40604
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
40605
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
40606
|
+
},
|
|
40607
|
+
data: {
|
|
40608
|
+
startTs: startTs.toString(),
|
|
40609
|
+
endTs: endTs.toString(),
|
|
40610
|
+
interval: 3,
|
|
40611
|
+
timestamp: Date.now().toString(),
|
|
40612
|
+
_log_finder_uin: "",
|
|
40613
|
+
_log_finder_id: finderId,
|
|
40614
|
+
rawKeyBuff: "",
|
|
40615
|
+
pluginSessionId: null,
|
|
40616
|
+
scene: 7,
|
|
40617
|
+
reqScene: 7
|
|
40618
|
+
}
|
|
40619
|
+
}, {
|
|
40620
|
+
retries: 3,
|
|
40621
|
+
retryDelay: 100,
|
|
40622
|
+
timeout: 5000
|
|
40623
|
+
});
|
|
40624
|
+
if (!statsData.errCode && statsData.data?.totalData) {
|
|
40625
|
+
const data = statsData.data.totalData;
|
|
40626
|
+
fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
|
|
40627
|
+
playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
|
|
40628
|
+
likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
|
|
40629
|
+
commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
|
|
40630
|
+
}
|
|
40631
|
+
} catch (error) {
|
|
40632
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40633
|
+
_task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
|
|
40634
|
+
}
|
|
40635
|
+
const shipinhaoData = {
|
|
40636
|
+
fansNum: finderUser?.fansCount || 0,
|
|
40637
|
+
feedsCount: finderUser?.feedsCount || 0,
|
|
40638
|
+
fansNumYesterday,
|
|
40639
|
+
playNumYesterday,
|
|
40640
|
+
likeNumYesterday,
|
|
40641
|
+
commentNumYesterday
|
|
40642
|
+
};
|
|
40643
|
+
return success(shipinhaoData, "视频号平台数据获取成功!");
|
|
40644
|
+
} catch (error) {
|
|
40645
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40646
|
+
const err = error;
|
|
40647
|
+
_task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
|
|
40648
|
+
return types_errorResponse(err.message, err.code);
|
|
40649
|
+
}
|
|
40650
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40651
|
+
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
40652
|
+
return types_errorResponse(errMsg || "视频号账号数据获取失败");
|
|
40653
|
+
}
|
|
40654
|
+
}
|
|
40435
40655
|
async function getToutiaoData(_task, params) {
|
|
40436
40656
|
const http = new Http({
|
|
40437
40657
|
headers: {
|
|
@@ -40530,7 +40750,7 @@ var __webpack_exports__ = {};
|
|
|
40530
40750
|
userInfoHtmlPromise,
|
|
40531
40751
|
userSummaryHtmlPromise
|
|
40532
40752
|
]);
|
|
40533
|
-
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("
|
|
40753
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
40534
40754
|
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
40535
40755
|
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
40536
40756
|
const wxData = {
|
|
@@ -40555,7 +40775,6 @@ var __webpack_exports__ = {};
|
|
|
40555
40775
|
},
|
|
40556
40776
|
_task.logger,
|
|
40557
40777
|
params.proxyLoc,
|
|
40558
|
-
params.localIP,
|
|
40559
40778
|
params.accountId
|
|
40560
40779
|
];
|
|
40561
40780
|
const http = new Http(...args);
|
|
@@ -40607,7 +40826,9 @@ var __webpack_exports__ = {};
|
|
|
40607
40826
|
"toutiao",
|
|
40608
40827
|
"xiaohongshu",
|
|
40609
40828
|
"weixin",
|
|
40610
|
-
"baijiahao"
|
|
40829
|
+
"baijiahao",
|
|
40830
|
+
"douyin",
|
|
40831
|
+
"shipinhao"
|
|
40611
40832
|
])
|
|
40612
40833
|
});
|
|
40613
40834
|
const SearchAccountInfo = async (_task, params)=>{
|
|
@@ -40621,6 +40842,10 @@ var __webpack_exports__ = {};
|
|
|
40621
40842
|
return getWeixinData(_task, params);
|
|
40622
40843
|
case "baijiahao":
|
|
40623
40844
|
return getBaijiahaoData(_task, params);
|
|
40845
|
+
case "douyin":
|
|
40846
|
+
return getDouyinData(_task, params);
|
|
40847
|
+
case "shipinhao":
|
|
40848
|
+
return getShipinhaoData(_task, params);
|
|
40624
40849
|
default:
|
|
40625
40850
|
return success(null, "暂不支持该平台");
|
|
40626
40851
|
}
|
|
@@ -40715,18 +40940,45 @@ var __webpack_exports__ = {};
|
|
|
40715
40940
|
collectNum: classic_schemas_number(),
|
|
40716
40941
|
shareNum: classic_schemas_number()
|
|
40717
40942
|
});
|
|
40943
|
+
const DouyinArticleSchema = BaseArticleSchema.extend({
|
|
40944
|
+
playNum: classic_schemas_number(),
|
|
40945
|
+
likeNum: classic_schemas_number(),
|
|
40946
|
+
commentNum: classic_schemas_number(),
|
|
40947
|
+
shareNum: classic_schemas_number(),
|
|
40948
|
+
collectNum: classic_schemas_number(),
|
|
40949
|
+
awemeId: classic_schemas_string(),
|
|
40950
|
+
awemeType: classic_schemas_number(),
|
|
40951
|
+
duration: classic_schemas_number().optional(),
|
|
40952
|
+
status: classic_schemas_string(),
|
|
40953
|
+
publicUrl: classic_schemas_string()
|
|
40954
|
+
});
|
|
40955
|
+
const ShipinhaoArticleSchema = BaseArticleSchema.extend({
|
|
40956
|
+
readNum: classic_schemas_number(),
|
|
40957
|
+
likeNum: classic_schemas_number(),
|
|
40958
|
+
commentNum: classic_schemas_number(),
|
|
40959
|
+
forwardNum: classic_schemas_number(),
|
|
40960
|
+
favNum: classic_schemas_number(),
|
|
40961
|
+
objectId: classic_schemas_string(),
|
|
40962
|
+
postType: classic_schemas_string(),
|
|
40963
|
+
postStatus: classic_schemas_number(),
|
|
40964
|
+
effectiveTime: classic_schemas_number().optional()
|
|
40965
|
+
});
|
|
40718
40966
|
const FetchArticlesDataSchema = classic_schemas_object({
|
|
40719
40967
|
articleCell: classic_schemas_array(schemas_union([
|
|
40720
40968
|
ToutiaoArticleSchema,
|
|
40721
40969
|
WeixinArticleSchema,
|
|
40722
40970
|
BaijiahaoArticleSchema,
|
|
40723
|
-
XiaohongshuArticleSchema
|
|
40971
|
+
XiaohongshuArticleSchema,
|
|
40972
|
+
DouyinArticleSchema,
|
|
40973
|
+
ShipinhaoArticleSchema
|
|
40724
40974
|
])).optional(),
|
|
40725
40975
|
timerPublish: classic_schemas_array(schemas_union([
|
|
40726
40976
|
ToutiaoArticleSchema,
|
|
40727
40977
|
WeixinArticleSchema,
|
|
40728
40978
|
BaijiahaoArticleSchema,
|
|
40729
|
-
XiaohongshuArticleSchema
|
|
40979
|
+
XiaohongshuArticleSchema,
|
|
40980
|
+
DouyinArticleSchema,
|
|
40981
|
+
ShipinhaoArticleSchema
|
|
40730
40982
|
])).optional(),
|
|
40731
40983
|
pagination: classic_schemas_object({
|
|
40732
40984
|
total: classic_schemas_number().optional(),
|
|
@@ -40841,6 +41093,267 @@ var __webpack_exports__ = {};
|
|
|
40841
41093
|
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
40842
41094
|
}
|
|
40843
41095
|
}
|
|
41096
|
+
async function handleDouyinData(_task, params) {
|
|
41097
|
+
try {
|
|
41098
|
+
const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
|
|
41099
|
+
const pageNum = params.pageNum || 1;
|
|
41100
|
+
const headers = {
|
|
41101
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
41102
|
+
referer: "https://creator.douyin.com"
|
|
41103
|
+
};
|
|
41104
|
+
const args = [
|
|
41105
|
+
{
|
|
41106
|
+
headers
|
|
41107
|
+
},
|
|
41108
|
+
_task.logger,
|
|
41109
|
+
params.proxyLoc,
|
|
41110
|
+
params.accountId
|
|
41111
|
+
];
|
|
41112
|
+
const http = new Http(...args);
|
|
41113
|
+
async function fetchWorks(cursor) {
|
|
41114
|
+
return await http.api({
|
|
41115
|
+
method: "get",
|
|
41116
|
+
url: "https://creator.douyin.com/janus/douyin/creator/pc/work_list",
|
|
41117
|
+
params: {
|
|
41118
|
+
scene: "star_atlas",
|
|
41119
|
+
device_platform: "android",
|
|
41120
|
+
aid: 1128,
|
|
41121
|
+
status,
|
|
41122
|
+
count: pageSize,
|
|
41123
|
+
max_cursor: cursor
|
|
41124
|
+
}
|
|
41125
|
+
}, {
|
|
41126
|
+
retries: 3,
|
|
41127
|
+
retryDelay: 100,
|
|
41128
|
+
timeout: 5000
|
|
41129
|
+
});
|
|
41130
|
+
}
|
|
41131
|
+
const isHasMore = (v)=>true === v || 1 === v;
|
|
41132
|
+
const skipCount = (pageNum - 1) * pageSize;
|
|
41133
|
+
const needCount = skipCount + pageSize;
|
|
41134
|
+
const workListResponse = await fetchWorks(0);
|
|
41135
|
+
if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
|
|
41136
|
+
const allWorks = [
|
|
41137
|
+
...workListResponse.aweme_list
|
|
41138
|
+
];
|
|
41139
|
+
let hasMore = isHasMore(workListResponse.has_more);
|
|
41140
|
+
let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
|
|
41141
|
+
let guard = 0;
|
|
41142
|
+
while(allWorks.length < needCount && hasMore && guard < 20){
|
|
41143
|
+
const nextPageResponse = await fetchWorks(currentCursor);
|
|
41144
|
+
if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
|
|
41145
|
+
allWorks.push(...nextPageResponse.aweme_list);
|
|
41146
|
+
hasMore = isHasMore(nextPageResponse.has_more);
|
|
41147
|
+
currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
|
|
41148
|
+
guard++;
|
|
41149
|
+
}
|
|
41150
|
+
const finalWorks = allWorks.slice(skipCount, needCount);
|
|
41151
|
+
const articleCell = finalWorks.map((item)=>{
|
|
41152
|
+
const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
|
|
41153
|
+
const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
|
|
41154
|
+
let statusText;
|
|
41155
|
+
statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
|
|
41156
|
+
return {
|
|
41157
|
+
title: item.desc || "无作品描述",
|
|
41158
|
+
imageUrl: item.Cover?.url_list?.[0] || "",
|
|
41159
|
+
createTime: item.create_time,
|
|
41160
|
+
redirectUrl: workDetailUrl,
|
|
41161
|
+
playNum: item.statistics?.play_count || 0,
|
|
41162
|
+
likeNum: item.statistics?.digg_count || 0,
|
|
41163
|
+
commentNum: item.statistics?.comment_count || 0,
|
|
41164
|
+
shareNum: item.statistics?.share_count || 0,
|
|
41165
|
+
collectNum: item.statistics?.collect_count || 0,
|
|
41166
|
+
awemeId: item.aweme_id,
|
|
41167
|
+
awemeType: item.aweme_type ?? 0,
|
|
41168
|
+
duration: item.duration,
|
|
41169
|
+
status: statusText,
|
|
41170
|
+
publicUrl: workPublicUrl,
|
|
41171
|
+
...showOriginalData ? {
|
|
41172
|
+
originalData: item
|
|
41173
|
+
} : {}
|
|
41174
|
+
};
|
|
41175
|
+
});
|
|
41176
|
+
return success({
|
|
41177
|
+
articleCell,
|
|
41178
|
+
...onlySuccess ? {
|
|
41179
|
+
pagination: {
|
|
41180
|
+
total: workListResponse.total || allWorks.length,
|
|
41181
|
+
nextPage: hasMore,
|
|
41182
|
+
pageNum,
|
|
41183
|
+
pageSize
|
|
41184
|
+
}
|
|
41185
|
+
} : null
|
|
41186
|
+
}, "抖音数据获取成功");
|
|
41187
|
+
} catch (error) {
|
|
41188
|
+
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
|
|
41189
|
+
}
|
|
41190
|
+
}
|
|
41191
|
+
async function handleShipinhaoData(_task, params) {
|
|
41192
|
+
try {
|
|
41193
|
+
const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
|
|
41194
|
+
const pageNum = params.pageNum || 1;
|
|
41195
|
+
const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
|
|
41196
|
+
const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
41197
|
+
const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
41198
|
+
const deviceIdCookie = cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
41199
|
+
const headers = {
|
|
41200
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
41201
|
+
referer: "https://channels.weixin.qq.com",
|
|
41202
|
+
origin: "https://channels.weixin.qq.com",
|
|
41203
|
+
"content-type": "application/json",
|
|
41204
|
+
"X-WECHAT-UIN": uinCookie,
|
|
41205
|
+
...deviceIdCookie ? {
|
|
41206
|
+
"finger-print-device-id": deviceIdCookie
|
|
41207
|
+
} : {}
|
|
41208
|
+
};
|
|
41209
|
+
const args = [
|
|
41210
|
+
{
|
|
41211
|
+
headers
|
|
41212
|
+
},
|
|
41213
|
+
_task.logger,
|
|
41214
|
+
params.proxyLoc,
|
|
41215
|
+
params.accountId
|
|
41216
|
+
];
|
|
41217
|
+
const http = new Http(...args);
|
|
41218
|
+
const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
41219
|
+
async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
|
|
41220
|
+
return await http.api({
|
|
41221
|
+
method: "post",
|
|
41222
|
+
url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
|
|
41223
|
+
params: {
|
|
41224
|
+
_aid: aid,
|
|
41225
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
41226
|
+
_pageUrl: encodeURIComponent(pageUrl)
|
|
41227
|
+
},
|
|
41228
|
+
data: {
|
|
41229
|
+
pageSize,
|
|
41230
|
+
currentPage,
|
|
41231
|
+
userpageType,
|
|
41232
|
+
stickyOrder: true,
|
|
41233
|
+
timestamp: Date.now().toString(),
|
|
41234
|
+
_log_finder_uin: "",
|
|
41235
|
+
_log_finder_id: finderIdCookie,
|
|
41236
|
+
rawKeyBuff,
|
|
41237
|
+
pluginSessionId: null,
|
|
41238
|
+
scene: 7,
|
|
41239
|
+
reqScene: 7
|
|
41240
|
+
}
|
|
41241
|
+
}, {
|
|
41242
|
+
retries: 3,
|
|
41243
|
+
retryDelay: 100,
|
|
41244
|
+
timeout: 5000
|
|
41245
|
+
});
|
|
41246
|
+
}
|
|
41247
|
+
async function fetchAllPosts(userpageType, pageUrl) {
|
|
41248
|
+
const allPosts = [];
|
|
41249
|
+
let currentPage = 1;
|
|
41250
|
+
let rawKeyBuff = "";
|
|
41251
|
+
let continueFlag = true;
|
|
41252
|
+
let totalCount = 0;
|
|
41253
|
+
while(continueFlag){
|
|
41254
|
+
const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
|
|
41255
|
+
if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
|
|
41256
|
+
if (response.errCode) {
|
|
41257
|
+
_task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
|
|
41258
|
+
throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
|
|
41259
|
+
}
|
|
41260
|
+
if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
|
|
41261
|
+
const posts = response.data?.list || response.posts || response.post_list || [];
|
|
41262
|
+
allPosts.push(...posts);
|
|
41263
|
+
continueFlag = response.data?.continueFlag ?? false;
|
|
41264
|
+
rawKeyBuff = response.data?.lastBuff || "";
|
|
41265
|
+
currentPage++;
|
|
41266
|
+
if (currentPage > 100) {
|
|
41267
|
+
_task.logger.warn("分页超过100页,停止请求");
|
|
41268
|
+
break;
|
|
41269
|
+
}
|
|
41270
|
+
}
|
|
41271
|
+
if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
|
|
41272
|
+
return {
|
|
41273
|
+
posts: allPosts,
|
|
41274
|
+
totalCount
|
|
41275
|
+
};
|
|
41276
|
+
}
|
|
41277
|
+
const mapPost = (item, forcePostType)=>{
|
|
41278
|
+
let imageUrl = "";
|
|
41279
|
+
if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
|
|
41280
|
+
else if (item.desc?.media?.[0]?.coverUrl) imageUrl = item.desc.media[0].coverUrl;
|
|
41281
|
+
else if (item.cover?.url) imageUrl = item.cover.url;
|
|
41282
|
+
else if (item.media_url) imageUrl = item.media_url;
|
|
41283
|
+
const title = item.desc?.description || item.object_desc || "无标题";
|
|
41284
|
+
return {
|
|
41285
|
+
title,
|
|
41286
|
+
imageUrl,
|
|
41287
|
+
createTime: item.createTime || item.create_time,
|
|
41288
|
+
redirectUrl: "https://channels.weixin.qq.com/platform",
|
|
41289
|
+
readNum: item.readCount || item.read_count || 0,
|
|
41290
|
+
likeNum: item.likeCount || item.like_count || 0,
|
|
41291
|
+
commentNum: item.commentCount || item.comment_count || 0,
|
|
41292
|
+
forwardNum: item.forwardCount || item.forward_count || 0,
|
|
41293
|
+
favNum: item.favCount || item.fav_count || 0,
|
|
41294
|
+
objectId: item.exportId || item.objectId || "",
|
|
41295
|
+
postType: forcePostType,
|
|
41296
|
+
postStatus: item.status || item.post_status || 0,
|
|
41297
|
+
...item.effectiveTime ? {
|
|
41298
|
+
effectiveTime: item.effectiveTime
|
|
41299
|
+
} : {},
|
|
41300
|
+
...showOriginalData ? {
|
|
41301
|
+
originalData: item
|
|
41302
|
+
} : {}
|
|
41303
|
+
};
|
|
41304
|
+
};
|
|
41305
|
+
const allArticles = [];
|
|
41306
|
+
const needVideo = "all" === postType || "video" === postType;
|
|
41307
|
+
const needArticle = "all" === postType || "article" === postType;
|
|
41308
|
+
const AUTH_ERROR_CODES = [
|
|
41309
|
+
300333,
|
|
41310
|
+
300334,
|
|
41311
|
+
300330,
|
|
41312
|
+
300331,
|
|
41313
|
+
300332
|
|
41314
|
+
];
|
|
41315
|
+
let combinedTotal = 0;
|
|
41316
|
+
if (needVideo) try {
|
|
41317
|
+
const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
|
|
41318
|
+
const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
|
|
41319
|
+
const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
|
|
41320
|
+
allArticles.push(...videoArticles);
|
|
41321
|
+
combinedTotal += totalCount || videoArticles.length;
|
|
41322
|
+
} catch (error) {
|
|
41323
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
41324
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
41325
|
+
_task.logger.warn(`获取视频号视频失败:${errMsg}`);
|
|
41326
|
+
}
|
|
41327
|
+
if (needArticle) try {
|
|
41328
|
+
const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
|
|
41329
|
+
const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
|
|
41330
|
+
const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
|
|
41331
|
+
allArticles.push(...articleArticles);
|
|
41332
|
+
combinedTotal += totalCount || articleArticles.length;
|
|
41333
|
+
} catch (error) {
|
|
41334
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
41335
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
41336
|
+
_task.logger.warn(`获取视频号图文失败:${errMsg}`);
|
|
41337
|
+
}
|
|
41338
|
+
allArticles.sort((a, b)=>b.createTime - a.createTime);
|
|
41339
|
+
const total = allArticles.length;
|
|
41340
|
+
const start = (pageNum - 1) * pageSize;
|
|
41341
|
+
const pageItems = allArticles.slice(start, start + pageSize);
|
|
41342
|
+
return success({
|
|
41343
|
+
articleCell: pageItems,
|
|
41344
|
+
pagination: {
|
|
41345
|
+
total,
|
|
41346
|
+
nextPage: start + pageSize < total,
|
|
41347
|
+
pageNum,
|
|
41348
|
+
pageSize
|
|
41349
|
+
}
|
|
41350
|
+
}, "视频号数据获取成功");
|
|
41351
|
+
} catch (error) {
|
|
41352
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
41353
|
+
if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
|
|
41354
|
+
return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
|
|
41355
|
+
}
|
|
41356
|
+
}
|
|
40844
41357
|
async function handleToutiaoData(_task, params) {
|
|
40845
41358
|
try {
|
|
40846
41359
|
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
|
|
@@ -40873,7 +41386,7 @@ var __webpack_exports__ = {};
|
|
|
40873
41386
|
app_id: 1231
|
|
40874
41387
|
}
|
|
40875
41388
|
});
|
|
40876
|
-
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("
|
|
41389
|
+
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号数据获取失败,请检查账号状态", 414);
|
|
40877
41390
|
const articleInfo = await http.api({
|
|
40878
41391
|
method: "get",
|
|
40879
41392
|
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
@@ -40982,7 +41495,7 @@ var __webpack_exports__ = {};
|
|
|
40982
41495
|
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
40983
41496
|
let begin = (lastPage ?? pageNum) - 1;
|
|
40984
41497
|
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
40985
|
-
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("
|
|
41498
|
+
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
40986
41499
|
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
40987
41500
|
let articleCell = [];
|
|
40988
41501
|
if (!onlySuccess && pageSize > 20) {
|
|
@@ -41144,7 +41657,7 @@ var __webpack_exports__ = {};
|
|
|
41144
41657
|
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
41145
41658
|
if (!a1Cookie) return {
|
|
41146
41659
|
code: 414,
|
|
41147
|
-
message: "
|
|
41660
|
+
message: "小红书数据获取失败,请检查账号状态",
|
|
41148
41661
|
data: {}
|
|
41149
41662
|
};
|
|
41150
41663
|
if (onlySuccess && 10 !== pageSize) return {
|
|
@@ -41163,7 +41676,6 @@ var __webpack_exports__ = {};
|
|
|
41163
41676
|
},
|
|
41164
41677
|
_task.logger,
|
|
41165
41678
|
params.proxyLoc,
|
|
41166
|
-
params.localIP,
|
|
41167
41679
|
params.accountId
|
|
41168
41680
|
];
|
|
41169
41681
|
const http = new Http(...args);
|
|
@@ -41263,7 +41775,7 @@ var __webpack_exports__ = {};
|
|
|
41263
41775
|
}, "小红书文章数据获取成功");
|
|
41264
41776
|
}
|
|
41265
41777
|
const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
41266
|
-
platform: classic_schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
|
|
41778
|
+
platform: classic_schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu, douyin, shipinhao"),
|
|
41267
41779
|
token: schemas_union([
|
|
41268
41780
|
classic_schemas_string(),
|
|
41269
41781
|
classic_schemas_number()
|
|
@@ -41275,7 +41787,14 @@ var __webpack_exports__ = {};
|
|
|
41275
41787
|
showOriginalData: classic_schemas_boolean().optional().describe("是否展示原始数据,默认false"),
|
|
41276
41788
|
cursor: classic_schemas_number().optional().describe("仅用于微信分页游标,默认为空"),
|
|
41277
41789
|
lastPage: classic_schemas_number().optional(),
|
|
41278
|
-
containsArticle: classic_schemas_boolean().optional().describe("是否包含文章内容,默认false")
|
|
41790
|
+
containsArticle: classic_schemas_boolean().optional().describe("是否包含文章内容,默认false"),
|
|
41791
|
+
status: classic_schemas_number().optional().describe("抖音作品状态:0=全部"),
|
|
41792
|
+
includeAccount: classic_schemas_boolean().optional().describe("是否包含账号数据,默认true"),
|
|
41793
|
+
postType: classic_schemas_enum([
|
|
41794
|
+
"video",
|
|
41795
|
+
"article",
|
|
41796
|
+
"all"
|
|
41797
|
+
]).optional().describe("视频号作品类型:video=视频, article=图文, all=全部")
|
|
41279
41798
|
});
|
|
41280
41799
|
const FetchArticles = async (_task, params)=>{
|
|
41281
41800
|
const { platform } = params;
|
|
@@ -41288,6 +41807,10 @@ var __webpack_exports__ = {};
|
|
|
41288
41807
|
return handleBaijiahaoData(_task, params);
|
|
41289
41808
|
case "xiaohongshu":
|
|
41290
41809
|
return handleXiaohongshuData(_task, params);
|
|
41810
|
+
case "douyin":
|
|
41811
|
+
return handleDouyinData(_task, params);
|
|
41812
|
+
case "shipinhao":
|
|
41813
|
+
return handleShipinhaoData(_task, params);
|
|
41291
41814
|
default:
|
|
41292
41815
|
return success({}, "暂不支持该平台");
|
|
41293
41816
|
}
|
|
@@ -41483,7 +42006,6 @@ var __webpack_exports__ = {};
|
|
|
41483
42006
|
},
|
|
41484
42007
|
_task.logger,
|
|
41485
42008
|
params.proxyLoc,
|
|
41486
|
-
params.localIP,
|
|
41487
42009
|
params.accountId
|
|
41488
42010
|
];
|
|
41489
42011
|
const http = new Http(...args);
|
|
@@ -41536,7 +42058,6 @@ var __webpack_exports__ = {};
|
|
|
41536
42058
|
},
|
|
41537
42059
|
_task.logger,
|
|
41538
42060
|
params.proxyLoc,
|
|
41539
|
-
params.localIP,
|
|
41540
42061
|
params.accountId
|
|
41541
42062
|
];
|
|
41542
42063
|
const http = new Http(...args);
|
|
@@ -41589,7 +42110,6 @@ var __webpack_exports__ = {};
|
|
|
41589
42110
|
},
|
|
41590
42111
|
_task.logger,
|
|
41591
42112
|
params.proxyLoc,
|
|
41592
|
-
params.localIP,
|
|
41593
42113
|
params.accountId
|
|
41594
42114
|
];
|
|
41595
42115
|
const http = new Http(...args);
|
|
@@ -41636,7 +42156,6 @@ var __webpack_exports__ = {};
|
|
|
41636
42156
|
},
|
|
41637
42157
|
_task.logger,
|
|
41638
42158
|
params.proxyLoc,
|
|
41639
|
-
params.localIP,
|
|
41640
42159
|
params.accountId
|
|
41641
42160
|
];
|
|
41642
42161
|
const http = new Http(...args);
|
|
@@ -41675,7 +42194,6 @@ var __webpack_exports__ = {};
|
|
|
41675
42194
|
},
|
|
41676
42195
|
_task.logger,
|
|
41677
42196
|
params.proxyLoc,
|
|
41678
|
-
params.localIP,
|
|
41679
42197
|
params.accountId
|
|
41680
42198
|
];
|
|
41681
42199
|
const http = new Http(...args);
|
|
@@ -41737,7 +42255,6 @@ var __webpack_exports__ = {};
|
|
|
41737
42255
|
},
|
|
41738
42256
|
_task.logger,
|
|
41739
42257
|
params.proxyLoc,
|
|
41740
|
-
params.localIP,
|
|
41741
42258
|
params.accountId
|
|
41742
42259
|
];
|
|
41743
42260
|
const http = new Http(...args);
|
|
@@ -41794,7 +42311,6 @@ var __webpack_exports__ = {};
|
|
|
41794
42311
|
},
|
|
41795
42312
|
_task.logger,
|
|
41796
42313
|
params.proxyLoc,
|
|
41797
|
-
params.localIP,
|
|
41798
42314
|
params.accountId
|
|
41799
42315
|
];
|
|
41800
42316
|
const http = new Http(...args);
|
|
@@ -41880,7 +42396,6 @@ var __webpack_exports__ = {};
|
|
|
41880
42396
|
},
|
|
41881
42397
|
_task.logger,
|
|
41882
42398
|
params.proxyLoc,
|
|
41883
|
-
params.localIP,
|
|
41884
42399
|
params.accountId
|
|
41885
42400
|
];
|
|
41886
42401
|
const http = new Http(...args);
|
|
@@ -41968,7 +42483,6 @@ var __webpack_exports__ = {};
|
|
|
41968
42483
|
},
|
|
41969
42484
|
_task.logger,
|
|
41970
42485
|
params.proxyLoc,
|
|
41971
|
-
params.localIP,
|
|
41972
42486
|
params.accountId
|
|
41973
42487
|
];
|
|
41974
42488
|
const http = new Http(...args);
|
|
@@ -42078,7 +42592,6 @@ var __webpack_exports__ = {};
|
|
|
42078
42592
|
},
|
|
42079
42593
|
_task.logger,
|
|
42080
42594
|
params.proxyLoc,
|
|
42081
|
-
params.localIP,
|
|
42082
42595
|
params.accountId
|
|
42083
42596
|
];
|
|
42084
42597
|
const http = new Http(...args);
|
|
@@ -42356,16 +42869,11 @@ var __webpack_exports__ = {};
|
|
|
42356
42869
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
42357
42870
|
let executionState;
|
|
42358
42871
|
let proxyUrl;
|
|
42359
|
-
if (params.
|
|
42360
|
-
|
|
42361
|
-
params.localIP,
|
|
42362
|
-
params.proxyLoc,
|
|
42363
|
-
params.accountId
|
|
42364
|
-
];
|
|
42365
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
42872
|
+
if (params.proxyLoc) {
|
|
42873
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
42366
42874
|
const ProxyAgentResult = await ProxyAgent({
|
|
42367
42875
|
logger: task.logger
|
|
42368
|
-
},
|
|
42876
|
+
}, params.proxyLoc, params.accountId);
|
|
42369
42877
|
task.logger?.info("==> 代理信息获取成功!");
|
|
42370
42878
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
42371
42879
|
}
|
|
@@ -42691,6 +43199,11 @@ var __webpack_exports__ = {};
|
|
|
42691
43199
|
this.concurrentLimit = config.concurrentLimit || 4;
|
|
42692
43200
|
this.singleFileSize = config.singleFileSize || 10485760;
|
|
42693
43201
|
this.http = config.http || new Http();
|
|
43202
|
+
this.reqOptions = {
|
|
43203
|
+
timeout: config.timeout ?? 60000,
|
|
43204
|
+
retries: config.retries ?? 3,
|
|
43205
|
+
retryDelay: config.retryDelay ?? 2000
|
|
43206
|
+
};
|
|
42694
43207
|
}
|
|
42695
43208
|
calculateMd5(buffer) {
|
|
42696
43209
|
const MAX_SIZE = 5242880;
|
|
@@ -42747,7 +43260,7 @@ var __webpack_exports__ = {};
|
|
|
42747
43260
|
url: filePath,
|
|
42748
43261
|
method: "get",
|
|
42749
43262
|
responseType: "arraybuffer"
|
|
42750
|
-
});
|
|
43263
|
+
}, this.reqOptions);
|
|
42751
43264
|
return Buffer.from(resp);
|
|
42752
43265
|
}
|
|
42753
43266
|
return external_node_fs_default().promises.readFile(filePath);
|
|
@@ -42777,7 +43290,7 @@ var __webpack_exports__ = {};
|
|
|
42777
43290
|
headers,
|
|
42778
43291
|
data: requestBody,
|
|
42779
43292
|
defaultErrorMsg: "获取UploadID失败"
|
|
42780
|
-
});
|
|
43293
|
+
}, this.reqOptions);
|
|
42781
43294
|
if (!resp?.UploadID) throw new Error(`获取 UploadID 失败: ${resp?.errMsg || "未知错误"}`);
|
|
42782
43295
|
return resp.UploadID;
|
|
42783
43296
|
}
|
|
@@ -42798,7 +43311,7 @@ var __webpack_exports__ = {};
|
|
|
42798
43311
|
headers,
|
|
42799
43312
|
data: chunk,
|
|
42800
43313
|
defaultErrorMsg: `分片 ${partNumber} 上传失败`
|
|
42801
|
-
});
|
|
43314
|
+
}, this.reqOptions);
|
|
42802
43315
|
if (resp?.errCode !== void 0 && 0 !== resp.errCode) throw new Error(`分片 ${partNumber} 上传失败: ${resp.errMsg}`);
|
|
42803
43316
|
if (onProgress) onProgress(chunk.length);
|
|
42804
43317
|
return resp.ETag || "";
|
|
@@ -42822,7 +43335,7 @@ var __webpack_exports__ = {};
|
|
|
42822
43335
|
headers,
|
|
42823
43336
|
data: requestBody,
|
|
42824
43337
|
defaultErrorMsg: "确认分片上传失败"
|
|
42825
|
-
});
|
|
43338
|
+
}, this.reqOptions);
|
|
42826
43339
|
if (resp?.ListPartsResult?.Part) return resp.ListPartsResult.Part.map((p)=>({
|
|
42827
43340
|
PartNumber: parseInt(p.PartNumber),
|
|
42828
43341
|
ETag: p.ETag
|
|
@@ -42848,7 +43361,7 @@ var __webpack_exports__ = {};
|
|
|
42848
43361
|
headers,
|
|
42849
43362
|
data: requestBody,
|
|
42850
43363
|
defaultErrorMsg: "完成上传失败"
|
|
42851
|
-
});
|
|
43364
|
+
}, this.reqOptions);
|
|
42852
43365
|
if (!resp?.DownloadURL) throw new Error(`完成上传失败: ${resp?.errMsg || "未知错误"}`);
|
|
42853
43366
|
return resp.DownloadURL;
|
|
42854
43367
|
}
|
|
@@ -43187,7 +43700,6 @@ var __webpack_exports__ = {};
|
|
|
43187
43700
|
enverionment: confParams.enverionment || "development",
|
|
43188
43701
|
postId: confParams.articleId,
|
|
43189
43702
|
eip: proxyHttp.proxyInfo,
|
|
43190
|
-
proxyIp: confParams.proxyIp,
|
|
43191
43703
|
accountId: confParams.accountId,
|
|
43192
43704
|
uid: confParams.uid,
|
|
43193
43705
|
publishParams: publishData,
|
|
@@ -43199,7 +43711,9 @@ var __webpack_exports__ = {};
|
|
|
43199
43711
|
task.logger.info("[shipinhaoPublish] 开始执行视频号发布 - Mock API 方式");
|
|
43200
43712
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
43201
43713
|
if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId) return utils_response(400, "fingerPrintDeviceId和aId 不能为空", "");
|
|
43714
|
+
let currentStep = "初始化";
|
|
43202
43715
|
try {
|
|
43716
|
+
currentStep = "解析认证信息";
|
|
43203
43717
|
const cookieString = params.cookies.map((c)=>`${c.name}=${c.value}`).join("; ");
|
|
43204
43718
|
const fingerPrintDeviceId = params.extraParam.fingerPrintDeviceId;
|
|
43205
43719
|
const aId = params.extraParam.aId;
|
|
@@ -43212,7 +43726,6 @@ var __webpack_exports__ = {};
|
|
|
43212
43726
|
},
|
|
43213
43727
|
task.logger,
|
|
43214
43728
|
params.proxyLoc,
|
|
43215
|
-
params.localIP,
|
|
43216
43729
|
params.accountId,
|
|
43217
43730
|
"shipinhao"
|
|
43218
43731
|
];
|
|
@@ -43220,8 +43733,10 @@ var __webpack_exports__ = {};
|
|
|
43220
43733
|
headers
|
|
43221
43734
|
});
|
|
43222
43735
|
const proxyHttp = new Http(...args);
|
|
43736
|
+
currentStep = "验证发布参数";
|
|
43223
43737
|
if (!params.banners || 0 === params.banners.length) return utils_response(400, "至少需要一张图片", "");
|
|
43224
43738
|
const images = params.banners.slice(0, 18).filter((img)=>"string" == typeof img);
|
|
43739
|
+
currentStep = "获取用户信息";
|
|
43225
43740
|
task.logger.info("[shipinhaoPublish] 获取用户信息...");
|
|
43226
43741
|
console.log("cookieString", cookieString);
|
|
43227
43742
|
const userInfo = await mock_getUserInfo(cookieString, http);
|
|
@@ -43232,6 +43747,7 @@ var __webpack_exports__ = {};
|
|
|
43232
43747
|
}
|
|
43233
43748
|
const finderUsername = userInfo.data.finderUser.finderUsername;
|
|
43234
43749
|
console.log(finderUsername);
|
|
43750
|
+
currentStep = "获取上传认证密钥";
|
|
43235
43751
|
task.logger.info("[shipinhaoPublish] 获取上传认证密钥...");
|
|
43236
43752
|
const authKeyResponse = await getUploadAuthKey(cookieString, finderUsername, http);
|
|
43237
43753
|
if (0 !== authKeyResponse.errCode || !authKeyResponse.data?.authKey) return utils_response(authKeyResponse.errCode || 500, `获取上传认证参数失败: ${authKeyResponse.errMsg}`, "");
|
|
@@ -43239,10 +43755,12 @@ var __webpack_exports__ = {};
|
|
|
43239
43755
|
const uin = authKeyResponse.data.uin;
|
|
43240
43756
|
if (!uin) return utils_response(500, "获取用户 uin 失败", "");
|
|
43241
43757
|
const taskId = String(generateUUID());
|
|
43758
|
+
currentStep = "上传图片";
|
|
43242
43759
|
task.logger.info(`[shipinhaoPublish] 开始上传 ${images.length} 张图片...`);
|
|
43243
43760
|
const uploadedImages = [];
|
|
43244
43761
|
for(let i = 0; i < images.length; i++){
|
|
43245
|
-
|
|
43762
|
+
currentStep = `上传图片 ${i + 1}/${images.length}`;
|
|
43763
|
+
task.logger.info(`[shipinhaoPublish] ${currentStep}...`);
|
|
43246
43764
|
const uploadResult = await uploadImageComplete(images[i], taskId, finderUsername, uin, authKey, http);
|
|
43247
43765
|
console.log(JSON.stringify(uploadResult));
|
|
43248
43766
|
if (!uploadResult.DownloadURL) return utils_response(500, `图片上传失败: ${uploadResult.errMsg}`, "");
|
|
@@ -43259,6 +43777,7 @@ var __webpack_exports__ = {};
|
|
|
43259
43777
|
urlCdnTaskId: ""
|
|
43260
43778
|
});
|
|
43261
43779
|
}
|
|
43780
|
+
currentStep = "发布图文内容";
|
|
43262
43781
|
task.logger.info("[shipinhaoPublish] 正在发布...");
|
|
43263
43782
|
const topicNames = params.topic || void 0;
|
|
43264
43783
|
const addressInfo = params.address ? {
|
|
@@ -43277,7 +43796,6 @@ var __webpack_exports__ = {};
|
|
|
43277
43796
|
articleId: params.articleId,
|
|
43278
43797
|
postId: params.articleId,
|
|
43279
43798
|
eip: proxyHttp.proxyInfo,
|
|
43280
|
-
proxyIp: params.localIP,
|
|
43281
43799
|
accountId: params.accountId,
|
|
43282
43800
|
uid: params.uid
|
|
43283
43801
|
}, {
|
|
@@ -43345,9 +43863,15 @@ var __webpack_exports__ = {};
|
|
|
43345
43863
|
});
|
|
43346
43864
|
return utils_response(resultCode || 500, errorMessage, "");
|
|
43347
43865
|
} catch (error) {
|
|
43348
|
-
const
|
|
43349
|
-
|
|
43350
|
-
|
|
43866
|
+
const handledError = Http.handleApiError(error);
|
|
43867
|
+
const errorMsg = handledError.message || "发布失败,请稍后重试";
|
|
43868
|
+
const errorCode = handledError.code || 500;
|
|
43869
|
+
task.logger.error(`[shipinhaoPublish] 发布流程异常: ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
43870
|
+
await updateTaskState?.({
|
|
43871
|
+
state: types_TaskState.FAILED,
|
|
43872
|
+
error: errorMsg
|
|
43873
|
+
});
|
|
43874
|
+
return utils_response(errorCode, errorMsg, "");
|
|
43351
43875
|
}
|
|
43352
43876
|
};
|
|
43353
43877
|
const shipinhaoPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -43658,16 +44182,11 @@ var __webpack_exports__ = {};
|
|
|
43658
44182
|
return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
43659
44183
|
}));
|
|
43660
44184
|
let proxyUrl;
|
|
43661
|
-
if (params.
|
|
43662
|
-
|
|
43663
|
-
params.localIP,
|
|
43664
|
-
params.proxyLoc,
|
|
43665
|
-
params.accountId
|
|
43666
|
-
];
|
|
43667
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
44185
|
+
if (params.proxyLoc) {
|
|
44186
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
43668
44187
|
const ProxyAgentResult = await ProxyAgent({
|
|
43669
44188
|
logger: task.logger
|
|
43670
|
-
},
|
|
44189
|
+
}, params.proxyLoc, params.accountId);
|
|
43671
44190
|
task.logger?.info("==> 代理信息获取成功!");
|
|
43672
44191
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
43673
44192
|
}
|
|
@@ -44317,16 +44836,11 @@ var __webpack_exports__ = {};
|
|
|
44317
44836
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
44318
44837
|
let executionState;
|
|
44319
44838
|
let proxyUrl;
|
|
44320
|
-
if (params.
|
|
44321
|
-
|
|
44322
|
-
params.localIP,
|
|
44323
|
-
params.proxyLoc,
|
|
44324
|
-
params.accountId
|
|
44325
|
-
];
|
|
44326
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
44839
|
+
if (params.proxyLoc) {
|
|
44840
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
44327
44841
|
const ProxyAgentResult = await ProxyAgent({
|
|
44328
44842
|
logger: task.logger
|
|
44329
|
-
},
|
|
44843
|
+
}, params.proxyLoc, params.accountId);
|
|
44330
44844
|
task.logger?.info("==> 代理信息获取成功!");
|
|
44331
44845
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
44332
44846
|
}
|
|
@@ -44577,7 +45091,6 @@ var __webpack_exports__ = {};
|
|
|
44577
45091
|
},
|
|
44578
45092
|
task.logger,
|
|
44579
45093
|
params.proxyLoc,
|
|
44580
|
-
params.localIP,
|
|
44581
45094
|
params.accountId,
|
|
44582
45095
|
"toutiao"
|
|
44583
45096
|
];
|
|
@@ -44775,7 +45288,6 @@ var __webpack_exports__ = {};
|
|
|
44775
45288
|
enverionment: task.enverionment || "development",
|
|
44776
45289
|
postId: params.articleId,
|
|
44777
45290
|
eip: proxyHttp.proxyInfo,
|
|
44778
|
-
proxyIp: params.localIP,
|
|
44779
45291
|
accountId: params.accountId,
|
|
44780
45292
|
uid: params.uid,
|
|
44781
45293
|
platform: "toutiao",
|
|
@@ -45410,16 +45922,11 @@ var __webpack_exports__ = {};
|
|
|
45410
45922
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
45411
45923
|
let executionState;
|
|
45412
45924
|
let proxyUrl;
|
|
45413
|
-
if (params.
|
|
45414
|
-
|
|
45415
|
-
params.localIP,
|
|
45416
|
-
params.proxyLoc,
|
|
45417
|
-
params.accountId
|
|
45418
|
-
];
|
|
45419
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
45925
|
+
if (params.proxyLoc) {
|
|
45926
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
45420
45927
|
const ProxyAgentResult = await ProxyAgent({
|
|
45421
45928
|
logger: task.logger
|
|
45422
|
-
},
|
|
45929
|
+
}, params.proxyLoc, params.accountId);
|
|
45423
45930
|
task.logger?.info("==> 代理信息获取成功!");
|
|
45424
45931
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
45425
45932
|
}
|
|
@@ -45911,7 +46418,6 @@ var __webpack_exports__ = {};
|
|
|
45911
46418
|
},
|
|
45912
46419
|
task.logger,
|
|
45913
46420
|
params.proxyLoc,
|
|
45914
|
-
params.localIP,
|
|
45915
46421
|
params.accountId,
|
|
45916
46422
|
"weixin"
|
|
45917
46423
|
];
|
|
@@ -46690,7 +47196,6 @@ var __webpack_exports__ = {};
|
|
|
46690
47196
|
enverionment: task.enverionment || "development",
|
|
46691
47197
|
postId: params.articleId,
|
|
46692
47198
|
eip: proxyHttp.proxyInfo,
|
|
46693
|
-
proxyIp: params.localIP,
|
|
46694
47199
|
accountId: params.accountId,
|
|
46695
47200
|
uid: params.uid,
|
|
46696
47201
|
platform: "weixin",
|
|
@@ -47495,16 +48000,11 @@ var __webpack_exports__ = {};
|
|
|
47495
48000
|
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
47496
48001
|
let executionState;
|
|
47497
48002
|
let proxyUrl;
|
|
47498
|
-
if (params.
|
|
47499
|
-
|
|
47500
|
-
params.localIP,
|
|
47501
|
-
params.proxyLoc,
|
|
47502
|
-
params.accountId
|
|
47503
|
-
];
|
|
47504
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
48003
|
+
if (params.proxyLoc) {
|
|
48004
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
47505
48005
|
const ProxyAgentResult = await ProxyAgent({
|
|
47506
48006
|
logger: task.logger
|
|
47507
|
-
},
|
|
48007
|
+
}, params.proxyLoc, params.accountId);
|
|
47508
48008
|
task.logger?.info("==> 代理信息获取成功!");
|
|
47509
48009
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
47510
48010
|
}
|
|
@@ -47821,7 +48321,6 @@ var __webpack_exports__ = {};
|
|
|
47821
48321
|
},
|
|
47822
48322
|
task.logger,
|
|
47823
48323
|
params.proxyLoc,
|
|
47824
|
-
params.localIP,
|
|
47825
48324
|
params.accountId,
|
|
47826
48325
|
"xiaohongshu"
|
|
47827
48326
|
];
|
|
@@ -47862,8 +48361,8 @@ var __webpack_exports__ = {};
|
|
|
47862
48361
|
params: fetchCoverParams
|
|
47863
48362
|
}, {
|
|
47864
48363
|
retries: 3,
|
|
47865
|
-
retryDelay:
|
|
47866
|
-
timeout:
|
|
48364
|
+
retryDelay: 500,
|
|
48365
|
+
timeout: 30000
|
|
47867
48366
|
});
|
|
47868
48367
|
for (const item of batchCoverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item.fileIds)uploadInfos.push({
|
|
47869
48368
|
bucket: item.bucket || "",
|
|
@@ -47882,8 +48381,8 @@ var __webpack_exports__ = {};
|
|
|
47882
48381
|
params: fetchCoverParams
|
|
47883
48382
|
}, {
|
|
47884
48383
|
retries: 3,
|
|
47885
|
-
retryDelay:
|
|
47886
|
-
timeout:
|
|
48384
|
+
retryDelay: 500,
|
|
48385
|
+
timeout: 30000
|
|
47887
48386
|
});
|
|
47888
48387
|
for (const item of coverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item.fileIds)uploadInfos.push({
|
|
47889
48388
|
bucket: item.bucket || "",
|
|
@@ -47944,7 +48443,9 @@ var __webpack_exports__ = {};
|
|
|
47944
48443
|
headers: {
|
|
47945
48444
|
"x-cos-security-token": ossToken
|
|
47946
48445
|
},
|
|
47947
|
-
defaultErrorMsg: "
|
|
48446
|
+
defaultErrorMsg: "图片上传异常,请稍后重试。"
|
|
48447
|
+
}, {
|
|
48448
|
+
timeout: 60000
|
|
47948
48449
|
});
|
|
47949
48450
|
return {
|
|
47950
48451
|
ossFileId,
|
|
@@ -47954,6 +48455,8 @@ var __webpack_exports__ = {};
|
|
|
47954
48455
|
originSize
|
|
47955
48456
|
};
|
|
47956
48457
|
} catch (error) {
|
|
48458
|
+
const e = Http.handleApiError(error);
|
|
48459
|
+
task.logger.warn(`[xhs upload] 第${attempt + 1}次失败 index=${index} bucket=${ossBucketIndex} domain=${ossDomain} fileId=${ossFileId} code=${e.code} msg=${e.message} data=${stringifyError(e.data)}`);
|
|
47957
48460
|
attempt++;
|
|
47958
48461
|
}
|
|
47959
48462
|
}
|
|
@@ -48187,7 +48690,6 @@ var __webpack_exports__ = {};
|
|
|
48187
48690
|
enverionment: task.enverionment || "development",
|
|
48188
48691
|
postId: params.articleId,
|
|
48189
48692
|
eip: proxyHttp.proxyInfo,
|
|
48190
|
-
proxyIp: params.localIP,
|
|
48191
48693
|
accountId: params.accountId,
|
|
48192
48694
|
uid: params.uid,
|
|
48193
48695
|
platform: "xiaohongshu",
|
|
@@ -48449,16 +48951,11 @@ var __webpack_exports__ = {};
|
|
|
48449
48951
|
return downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
48450
48952
|
}));
|
|
48451
48953
|
let proxyUrl;
|
|
48452
|
-
if (params.
|
|
48453
|
-
|
|
48454
|
-
params.localIP,
|
|
48455
|
-
params.proxyLoc,
|
|
48456
|
-
params.accountId
|
|
48457
|
-
];
|
|
48458
|
-
task.logger?.info(`==> 开始获取代理信息:${args}`);
|
|
48954
|
+
if (params.proxyLoc) {
|
|
48955
|
+
task.logger?.info(`==> 开始获取代理信息:${params}`);
|
|
48459
48956
|
const ProxyAgentResult = await ProxyAgent({
|
|
48460
48957
|
logger: task.logger
|
|
48461
|
-
},
|
|
48958
|
+
}, params.proxyLoc, params.accountId);
|
|
48462
48959
|
task.logger?.info("==> 代理信息获取成功!");
|
|
48463
48960
|
proxyUrl = ProxyAgentResult ? `http://${ProxyAgentResult.ip}:${ProxyAgentResult.port}` : void 0;
|
|
48464
48961
|
}
|
|
@@ -48887,7 +49384,6 @@ var __webpack_exports__ = {};
|
|
|
48887
49384
|
},
|
|
48888
49385
|
task.logger,
|
|
48889
49386
|
params.proxyLoc,
|
|
48890
|
-
params.localIP,
|
|
48891
49387
|
params.accountId,
|
|
48892
49388
|
"xiaohongshu-rpa"
|
|
48893
49389
|
];
|
|
@@ -48933,8 +49429,8 @@ var __webpack_exports__ = {};
|
|
|
48933
49429
|
params: fetchCoverParams
|
|
48934
49430
|
}, {
|
|
48935
49431
|
retries: 3,
|
|
48936
|
-
retryDelay:
|
|
48937
|
-
timeout:
|
|
49432
|
+
retryDelay: 500,
|
|
49433
|
+
timeout: 8000
|
|
48938
49434
|
});
|
|
48939
49435
|
for (const item of batchCoverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item?.fileIds ?? [])uploadInfos.push({
|
|
48940
49436
|
bucket: item.bucket || "",
|
|
@@ -48953,8 +49449,8 @@ var __webpack_exports__ = {};
|
|
|
48953
49449
|
params: fetchCoverParams
|
|
48954
49450
|
}, {
|
|
48955
49451
|
retries: 3,
|
|
48956
|
-
retryDelay:
|
|
48957
|
-
timeout:
|
|
49452
|
+
retryDelay: 500,
|
|
49453
|
+
timeout: 8000
|
|
48958
49454
|
});
|
|
48959
49455
|
for (const item of coverIdInfo?.data?.uploadTempPermits ?? [])for (const fileId of item?.fileIds ?? [])uploadInfos.push({
|
|
48960
49456
|
bucket: item.bucket || "",
|
|
@@ -48999,6 +49495,8 @@ var __webpack_exports__ = {};
|
|
|
48999
49495
|
"x-cos-security-token": ossToken
|
|
49000
49496
|
},
|
|
49001
49497
|
defaultErrorMsg: "图片上传异常,请稍后重试发布。"
|
|
49498
|
+
}, {
|
|
49499
|
+
timeout: 60000
|
|
49002
49500
|
});
|
|
49003
49501
|
return {
|
|
49004
49502
|
ossFileId,
|
|
@@ -49308,7 +49806,6 @@ var __webpack_exports__ = {};
|
|
|
49308
49806
|
},
|
|
49309
49807
|
_task.logger,
|
|
49310
49808
|
params.proxyLoc,
|
|
49311
|
-
params.localIP,
|
|
49312
49809
|
params.accountId
|
|
49313
49810
|
];
|
|
49314
49811
|
const http = new Http(...args);
|
|
@@ -49394,7 +49891,6 @@ var __webpack_exports__ = {};
|
|
|
49394
49891
|
},
|
|
49395
49892
|
_task.logger,
|
|
49396
49893
|
params.proxyLoc,
|
|
49397
|
-
params.localIP,
|
|
49398
49894
|
params.accountId
|
|
49399
49895
|
];
|
|
49400
49896
|
const http = new Http(...args);
|
|
@@ -49433,7 +49929,6 @@ var __webpack_exports__ = {};
|
|
|
49433
49929
|
},
|
|
49434
49930
|
_task.logger,
|
|
49435
49931
|
params.proxyLoc,
|
|
49436
|
-
params.localIP,
|
|
49437
49932
|
params.accountId
|
|
49438
49933
|
];
|
|
49439
49934
|
const http = new Http(...args);
|
|
@@ -49486,7 +49981,6 @@ var __webpack_exports__ = {};
|
|
|
49486
49981
|
},
|
|
49487
49982
|
_task.logger,
|
|
49488
49983
|
params.proxyLoc,
|
|
49489
|
-
params.localIP,
|
|
49490
49984
|
params.accountId
|
|
49491
49985
|
];
|
|
49492
49986
|
const http = new Http(...args);
|
|
@@ -49543,7 +50037,6 @@ var __webpack_exports__ = {};
|
|
|
49543
50037
|
},
|
|
49544
50038
|
_task.logger,
|
|
49545
50039
|
params.proxyLoc,
|
|
49546
|
-
params.localIP,
|
|
49547
50040
|
params.accountId
|
|
49548
50041
|
];
|
|
49549
50042
|
const http = new Http(...args);
|
|
@@ -49616,7 +50109,6 @@ var __webpack_exports__ = {};
|
|
|
49616
50109
|
},
|
|
49617
50110
|
_task.logger,
|
|
49618
50111
|
params.proxyLoc,
|
|
49619
|
-
params.localIP,
|
|
49620
50112
|
params.accountId
|
|
49621
50113
|
];
|
|
49622
50114
|
const http = new Http(...args);
|
|
@@ -49720,7 +50212,6 @@ var __webpack_exports__ = {};
|
|
|
49720
50212
|
},
|
|
49721
50213
|
_task.logger,
|
|
49722
50214
|
params.proxyLoc,
|
|
49723
|
-
params.localIP,
|
|
49724
50215
|
params.accountId
|
|
49725
50216
|
];
|
|
49726
50217
|
const http = new Http(...args);
|
|
@@ -49853,6 +50344,24 @@ var __webpack_exports__ = {};
|
|
|
49853
50344
|
likeNumYesterday: classic_schemas_number().nullable(),
|
|
49854
50345
|
commentNumYesterday: classic_schemas_number().nullable()
|
|
49855
50346
|
});
|
|
50347
|
+
const douyinConfigDataSchema = classic_schemas_object({
|
|
50348
|
+
fansNum: classic_schemas_number(),
|
|
50349
|
+
favedNum: classic_schemas_number(),
|
|
50350
|
+
fansNumLastWeek: classic_schemas_number(),
|
|
50351
|
+
watchNumLastWeek: classic_schemas_number(),
|
|
50352
|
+
likeNumLastWeek: classic_schemas_number(),
|
|
50353
|
+
commentNumLastWeek: classic_schemas_number(),
|
|
50354
|
+
shareNumLastWeek: classic_schemas_number(),
|
|
50355
|
+
visitNumLastWeek: classic_schemas_number()
|
|
50356
|
+
});
|
|
50357
|
+
const shipinhaoConfigDataSchema = classic_schemas_object({
|
|
50358
|
+
fansNum: classic_schemas_number(),
|
|
50359
|
+
feedsCount: classic_schemas_number(),
|
|
50360
|
+
fansNumYesterday: classic_schemas_number().nullable(),
|
|
50361
|
+
playNumYesterday: classic_schemas_number().nullable(),
|
|
50362
|
+
likeNumYesterday: classic_schemas_number().nullable(),
|
|
50363
|
+
commentNumYesterday: classic_schemas_number().nullable()
|
|
50364
|
+
});
|
|
49856
50365
|
const BetaFlag = "HuiwenCanary";
|
|
49857
50366
|
class Action {
|
|
49858
50367
|
constructor(task){
|
|
@@ -50141,4 +50650,5 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
50141
50650
|
value: true
|
|
50142
50651
|
});
|
|
50143
50652
|
|
|
50144
|
-
//# sourceMappingURL=bundle.js.map
|
|
50653
|
+
//# sourceMappingURL=bundle.js.map
|
|
50654
|
+
//# debugId=ef37432b-1de8-5030-834a-59ecb3853f3c
|