@iflyrpa/actions 4.0.5 → 4.0.6
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 +986 -383
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +79 -1
- package/dist/index.js +988 -385
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +989 -388
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4351,7 +4351,7 @@ function __webpack_require__(moduleId) {
|
|
|
4351
4351
|
};
|
|
4352
4352
|
})();
|
|
4353
4353
|
var package_namespaceObject = {
|
|
4354
|
-
i8: "4.0.
|
|
4354
|
+
i8: "4.0.6"
|
|
4355
4355
|
};
|
|
4356
4356
|
const PROXY_CREDENTIALS = [
|
|
4357
4357
|
{
|
|
@@ -4585,11 +4585,12 @@ class Http {
|
|
|
4585
4585
|
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
4586
4586
|
errorString: stringifyError(error)
|
|
4587
4587
|
});
|
|
4588
|
-
_message =
|
|
4588
|
+
_message = `网络错误: ${error.message}`;
|
|
4589
4589
|
break;
|
|
4590
4590
|
}
|
|
4591
4591
|
}
|
|
4592
|
-
|
|
4592
|
+
if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
|
|
4593
|
+
else errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
4593
4594
|
if ("canceled" === errorResponse.message) {
|
|
4594
4595
|
const message = errorResponse.extra?.isProxyRequest ? "代理连接建立超时,请更换区域或稍后重试!" : "网络请求超时,请稍后重试!";
|
|
4595
4596
|
errorResponse.message = message;
|
|
@@ -13367,400 +13368,421 @@ function generateRandomString(length) {
|
|
|
13367
13368
|
}
|
|
13368
13369
|
return randomString;
|
|
13369
13370
|
}
|
|
13371
|
+
function safeSerialize(obj) {
|
|
13372
|
+
if (!obj || "object" != typeof obj) return obj;
|
|
13373
|
+
try {
|
|
13374
|
+
return JSON.parse(JSON.stringify(obj));
|
|
13375
|
+
} catch (error) {
|
|
13376
|
+
return {};
|
|
13377
|
+
}
|
|
13378
|
+
}
|
|
13370
13379
|
const mock_mockAction = async (task, params)=>{
|
|
13371
13380
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
13372
13381
|
if (!params.extraParam || !params.extraParam["security-sdk/s_sdk_pri_key"] || !params.extraParam["security-sdk/s_sdk_pub_key"] || !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 (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "extraParam 参数缺失或不完整", "");
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13382
|
+
let currentStep = "初始化";
|
|
13383
|
+
try {
|
|
13384
|
+
currentStep = "验证账号信息";
|
|
13385
|
+
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";
|
|
13386
|
+
const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
13387
|
+
if (!sessionidCookie) return {
|
|
13388
|
+
code: 414,
|
|
13389
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
13390
|
+
data: ""
|
|
13391
|
+
};
|
|
13392
|
+
currentStep = "准备请求参数";
|
|
13393
|
+
const headers = {
|
|
13394
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
13395
|
+
origin: "https://creator.douyin.com",
|
|
13396
|
+
referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13397
|
+
Accept: "application/json, text/plain, */*",
|
|
13398
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
13399
|
+
"Content-Type": "application/json",
|
|
13400
|
+
pragma: "no-cache",
|
|
13401
|
+
"cache-control": "no-cache",
|
|
13402
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
13403
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
13404
|
+
"bd-ticket-guard-web-version": "2",
|
|
13405
|
+
"sec-ch-ua-mobile": "?0",
|
|
13406
|
+
"user-agent": userAgent,
|
|
13407
|
+
"sec-fetch-site": "same-origin",
|
|
13408
|
+
"sec-fetch-mode": "cors",
|
|
13409
|
+
"sec-fetch-dest": "empty",
|
|
13410
|
+
"accept-language": "zh-CN,zh;q=0.9",
|
|
13411
|
+
priority: "u=1, i"
|
|
13412
|
+
};
|
|
13413
|
+
const publishParams = {
|
|
13414
|
+
read_aid: "2906",
|
|
13415
|
+
aid: "1128",
|
|
13416
|
+
cookie_enabled: "true",
|
|
13417
|
+
screen_width: params.extraParam?.browserInfo.screen_width || "1920",
|
|
13418
|
+
screen_height: params.extraParam?.browserInfo.screen_height || "1080",
|
|
13419
|
+
browser_language: params.extraParam?.browserInfo.browser_language || "zh-CN",
|
|
13420
|
+
browser_platform: params.extraParam?.browserInfo.browser_platform || "Win32",
|
|
13421
|
+
browser_name: params.extraParam?.browserInfo.browser_name || "Mozilla",
|
|
13422
|
+
browser_version: userAgent,
|
|
13423
|
+
browser_online: "true",
|
|
13424
|
+
timezone_name: "Asia/Shanghai",
|
|
13425
|
+
support_h265: "1",
|
|
13426
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
13427
|
+
a_bogus: ""
|
|
13428
|
+
};
|
|
13429
|
+
task.logger.info(`[douyinPublish] publishParams ${JSON.stringify(publishParams)}`);
|
|
13430
|
+
const publishData = {
|
|
13431
|
+
item: {
|
|
13432
|
+
common: {
|
|
13433
|
+
text: params.content,
|
|
13434
|
+
text_extra: params.textExtra,
|
|
13435
|
+
activity: "[]",
|
|
13436
|
+
challenges: params.challengeIds || "[]",
|
|
13437
|
+
hashtag_source: "",
|
|
13438
|
+
mentions: "[]",
|
|
13439
|
+
music_id: params.musicId || "",
|
|
13440
|
+
music_end_time: 1000 * (params.musicDuration || 0),
|
|
13441
|
+
hot_sentence: params.hotSentence || "",
|
|
13442
|
+
visibility_type: Number(params.visibleRange) || 0,
|
|
13443
|
+
download: params.allowSave ? 1 : 0,
|
|
13444
|
+
timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
|
|
13445
|
+
media_type: Number(params.publishType) || 2,
|
|
13446
|
+
images: [],
|
|
13447
|
+
creation_id: ""
|
|
13448
|
+
},
|
|
13449
|
+
cover: {
|
|
13450
|
+
poster: ""
|
|
13451
|
+
},
|
|
13452
|
+
mix: params.mix ? {
|
|
13453
|
+
mix_id: params.mix.mix_id,
|
|
13454
|
+
mix_order: params.mix.mix_order || 0
|
|
13455
|
+
} : {},
|
|
13456
|
+
anchor: {},
|
|
13457
|
+
declare: {
|
|
13458
|
+
user_declare_info: "{}"
|
|
13459
|
+
}
|
|
13460
|
+
}
|
|
13461
|
+
};
|
|
13462
|
+
const args = [
|
|
13463
|
+
{
|
|
13464
|
+
headers
|
|
13438
13465
|
},
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13466
|
+
task.logger,
|
|
13467
|
+
"",
|
|
13468
|
+
"",
|
|
13469
|
+
params.accountId,
|
|
13470
|
+
"douyin"
|
|
13471
|
+
];
|
|
13472
|
+
const http = new Http({
|
|
13473
|
+
headers
|
|
13474
|
+
});
|
|
13475
|
+
const proxyHttp = new Http(...args);
|
|
13476
|
+
const uploadedImgList = params.uploadedImgList ? JSON.parse(params.uploadedImgList) : [];
|
|
13477
|
+
if (uploadedImgList.length > 0) publishData.item.common.images = uploadedImgList;
|
|
13478
|
+
else {
|
|
13479
|
+
const tmpCachePath = task.getTmpPath();
|
|
13480
|
+
const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
|
|
13481
|
+
if (params.coverImage) {
|
|
13482
|
+
const cover = await uploader.uploadCover(params.coverImage);
|
|
13483
|
+
if (cover) {
|
|
13484
|
+
publishData.item.common.images.push({
|
|
13485
|
+
uri: cover.uri,
|
|
13486
|
+
width: cover.width,
|
|
13487
|
+
height: cover.height
|
|
13488
|
+
});
|
|
13489
|
+
publishData.item.cover = {
|
|
13490
|
+
poster: cover.uri
|
|
13491
|
+
};
|
|
13492
|
+
}
|
|
13493
|
+
}
|
|
13494
|
+
if (params.banners && params.banners.length > 0) {
|
|
13495
|
+
const banners = params.banners.filter((i)=>i !== params.coverImage);
|
|
13496
|
+
const uploadResults = await uploader.uploadImages(banners);
|
|
13497
|
+
publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
|
|
13498
|
+
uri: result.uri,
|
|
13499
|
+
width: result.width,
|
|
13500
|
+
height: result.height
|
|
13501
|
+
})));
|
|
13446
13502
|
}
|
|
13447
13503
|
}
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
{
|
|
13451
|
-
headers
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
|
|
13468
|
-
if (params.coverImage) {
|
|
13469
|
-
const cover = await uploader.uploadCover(params.coverImage);
|
|
13470
|
-
if (cover) {
|
|
13471
|
-
publishData.item.common.images.push({
|
|
13472
|
-
uri: cover.uri,
|
|
13473
|
-
width: cover.width,
|
|
13474
|
-
height: cover.height
|
|
13475
|
-
});
|
|
13476
|
-
publishData.item.cover = {
|
|
13477
|
-
poster: cover.uri
|
|
13504
|
+
publishData.item.common.creation_id = generateRandomString(8) + Date.now();
|
|
13505
|
+
let decision = null;
|
|
13506
|
+
proxyHttp.addResponseInterceptor((response)=>{
|
|
13507
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
|
|
13508
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
|
|
13509
|
+
decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
|
|
13510
|
+
if (needsVerification(decision)) {
|
|
13511
|
+
task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
|
|
13512
|
+
return;
|
|
13513
|
+
}
|
|
13514
|
+
if (!response || !response.data) return;
|
|
13515
|
+
const responseData = response.data;
|
|
13516
|
+
if (response && responseData?.status_code && 0 !== responseData.status_code) {
|
|
13517
|
+
const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
|
|
13518
|
+
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
|
|
13519
|
+
return {
|
|
13520
|
+
code: errorCode,
|
|
13521
|
+
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
13522
|
+
data: responseData
|
|
13478
13523
|
};
|
|
13479
13524
|
}
|
|
13525
|
+
});
|
|
13526
|
+
task._timerRecord.PrePublish = Date.now();
|
|
13527
|
+
if (MockPublish) {
|
|
13528
|
+
const data = "123456789";
|
|
13529
|
+
const message = `图文模拟发布成功 ${http.proxyInfo}`;
|
|
13530
|
+
await updateTaskState?.({
|
|
13531
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
13532
|
+
result: {
|
|
13533
|
+
response: data
|
|
13534
|
+
}
|
|
13535
|
+
});
|
|
13536
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(0, message, data);
|
|
13480
13537
|
}
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
height: result.height
|
|
13488
|
-
})));
|
|
13489
|
-
}
|
|
13490
|
-
}
|
|
13491
|
-
publishData.item.common.creation_id = generateRandomString(8) + Date.now();
|
|
13492
|
-
let decision = null;
|
|
13493
|
-
proxyHttp.addResponseInterceptor((response)=>{
|
|
13494
|
-
task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
|
|
13495
|
-
task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
|
|
13496
|
-
decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
|
|
13497
|
-
if (needsVerification(decision)) {
|
|
13498
|
-
task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
|
|
13499
|
-
return;
|
|
13500
|
-
}
|
|
13501
|
-
if (!response || !response.data) return;
|
|
13502
|
-
const responseData = response.data;
|
|
13503
|
-
if (response && responseData?.status_code && 0 !== responseData.status_code) {
|
|
13504
|
-
const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
|
|
13505
|
-
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
|
|
13506
|
-
return {
|
|
13507
|
-
code: errorCode,
|
|
13508
|
-
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
13509
|
-
data: responseData
|
|
13510
|
-
};
|
|
13511
|
-
}
|
|
13512
|
-
});
|
|
13513
|
-
task._timerRecord.PrePublish = Date.now();
|
|
13514
|
-
if (MockPublish) {
|
|
13515
|
-
const data = "123456789";
|
|
13516
|
-
const message = `图文模拟发布成功 ${http.proxyInfo}`;
|
|
13517
|
-
await updateTaskState?.({
|
|
13518
|
-
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
13519
|
-
result: {
|
|
13520
|
-
response: data
|
|
13538
|
+
let webProtectData;
|
|
13539
|
+
try {
|
|
13540
|
+
webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
13541
|
+
if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
|
|
13542
|
+
task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
|
|
13543
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
|
|
13521
13544
|
}
|
|
13522
|
-
})
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13545
|
+
} catch (error) {
|
|
13546
|
+
task.logger.error(`解析 webProtectData 失败: ${error}`);
|
|
13547
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
|
|
13548
|
+
}
|
|
13549
|
+
let ticket = webProtectData.ticket;
|
|
13550
|
+
let ts_sign = webProtectData.ts_sign;
|
|
13551
|
+
const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
|
|
13552
|
+
if (serverDataCookie) try {
|
|
13553
|
+
const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
|
|
13554
|
+
if (decoded.ticket && decoded.ts_sign) {
|
|
13555
|
+
if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
|
|
13556
|
+
ticket = decoded.ticket;
|
|
13557
|
+
ts_sign = decoded.ts_sign;
|
|
13558
|
+
}
|
|
13559
|
+
} catch (error) {
|
|
13560
|
+
task.logger.info(`[douyinPublish] 解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
|
|
13531
13561
|
}
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
|
|
13543
|
-
ticket = decoded.ticket;
|
|
13544
|
-
ts_sign = decoded.ts_sign;
|
|
13562
|
+
let ec_privateKey;
|
|
13563
|
+
try {
|
|
13564
|
+
ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
|
|
13565
|
+
if (!ec_privateKey) {
|
|
13566
|
+
task.logger.error("[douyinPublish] ec_privateKey 为空");
|
|
13567
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 缺失,请重新获取后重试", "");
|
|
13568
|
+
}
|
|
13569
|
+
} catch (error) {
|
|
13570
|
+
task.logger.error(`[douyinPublish] 解析 ec_privateKey 失败: ${error}`);
|
|
13571
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 ec_privateKey 解析失败,请重新获取后重试", "");
|
|
13545
13572
|
}
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13573
|
+
let certificate;
|
|
13574
|
+
try {
|
|
13575
|
+
certificate = JSON.parse(params.extraParam["security-sdk/s_sdk_server_cert_key"] || "{}").cert;
|
|
13576
|
+
if (!certificate) {
|
|
13577
|
+
task.logger.error("[douyinPublish] certificate 为空");
|
|
13578
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 缺失,请重新获取后重试", "");
|
|
13579
|
+
}
|
|
13580
|
+
} catch (error) {
|
|
13581
|
+
task.logger.error(`[douyinPublish] 解析 certificate 失败: ${error}`);
|
|
13582
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
|
|
13555
13583
|
}
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13584
|
+
const ree_public_key = webProtectData.client_cert.replace("pub.", "");
|
|
13585
|
+
let bdTicketGuardClientData;
|
|
13586
|
+
try {
|
|
13587
|
+
bdTicketGuardClientData = getBdV2({
|
|
13588
|
+
ticket,
|
|
13589
|
+
ts_sign: ts_sign,
|
|
13590
|
+
ec_privateKey: ec_privateKey,
|
|
13591
|
+
certificate: certificate,
|
|
13592
|
+
bd_ticket_guard_ree_public_key: ree_public_key
|
|
13593
|
+
});
|
|
13594
|
+
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
13595
|
+
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
13596
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
13597
|
+
}
|
|
13598
|
+
} catch (error) {
|
|
13599
|
+
task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
|
|
13600
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
|
|
13566
13601
|
}
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
})
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
13602
|
+
task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
|
|
13603
|
+
const publishQuery = {
|
|
13604
|
+
...publishParams,
|
|
13605
|
+
a_bogus: ""
|
|
13606
|
+
};
|
|
13607
|
+
const queryString = new URLSearchParams(publishQuery).toString();
|
|
13608
|
+
let aBogus;
|
|
13609
|
+
try {
|
|
13610
|
+
aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
|
|
13611
|
+
if (!aBogus || aBogus.length < 10) {
|
|
13612
|
+
task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
|
|
13613
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成失败,请重试", "");
|
|
13614
|
+
}
|
|
13615
|
+
} catch (error) {
|
|
13616
|
+
task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
|
|
13617
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 a_bogus 生成异常,请重试", "");
|
|
13584
13618
|
}
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
|
|
13595
|
-
|
|
13596
|
-
|
|
13597
|
-
|
|
13598
|
-
|
|
13599
|
-
task.logger.
|
|
13600
|
-
|
|
13619
|
+
publishQuery.a_bogus = aBogus;
|
|
13620
|
+
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
13621
|
+
let csrfToken;
|
|
13622
|
+
try {
|
|
13623
|
+
csrfToken = mock_generateCsrfTokenAdvanced({
|
|
13624
|
+
cookies: params.cookies,
|
|
13625
|
+
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
13626
|
+
method: "POST",
|
|
13627
|
+
userAgent
|
|
13628
|
+
});
|
|
13629
|
+
if (!csrfToken || csrfToken.length < 10) {
|
|
13630
|
+
task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
|
|
13631
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
|
|
13632
|
+
}
|
|
13633
|
+
task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
|
|
13634
|
+
} catch (error) {
|
|
13635
|
+
task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
|
|
13636
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成异常,请重试", "");
|
|
13601
13637
|
}
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
try {
|
|
13610
|
-
csrfToken = mock_generateCsrfTokenAdvanced({
|
|
13611
|
-
cookies: params.cookies,
|
|
13612
|
-
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
13613
|
-
method: "POST",
|
|
13614
|
-
userAgent
|
|
13615
|
-
});
|
|
13616
|
-
if (!csrfToken || csrfToken.length < 10) {
|
|
13617
|
-
task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
|
|
13618
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
|
|
13638
|
+
let sessionDtrait;
|
|
13639
|
+
try {
|
|
13640
|
+
sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
|
|
13641
|
+
task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
|
|
13642
|
+
} catch (error) {
|
|
13643
|
+
task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
|
|
13644
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
|
|
13619
13645
|
}
|
|
13620
|
-
task.logger.info(`[douyinPublish]
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13646
|
+
task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
|
|
13647
|
+
...headers,
|
|
13648
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13649
|
+
"Content-Type": "application/json",
|
|
13650
|
+
Accept: "application/json, text/plain, */*",
|
|
13651
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13652
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13653
|
+
"bd-ticket-guard-version": "2",
|
|
13654
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
13655
|
+
"bd-ticket-guard-web-version": "2",
|
|
13656
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
13657
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13658
|
+
})}`);
|
|
13659
|
+
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
13660
|
+
let publishResult;
|
|
13661
|
+
try {
|
|
13662
|
+
publishResult = await proxyHttp.api({
|
|
13663
|
+
method: "post",
|
|
13664
|
+
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
13665
|
+
data: publishData,
|
|
13666
|
+
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
13667
|
+
headers: {
|
|
13668
|
+
...headers,
|
|
13669
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13670
|
+
"Content-Type": "application/json",
|
|
13671
|
+
Accept: "application/json, text/plain, */*",
|
|
13672
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13673
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13674
|
+
"bd-ticket-guard-version": "2",
|
|
13675
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
13676
|
+
"bd-ticket-guard-web-version": "2",
|
|
13677
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
13678
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13679
|
+
}
|
|
13680
|
+
}, {
|
|
13681
|
+
timeout: 60000,
|
|
13682
|
+
retries: 3,
|
|
13683
|
+
retryDelay: 2000
|
|
13684
|
+
});
|
|
13685
|
+
} catch (error) {
|
|
13686
|
+
const handledError = Http.handleApiError(error);
|
|
13687
|
+
const isProxyOrNetworkError = [
|
|
13688
|
+
599,
|
|
13689
|
+
500,
|
|
13690
|
+
502,
|
|
13691
|
+
503,
|
|
13692
|
+
504
|
|
13693
|
+
].includes(handledError.code);
|
|
13694
|
+
if (isProxyOrNetworkError) {
|
|
13695
|
+
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13696
|
+
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13697
|
+
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13698
|
+
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13699
|
+
await updateTaskState?.({
|
|
13700
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
13701
|
+
error: message
|
|
13702
|
+
});
|
|
13703
|
+
return {
|
|
13704
|
+
code: 414,
|
|
13705
|
+
data: "",
|
|
13706
|
+
message
|
|
13707
|
+
};
|
|
13666
13708
|
}
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
504
|
|
13680
|
-
].includes(handledError.code);
|
|
13681
|
-
if (isProxyOrNetworkError) {
|
|
13682
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13683
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13684
|
-
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13685
|
-
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13686
|
-
await updateTaskState?.({
|
|
13709
|
+
throw error;
|
|
13710
|
+
}
|
|
13711
|
+
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
13712
|
+
if (needsVerification(decision)) {
|
|
13713
|
+
const details = [
|
|
13714
|
+
publishResult.status_msg,
|
|
13715
|
+
decision?.verify_title,
|
|
13716
|
+
decision?.verify_desc
|
|
13717
|
+
].filter(Boolean).join(" ");
|
|
13718
|
+
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13719
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
13720
|
+
const mockData = {
|
|
13687
13721
|
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
13688
|
-
error: message
|
|
13689
|
-
|
|
13722
|
+
error: message,
|
|
13723
|
+
result: {
|
|
13724
|
+
...safeDecision,
|
|
13725
|
+
data: decision,
|
|
13726
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13727
|
+
}
|
|
13728
|
+
};
|
|
13729
|
+
await updateTaskState?.(mockData);
|
|
13690
13730
|
return {
|
|
13691
|
-
code:
|
|
13692
|
-
data:
|
|
13693
|
-
message
|
|
13731
|
+
code: 0,
|
|
13732
|
+
data: mockData,
|
|
13733
|
+
message: "操作成功"
|
|
13694
13734
|
};
|
|
13695
13735
|
}
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
const
|
|
13709
|
-
|
|
13710
|
-
|
|
13736
|
+
reportLogger({
|
|
13737
|
+
token: params.huiwenToken || "",
|
|
13738
|
+
enverionment: task.enverionment || "development",
|
|
13739
|
+
postId: params.articleId,
|
|
13740
|
+
eip: proxyHttp.proxyInfo,
|
|
13741
|
+
proxyIp: params.localIP,
|
|
13742
|
+
accountId: params.accountId,
|
|
13743
|
+
uid: params.uid,
|
|
13744
|
+
platform: "douyin",
|
|
13745
|
+
publishParams: publishData
|
|
13746
|
+
});
|
|
13747
|
+
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
13748
|
+
const isSuccess = 0 === publishResult.status_code;
|
|
13749
|
+
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13750
|
+
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
13751
|
+
if (!isSuccess) {
|
|
13752
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
13753
|
+
await updateTaskState?.({
|
|
13754
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
13755
|
+
error: message,
|
|
13756
|
+
result: {
|
|
13757
|
+
...safeDecision,
|
|
13758
|
+
data: safeDecision,
|
|
13759
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13760
|
+
}
|
|
13761
|
+
});
|
|
13762
|
+
return {
|
|
13763
|
+
code: 414,
|
|
13764
|
+
data: safeDecision,
|
|
13765
|
+
message
|
|
13766
|
+
};
|
|
13767
|
+
}
|
|
13768
|
+
await updateTaskState?.({
|
|
13769
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
13711
13770
|
result: {
|
|
13712
|
-
|
|
13713
|
-
data: decision,
|
|
13714
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13771
|
+
response: data
|
|
13715
13772
|
}
|
|
13716
|
-
};
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13721
|
-
|
|
13722
|
-
};
|
|
13723
|
-
}
|
|
13724
|
-
reportLogger({
|
|
13725
|
-
token: params.huiwenToken || "",
|
|
13726
|
-
enverionment: task.enverionment || "development",
|
|
13727
|
-
postId: params.articleId,
|
|
13728
|
-
eip: proxyHttp.proxyInfo,
|
|
13729
|
-
proxyIp: params.localIP,
|
|
13730
|
-
accountId: params.accountId,
|
|
13731
|
-
uid: params.uid,
|
|
13732
|
-
platform: "douyin",
|
|
13733
|
-
publishParams: publishData
|
|
13734
|
-
});
|
|
13735
|
-
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
13736
|
-
const isSuccess = 0 === publishResult.status_code;
|
|
13737
|
-
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13738
|
-
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
13739
|
-
if (!isSuccess) {
|
|
13740
|
-
let decisionObj = {};
|
|
13741
|
-
if (decision) decisionObj = decision;
|
|
13773
|
+
});
|
|
13774
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
13775
|
+
} catch (error) {
|
|
13776
|
+
const handledError = Http.handleApiError(error);
|
|
13777
|
+
const errorMsg = handledError.message || "发布失败";
|
|
13778
|
+
const errorCode = handledError.code || 500;
|
|
13779
|
+
task.logger.error(`[douyinPublish] 发布流程异常 (步骤: ${currentStep}): ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
13742
13780
|
await updateTaskState?.({
|
|
13743
13781
|
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
13744
|
-
error:
|
|
13745
|
-
result: {
|
|
13746
|
-
...decisionObj,
|
|
13747
|
-
data: decision,
|
|
13748
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13749
|
-
}
|
|
13782
|
+
error: `${currentStep}失败: ${errorMsg}`
|
|
13750
13783
|
});
|
|
13751
|
-
return
|
|
13752
|
-
code: 414,
|
|
13753
|
-
data,
|
|
13754
|
-
message
|
|
13755
|
-
};
|
|
13784
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(errorCode, errorMsg, "");
|
|
13756
13785
|
}
|
|
13757
|
-
await updateTaskState?.({
|
|
13758
|
-
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
13759
|
-
result: {
|
|
13760
|
-
response: data
|
|
13761
|
-
}
|
|
13762
|
-
});
|
|
13763
|
-
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(isSuccess ? 0 : 414, message, data);
|
|
13764
13786
|
};
|
|
13765
13787
|
const douyinPublish_rpa_rpaAction = async (task, params)=>{
|
|
13766
13788
|
const commonCookies = {
|
|
@@ -15286,6 +15308,241 @@ async function getBaijiahaoData(_task, params) {
|
|
|
15286
15308
|
};
|
|
15287
15309
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(bjhData, "百家号平台数据获取成功!");
|
|
15288
15310
|
}
|
|
15311
|
+
async function getDouyinData(_task, params) {
|
|
15312
|
+
try {
|
|
15313
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
15314
|
+
if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
|
|
15315
|
+
const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
|
|
15316
|
+
const headers = {
|
|
15317
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15318
|
+
referer: "https://creator.douyin.com/creator-micro/home",
|
|
15319
|
+
origin: "https://creator.douyin.com",
|
|
15320
|
+
"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",
|
|
15321
|
+
...csrfToken ? {
|
|
15322
|
+
"x-secsdk-csrf-token": csrfToken
|
|
15323
|
+
} : {}
|
|
15324
|
+
};
|
|
15325
|
+
const args = [
|
|
15326
|
+
{
|
|
15327
|
+
headers
|
|
15328
|
+
},
|
|
15329
|
+
_task.logger,
|
|
15330
|
+
params.proxyLoc,
|
|
15331
|
+
params.localIP,
|
|
15332
|
+
params.accountId
|
|
15333
|
+
];
|
|
15334
|
+
const http = new Http(...args);
|
|
15335
|
+
const toNum = (val)=>{
|
|
15336
|
+
if (null == val) return 0;
|
|
15337
|
+
const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
|
|
15338
|
+
return Number.isNaN(n) ? 0 : n;
|
|
15339
|
+
};
|
|
15340
|
+
const userProfileP = http.api({
|
|
15341
|
+
method: "get",
|
|
15342
|
+
url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
|
|
15343
|
+
params: {
|
|
15344
|
+
device_platform: "webapp",
|
|
15345
|
+
aid: "6383",
|
|
15346
|
+
channel: "channel_pc_web",
|
|
15347
|
+
pc_client_type: "1",
|
|
15348
|
+
version_code: "170400",
|
|
15349
|
+
version_name: "17.4.0",
|
|
15350
|
+
cookie_enabled: "true",
|
|
15351
|
+
platform: "PC"
|
|
15352
|
+
}
|
|
15353
|
+
}, {
|
|
15354
|
+
retries: 3,
|
|
15355
|
+
retryDelay: 100,
|
|
15356
|
+
timeout: 10000
|
|
15357
|
+
}).catch((e)=>{
|
|
15358
|
+
_task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
|
|
15359
|
+
return null;
|
|
15360
|
+
});
|
|
15361
|
+
const overviewP = http.api({
|
|
15362
|
+
method: "get",
|
|
15363
|
+
url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
|
|
15364
|
+
params: {
|
|
15365
|
+
last_days_type: 1,
|
|
15366
|
+
aid: 2906,
|
|
15367
|
+
app_name: "aweme_creator_platform",
|
|
15368
|
+
device_platform: "web"
|
|
15369
|
+
}
|
|
15370
|
+
}, {
|
|
15371
|
+
retries: 3,
|
|
15372
|
+
retryDelay: 100,
|
|
15373
|
+
timeout: 5000
|
|
15374
|
+
}).catch((e)=>{
|
|
15375
|
+
_task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
|
|
15376
|
+
return null;
|
|
15377
|
+
});
|
|
15378
|
+
const [userProfile, overview] = await Promise.all([
|
|
15379
|
+
userProfileP,
|
|
15380
|
+
overviewP
|
|
15381
|
+
]);
|
|
15382
|
+
let fansNum = 0;
|
|
15383
|
+
let favedNum = 0;
|
|
15384
|
+
let followingNum = 0;
|
|
15385
|
+
if (userProfile?.status_code === 0 && userProfile.user) {
|
|
15386
|
+
const user = userProfile.user;
|
|
15387
|
+
fansNum = toNum(user.follower_count);
|
|
15388
|
+
followingNum = toNum(user.following_count);
|
|
15389
|
+
favedNum = toNum(user.total_favorited);
|
|
15390
|
+
} else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
|
|
15391
|
+
const ov = overview?.data;
|
|
15392
|
+
const douyinData = {
|
|
15393
|
+
fansNum,
|
|
15394
|
+
favedNum,
|
|
15395
|
+
fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
|
|
15396
|
+
watchNumLastWeek: toNum(ov?.play?.last_period_incr),
|
|
15397
|
+
likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
|
|
15398
|
+
commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
|
|
15399
|
+
shareNumLastWeek: toNum(ov?.share?.last_period_incr),
|
|
15400
|
+
visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
|
|
15401
|
+
};
|
|
15402
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(douyinData, "抖音平台数据获取成功!");
|
|
15403
|
+
} catch (error) {
|
|
15404
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
15405
|
+
const err = error;
|
|
15406
|
+
_task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
|
|
15407
|
+
return types_errorResponse(err.message, err.code);
|
|
15408
|
+
}
|
|
15409
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15410
|
+
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
15411
|
+
return types_errorResponse(errMsg || "抖音账号数据获取失败");
|
|
15412
|
+
}
|
|
15413
|
+
}
|
|
15414
|
+
async function getShipinhaoData(_task, params) {
|
|
15415
|
+
try {
|
|
15416
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
15417
|
+
if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
|
|
15418
|
+
const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
15419
|
+
const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
15420
|
+
const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
15421
|
+
const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
15422
|
+
const headers = {
|
|
15423
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15424
|
+
referer: "https://channels.weixin.qq.com/platform",
|
|
15425
|
+
origin: "https://channels.weixin.qq.com",
|
|
15426
|
+
"content-type": "application/json",
|
|
15427
|
+
"X-WECHAT-UIN": uinCookie,
|
|
15428
|
+
...deviceIdCookie ? {
|
|
15429
|
+
"finger-print-device-id": deviceIdCookie
|
|
15430
|
+
} : {}
|
|
15431
|
+
};
|
|
15432
|
+
const args = [
|
|
15433
|
+
{
|
|
15434
|
+
headers
|
|
15435
|
+
},
|
|
15436
|
+
_task.logger,
|
|
15437
|
+
params.proxyLoc,
|
|
15438
|
+
params.localIP,
|
|
15439
|
+
params.accountId
|
|
15440
|
+
];
|
|
15441
|
+
const http = new Http(...args);
|
|
15442
|
+
const authData = await http.api({
|
|
15443
|
+
method: "post",
|
|
15444
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
15445
|
+
params: {
|
|
15446
|
+
_aid: aid,
|
|
15447
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
15448
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
15449
|
+
},
|
|
15450
|
+
data: {
|
|
15451
|
+
timestamp: Date.now().toString(),
|
|
15452
|
+
_log_finder_uin: "",
|
|
15453
|
+
_log_finder_id: finderId,
|
|
15454
|
+
rawKeyBuff: "",
|
|
15455
|
+
pluginSessionId: null,
|
|
15456
|
+
scene: 7,
|
|
15457
|
+
reqScene: 7
|
|
15458
|
+
}
|
|
15459
|
+
}, {
|
|
15460
|
+
retries: 3,
|
|
15461
|
+
retryDelay: 100,
|
|
15462
|
+
timeout: 5000
|
|
15463
|
+
});
|
|
15464
|
+
const AUTH_ERROR_CODES = [
|
|
15465
|
+
300333,
|
|
15466
|
+
300334,
|
|
15467
|
+
300330,
|
|
15468
|
+
300331,
|
|
15469
|
+
300332
|
|
15470
|
+
];
|
|
15471
|
+
if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
|
|
15472
|
+
_task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
|
|
15473
|
+
return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
|
|
15474
|
+
}
|
|
15475
|
+
if (authData.errCode) {
|
|
15476
|
+
_task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
|
|
15477
|
+
return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
|
|
15478
|
+
}
|
|
15479
|
+
const finderUser = authData.data?.finderUser;
|
|
15480
|
+
const now = new Date();
|
|
15481
|
+
const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
|
|
15482
|
+
const startTs = Math.floor(yesterday.getTime() / 1000);
|
|
15483
|
+
const endTs = startTs + 86400;
|
|
15484
|
+
_task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
|
|
15485
|
+
let fansNumYesterday = 0;
|
|
15486
|
+
let playNumYesterday = 0;
|
|
15487
|
+
let likeNumYesterday = 0;
|
|
15488
|
+
let commentNumYesterday = 0;
|
|
15489
|
+
try {
|
|
15490
|
+
const statsData = await http.api({
|
|
15491
|
+
method: "post",
|
|
15492
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
|
|
15493
|
+
params: {
|
|
15494
|
+
_aid: aid,
|
|
15495
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
15496
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
15497
|
+
},
|
|
15498
|
+
data: {
|
|
15499
|
+
startTs: startTs.toString(),
|
|
15500
|
+
endTs: endTs.toString(),
|
|
15501
|
+
interval: 3,
|
|
15502
|
+
timestamp: Date.now().toString(),
|
|
15503
|
+
_log_finder_uin: "",
|
|
15504
|
+
_log_finder_id: finderId,
|
|
15505
|
+
rawKeyBuff: "",
|
|
15506
|
+
pluginSessionId: null,
|
|
15507
|
+
scene: 7,
|
|
15508
|
+
reqScene: 7
|
|
15509
|
+
}
|
|
15510
|
+
}, {
|
|
15511
|
+
retries: 3,
|
|
15512
|
+
retryDelay: 100,
|
|
15513
|
+
timeout: 5000
|
|
15514
|
+
});
|
|
15515
|
+
if (!statsData.errCode && statsData.data?.totalData) {
|
|
15516
|
+
const data = statsData.data.totalData;
|
|
15517
|
+
fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
|
|
15518
|
+
playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
|
|
15519
|
+
likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
|
|
15520
|
+
commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
|
|
15521
|
+
}
|
|
15522
|
+
} catch (error) {
|
|
15523
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15524
|
+
_task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
|
|
15525
|
+
}
|
|
15526
|
+
const shipinhaoData = {
|
|
15527
|
+
fansNum: finderUser?.fansCount || 0,
|
|
15528
|
+
feedsCount: finderUser?.feedsCount || 0,
|
|
15529
|
+
fansNumYesterday,
|
|
15530
|
+
playNumYesterday,
|
|
15531
|
+
likeNumYesterday,
|
|
15532
|
+
commentNumYesterday
|
|
15533
|
+
};
|
|
15534
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(shipinhaoData, "视频号平台数据获取成功!");
|
|
15535
|
+
} catch (error) {
|
|
15536
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
15537
|
+
const err = error;
|
|
15538
|
+
_task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
|
|
15539
|
+
return types_errorResponse(err.message, err.code);
|
|
15540
|
+
}
|
|
15541
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15542
|
+
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
15543
|
+
return types_errorResponse(errMsg || "视频号账号数据获取失败");
|
|
15544
|
+
}
|
|
15545
|
+
}
|
|
15289
15546
|
async function getToutiaoData(_task, params) {
|
|
15290
15547
|
const http = new Http({
|
|
15291
15548
|
headers: {
|
|
@@ -15382,7 +15639,7 @@ async function getWeixinData(_task, params) {
|
|
|
15382
15639
|
userInfoHtmlPromise,
|
|
15383
15640
|
userSummaryHtmlPromise
|
|
15384
15641
|
]);
|
|
15385
|
-
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("
|
|
15642
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
15386
15643
|
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
15387
15644
|
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
15388
15645
|
const wxData = {
|
|
@@ -15459,7 +15716,9 @@ const SearchAccountInfoParamsSchema = ActionCommonParamsSchema.extend({
|
|
|
15459
15716
|
"toutiao",
|
|
15460
15717
|
"xiaohongshu",
|
|
15461
15718
|
"weixin",
|
|
15462
|
-
"baijiahao"
|
|
15719
|
+
"baijiahao",
|
|
15720
|
+
"douyin",
|
|
15721
|
+
"shipinhao"
|
|
15463
15722
|
])
|
|
15464
15723
|
});
|
|
15465
15724
|
const SearchAccountInfo = async (_task, params)=>{
|
|
@@ -15473,6 +15732,10 @@ const SearchAccountInfo = async (_task, params)=>{
|
|
|
15473
15732
|
return getWeixinData(_task, params);
|
|
15474
15733
|
case "baijiahao":
|
|
15475
15734
|
return getBaijiahaoData(_task, params);
|
|
15735
|
+
case "douyin":
|
|
15736
|
+
return getDouyinData(_task, params);
|
|
15737
|
+
case "shipinhao":
|
|
15738
|
+
return getShipinhaoData(_task, params);
|
|
15476
15739
|
default:
|
|
15477
15740
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(null, "暂不支持该平台");
|
|
15478
15741
|
}
|
|
@@ -15567,18 +15830,45 @@ const XiaohongshuArticleSchema = BaseArticleSchema.extend({
|
|
|
15567
15830
|
collectNum: schemas_number(),
|
|
15568
15831
|
shareNum: schemas_number()
|
|
15569
15832
|
});
|
|
15833
|
+
const DouyinArticleSchema = BaseArticleSchema.extend({
|
|
15834
|
+
playNum: schemas_number(),
|
|
15835
|
+
likeNum: schemas_number(),
|
|
15836
|
+
commentNum: schemas_number(),
|
|
15837
|
+
shareNum: schemas_number(),
|
|
15838
|
+
collectNum: schemas_number(),
|
|
15839
|
+
awemeId: schemas_string(),
|
|
15840
|
+
awemeType: schemas_number(),
|
|
15841
|
+
duration: schemas_number().optional(),
|
|
15842
|
+
status: schemas_string(),
|
|
15843
|
+
publicUrl: schemas_string()
|
|
15844
|
+
});
|
|
15845
|
+
const ShipinhaoArticleSchema = BaseArticleSchema.extend({
|
|
15846
|
+
readNum: schemas_number(),
|
|
15847
|
+
likeNum: schemas_number(),
|
|
15848
|
+
commentNum: schemas_number(),
|
|
15849
|
+
forwardNum: schemas_number(),
|
|
15850
|
+
favNum: schemas_number(),
|
|
15851
|
+
objectId: schemas_string(),
|
|
15852
|
+
postType: schemas_string(),
|
|
15853
|
+
postStatus: schemas_number(),
|
|
15854
|
+
effectiveTime: schemas_number().optional()
|
|
15855
|
+
});
|
|
15570
15856
|
const FetchArticlesDataSchema = schemas_object({
|
|
15571
15857
|
articleCell: schemas_array(union([
|
|
15572
15858
|
ToutiaoArticleSchema,
|
|
15573
15859
|
WeixinArticleSchema,
|
|
15574
15860
|
BaijiahaoArticleSchema,
|
|
15575
|
-
XiaohongshuArticleSchema
|
|
15861
|
+
XiaohongshuArticleSchema,
|
|
15862
|
+
DouyinArticleSchema,
|
|
15863
|
+
ShipinhaoArticleSchema
|
|
15576
15864
|
])).optional(),
|
|
15577
15865
|
timerPublish: schemas_array(union([
|
|
15578
15866
|
ToutiaoArticleSchema,
|
|
15579
15867
|
WeixinArticleSchema,
|
|
15580
15868
|
BaijiahaoArticleSchema,
|
|
15581
|
-
XiaohongshuArticleSchema
|
|
15869
|
+
XiaohongshuArticleSchema,
|
|
15870
|
+
DouyinArticleSchema,
|
|
15871
|
+
ShipinhaoArticleSchema
|
|
15582
15872
|
])).optional(),
|
|
15583
15873
|
pagination: schemas_object({
|
|
15584
15874
|
total: schemas_number().optional(),
|
|
@@ -15693,6 +15983,269 @@ async function handleBaijiahaoData(_task, params) {
|
|
|
15693
15983
|
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
15694
15984
|
}
|
|
15695
15985
|
}
|
|
15986
|
+
async function handleDouyinData(_task, params) {
|
|
15987
|
+
try {
|
|
15988
|
+
const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
|
|
15989
|
+
const pageNum = params.pageNum || 1;
|
|
15990
|
+
const headers = {
|
|
15991
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15992
|
+
referer: "https://creator.douyin.com"
|
|
15993
|
+
};
|
|
15994
|
+
const args = [
|
|
15995
|
+
{
|
|
15996
|
+
headers
|
|
15997
|
+
},
|
|
15998
|
+
_task.logger,
|
|
15999
|
+
params.proxyLoc,
|
|
16000
|
+
params.localIP,
|
|
16001
|
+
params.accountId
|
|
16002
|
+
];
|
|
16003
|
+
const http = new Http(...args);
|
|
16004
|
+
async function fetchWorks(cursor) {
|
|
16005
|
+
return await http.api({
|
|
16006
|
+
method: "get",
|
|
16007
|
+
url: "https://creator.douyin.com/janus/douyin/creator/pc/work_list",
|
|
16008
|
+
params: {
|
|
16009
|
+
scene: "star_atlas",
|
|
16010
|
+
device_platform: "android",
|
|
16011
|
+
aid: 1128,
|
|
16012
|
+
status,
|
|
16013
|
+
count: pageSize,
|
|
16014
|
+
max_cursor: cursor
|
|
16015
|
+
}
|
|
16016
|
+
}, {
|
|
16017
|
+
retries: 3,
|
|
16018
|
+
retryDelay: 100,
|
|
16019
|
+
timeout: 5000
|
|
16020
|
+
});
|
|
16021
|
+
}
|
|
16022
|
+
const isHasMore = (v)=>true === v || 1 === v;
|
|
16023
|
+
const skipCount = (pageNum - 1) * pageSize;
|
|
16024
|
+
const needCount = skipCount + pageSize;
|
|
16025
|
+
const workListResponse = await fetchWorks(0);
|
|
16026
|
+
if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
|
|
16027
|
+
const allWorks = [
|
|
16028
|
+
...workListResponse.aweme_list
|
|
16029
|
+
];
|
|
16030
|
+
let hasMore = isHasMore(workListResponse.has_more);
|
|
16031
|
+
let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
|
|
16032
|
+
let guard = 0;
|
|
16033
|
+
while(allWorks.length < needCount && hasMore && guard < 20){
|
|
16034
|
+
const nextPageResponse = await fetchWorks(currentCursor);
|
|
16035
|
+
if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
|
|
16036
|
+
allWorks.push(...nextPageResponse.aweme_list);
|
|
16037
|
+
hasMore = isHasMore(nextPageResponse.has_more);
|
|
16038
|
+
currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
|
|
16039
|
+
guard++;
|
|
16040
|
+
}
|
|
16041
|
+
const finalWorks = allWorks.slice(skipCount, needCount);
|
|
16042
|
+
const articleCell = finalWorks.map((item)=>{
|
|
16043
|
+
const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
|
|
16044
|
+
const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
|
|
16045
|
+
let statusText;
|
|
16046
|
+
statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
|
|
16047
|
+
return {
|
|
16048
|
+
title: item.desc || "无作品描述",
|
|
16049
|
+
imageUrl: item.Cover?.url_list?.[0] || "",
|
|
16050
|
+
createTime: item.create_time,
|
|
16051
|
+
redirectUrl: workDetailUrl,
|
|
16052
|
+
playNum: item.statistics?.play_count || 0,
|
|
16053
|
+
likeNum: item.statistics?.digg_count || 0,
|
|
16054
|
+
commentNum: item.statistics?.comment_count || 0,
|
|
16055
|
+
shareNum: item.statistics?.share_count || 0,
|
|
16056
|
+
collectNum: item.statistics?.collect_count || 0,
|
|
16057
|
+
awemeId: item.aweme_id,
|
|
16058
|
+
awemeType: item.aweme_type ?? 0,
|
|
16059
|
+
duration: item.duration,
|
|
16060
|
+
status: statusText,
|
|
16061
|
+
publicUrl: workPublicUrl,
|
|
16062
|
+
...showOriginalData ? {
|
|
16063
|
+
originalData: item
|
|
16064
|
+
} : {}
|
|
16065
|
+
};
|
|
16066
|
+
});
|
|
16067
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
16068
|
+
articleCell,
|
|
16069
|
+
...onlySuccess ? {
|
|
16070
|
+
pagination: {
|
|
16071
|
+
total: workListResponse.total || allWorks.length,
|
|
16072
|
+
nextPage: hasMore,
|
|
16073
|
+
pageNum,
|
|
16074
|
+
pageSize
|
|
16075
|
+
}
|
|
16076
|
+
} : null
|
|
16077
|
+
}, "抖音数据获取成功");
|
|
16078
|
+
} catch (error) {
|
|
16079
|
+
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
|
|
16080
|
+
}
|
|
16081
|
+
}
|
|
16082
|
+
async function handleShipinhaoData(_task, params) {
|
|
16083
|
+
try {
|
|
16084
|
+
const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
|
|
16085
|
+
const pageNum = params.pageNum || 1;
|
|
16086
|
+
const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
|
|
16087
|
+
const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
16088
|
+
const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
16089
|
+
const deviceIdCookie = cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
16090
|
+
const headers = {
|
|
16091
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
16092
|
+
referer: "https://channels.weixin.qq.com",
|
|
16093
|
+
origin: "https://channels.weixin.qq.com",
|
|
16094
|
+
"content-type": "application/json",
|
|
16095
|
+
"X-WECHAT-UIN": uinCookie,
|
|
16096
|
+
...deviceIdCookie ? {
|
|
16097
|
+
"finger-print-device-id": deviceIdCookie
|
|
16098
|
+
} : {}
|
|
16099
|
+
};
|
|
16100
|
+
const args = [
|
|
16101
|
+
{
|
|
16102
|
+
headers
|
|
16103
|
+
},
|
|
16104
|
+
_task.logger,
|
|
16105
|
+
params.proxyLoc,
|
|
16106
|
+
params.localIP,
|
|
16107
|
+
params.accountId
|
|
16108
|
+
];
|
|
16109
|
+
const http = new Http(...args);
|
|
16110
|
+
const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
16111
|
+
async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
|
|
16112
|
+
return await http.api({
|
|
16113
|
+
method: "post",
|
|
16114
|
+
url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
|
|
16115
|
+
params: {
|
|
16116
|
+
_aid: aid,
|
|
16117
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
16118
|
+
_pageUrl: encodeURIComponent(pageUrl)
|
|
16119
|
+
},
|
|
16120
|
+
data: {
|
|
16121
|
+
pageSize,
|
|
16122
|
+
currentPage,
|
|
16123
|
+
userpageType,
|
|
16124
|
+
stickyOrder: true,
|
|
16125
|
+
timestamp: Date.now().toString(),
|
|
16126
|
+
_log_finder_uin: "",
|
|
16127
|
+
_log_finder_id: finderIdCookie,
|
|
16128
|
+
rawKeyBuff,
|
|
16129
|
+
pluginSessionId: null,
|
|
16130
|
+
scene: 7,
|
|
16131
|
+
reqScene: 7
|
|
16132
|
+
}
|
|
16133
|
+
}, {
|
|
16134
|
+
retries: 3,
|
|
16135
|
+
retryDelay: 100,
|
|
16136
|
+
timeout: 5000
|
|
16137
|
+
});
|
|
16138
|
+
}
|
|
16139
|
+
async function fetchAllPosts(userpageType, pageUrl) {
|
|
16140
|
+
const allPosts = [];
|
|
16141
|
+
let currentPage = 1;
|
|
16142
|
+
let rawKeyBuff = "";
|
|
16143
|
+
let continueFlag = true;
|
|
16144
|
+
let totalCount = 0;
|
|
16145
|
+
while(continueFlag){
|
|
16146
|
+
const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
|
|
16147
|
+
if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
|
|
16148
|
+
if (response.errCode) {
|
|
16149
|
+
_task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
|
|
16150
|
+
throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
|
|
16151
|
+
}
|
|
16152
|
+
if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
|
|
16153
|
+
const posts = response.data?.list || response.posts || response.post_list || [];
|
|
16154
|
+
allPosts.push(...posts);
|
|
16155
|
+
continueFlag = response.data?.continueFlag ?? false;
|
|
16156
|
+
rawKeyBuff = response.data?.lastBuff || "";
|
|
16157
|
+
currentPage++;
|
|
16158
|
+
if (currentPage > 100) {
|
|
16159
|
+
_task.logger.warn("分页超过100页,停止请求");
|
|
16160
|
+
break;
|
|
16161
|
+
}
|
|
16162
|
+
}
|
|
16163
|
+
if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
|
|
16164
|
+
return {
|
|
16165
|
+
posts: allPosts,
|
|
16166
|
+
totalCount
|
|
16167
|
+
};
|
|
16168
|
+
}
|
|
16169
|
+
const mapPost = (item, forcePostType)=>{
|
|
16170
|
+
let imageUrl = "";
|
|
16171
|
+
if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
|
|
16172
|
+
else if (item.desc?.media?.[0]?.coverUrl) imageUrl = item.desc.media[0].coverUrl;
|
|
16173
|
+
else if (item.cover?.url) imageUrl = item.cover.url;
|
|
16174
|
+
else if (item.media_url) imageUrl = item.media_url;
|
|
16175
|
+
const title = item.desc?.description || item.object_desc || "无标题";
|
|
16176
|
+
return {
|
|
16177
|
+
title,
|
|
16178
|
+
imageUrl,
|
|
16179
|
+
createTime: item.createTime || item.create_time,
|
|
16180
|
+
redirectUrl: "https://channels.weixin.qq.com/platform",
|
|
16181
|
+
readNum: item.readCount || item.read_count || 0,
|
|
16182
|
+
likeNum: item.likeCount || item.like_count || 0,
|
|
16183
|
+
commentNum: item.commentCount || item.comment_count || 0,
|
|
16184
|
+
forwardNum: item.forwardCount || item.forward_count || 0,
|
|
16185
|
+
favNum: item.favCount || item.fav_count || 0,
|
|
16186
|
+
objectId: item.exportId || item.objectId || "",
|
|
16187
|
+
postType: forcePostType,
|
|
16188
|
+
postStatus: item.status || item.post_status || 0,
|
|
16189
|
+
...item.effectiveTime ? {
|
|
16190
|
+
effectiveTime: item.effectiveTime
|
|
16191
|
+
} : {},
|
|
16192
|
+
...showOriginalData ? {
|
|
16193
|
+
originalData: item
|
|
16194
|
+
} : {}
|
|
16195
|
+
};
|
|
16196
|
+
};
|
|
16197
|
+
const allArticles = [];
|
|
16198
|
+
const needVideo = "all" === postType || "video" === postType;
|
|
16199
|
+
const needArticle = "all" === postType || "article" === postType;
|
|
16200
|
+
const AUTH_ERROR_CODES = [
|
|
16201
|
+
300333,
|
|
16202
|
+
300334,
|
|
16203
|
+
300330,
|
|
16204
|
+
300331,
|
|
16205
|
+
300332
|
|
16206
|
+
];
|
|
16207
|
+
let combinedTotal = 0;
|
|
16208
|
+
if (needVideo) try {
|
|
16209
|
+
const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
|
|
16210
|
+
const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
|
|
16211
|
+
const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
|
|
16212
|
+
allArticles.push(...videoArticles);
|
|
16213
|
+
combinedTotal += totalCount || videoArticles.length;
|
|
16214
|
+
} catch (error) {
|
|
16215
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16216
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
16217
|
+
_task.logger.warn(`获取视频号视频失败:${errMsg}`);
|
|
16218
|
+
}
|
|
16219
|
+
if (needArticle) try {
|
|
16220
|
+
const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
|
|
16221
|
+
const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
|
|
16222
|
+
const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
|
|
16223
|
+
allArticles.push(...articleArticles);
|
|
16224
|
+
combinedTotal += totalCount || articleArticles.length;
|
|
16225
|
+
} catch (error) {
|
|
16226
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16227
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
16228
|
+
_task.logger.warn(`获取视频号图文失败:${errMsg}`);
|
|
16229
|
+
}
|
|
16230
|
+
allArticles.sort((a, b)=>b.createTime - a.createTime);
|
|
16231
|
+
const total = allArticles.length;
|
|
16232
|
+
const start = (pageNum - 1) * pageSize;
|
|
16233
|
+
const pageItems = allArticles.slice(start, start + pageSize);
|
|
16234
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
|
|
16235
|
+
articleCell: pageItems,
|
|
16236
|
+
pagination: {
|
|
16237
|
+
total,
|
|
16238
|
+
nextPage: start + pageSize < total,
|
|
16239
|
+
pageNum,
|
|
16240
|
+
pageSize
|
|
16241
|
+
}
|
|
16242
|
+
}, "视频号数据获取成功");
|
|
16243
|
+
} catch (error) {
|
|
16244
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16245
|
+
if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
|
|
16246
|
+
return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
|
|
16247
|
+
}
|
|
16248
|
+
}
|
|
15696
16249
|
async function handleToutiaoData(_task, params) {
|
|
15697
16250
|
try {
|
|
15698
16251
|
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
|
|
@@ -15725,7 +16278,7 @@ async function handleToutiaoData(_task, params) {
|
|
|
15725
16278
|
app_id: 1231
|
|
15726
16279
|
}
|
|
15727
16280
|
});
|
|
15728
|
-
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("
|
|
16281
|
+
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号数据获取失败,请检查账号状态", 414);
|
|
15729
16282
|
const articleInfo = await http.api({
|
|
15730
16283
|
method: "get",
|
|
15731
16284
|
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
@@ -15832,7 +16385,7 @@ async function handleWeixinData(_task, params) {
|
|
|
15832
16385
|
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
15833
16386
|
let begin = (lastPage ?? pageNum) - 1;
|
|
15834
16387
|
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
15835
|
-
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("
|
|
16388
|
+
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
15836
16389
|
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
15837
16390
|
let articleCell = [];
|
|
15838
16391
|
if (!onlySuccess && pageSize > 20) {
|
|
@@ -15994,7 +16547,7 @@ async function handleXiaohongshuData(_task, params) {
|
|
|
15994
16547
|
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
15995
16548
|
if (!a1Cookie) return {
|
|
15996
16549
|
code: 414,
|
|
15997
|
-
message: "
|
|
16550
|
+
message: "小红书数据获取失败,请检查账号状态",
|
|
15998
16551
|
data: {}
|
|
15999
16552
|
};
|
|
16000
16553
|
if (onlySuccess && 10 !== pageSize) return {
|
|
@@ -16113,7 +16666,7 @@ async function handleXiaohongshuData(_task, params) {
|
|
|
16113
16666
|
}, "小红书文章数据获取成功");
|
|
16114
16667
|
}
|
|
16115
16668
|
const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
16116
|
-
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
|
|
16669
|
+
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu, douyin, shipinhao"),
|
|
16117
16670
|
token: union([
|
|
16118
16671
|
schemas_string(),
|
|
16119
16672
|
schemas_number()
|
|
@@ -16125,7 +16678,14 @@ const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
|
16125
16678
|
showOriginalData: schemas_boolean().optional().describe("是否展示原始数据,默认false"),
|
|
16126
16679
|
cursor: schemas_number().optional().describe("仅用于微信分页游标,默认为空"),
|
|
16127
16680
|
lastPage: schemas_number().optional(),
|
|
16128
|
-
containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false")
|
|
16681
|
+
containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false"),
|
|
16682
|
+
status: schemas_number().optional().describe("抖音作品状态:0=全部"),
|
|
16683
|
+
includeAccount: schemas_boolean().optional().describe("是否包含账号数据,默认true"),
|
|
16684
|
+
postType: schemas_enum([
|
|
16685
|
+
"video",
|
|
16686
|
+
"article",
|
|
16687
|
+
"all"
|
|
16688
|
+
]).optional().describe("视频号作品类型:video=视频, article=图文, all=全部")
|
|
16129
16689
|
});
|
|
16130
16690
|
const FetchArticles = async (_task, params)=>{
|
|
16131
16691
|
const { platform } = params;
|
|
@@ -16138,6 +16698,10 @@ const FetchArticles = async (_task, params)=>{
|
|
|
16138
16698
|
return handleBaijiahaoData(_task, params);
|
|
16139
16699
|
case "xiaohongshu":
|
|
16140
16700
|
return handleXiaohongshuData(_task, params);
|
|
16701
|
+
case "douyin":
|
|
16702
|
+
return handleDouyinData(_task, params);
|
|
16703
|
+
case "shipinhao":
|
|
16704
|
+
return handleShipinhaoData(_task, params);
|
|
16141
16705
|
default:
|
|
16142
16706
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({}, "暂不支持该平台");
|
|
16143
16707
|
}
|
|
@@ -17541,6 +18105,11 @@ class VideoChannelUploader {
|
|
|
17541
18105
|
this.concurrentLimit = config.concurrentLimit || 4;
|
|
17542
18106
|
this.singleFileSize = config.singleFileSize || 10485760;
|
|
17543
18107
|
this.http = config.http || new Http();
|
|
18108
|
+
this.reqOptions = {
|
|
18109
|
+
timeout: config.timeout ?? 60000,
|
|
18110
|
+
retries: config.retries ?? 3,
|
|
18111
|
+
retryDelay: config.retryDelay ?? 2000
|
|
18112
|
+
};
|
|
17544
18113
|
}
|
|
17545
18114
|
calculateMd5(buffer) {
|
|
17546
18115
|
const MAX_SIZE = 5242880;
|
|
@@ -17597,7 +18166,7 @@ class VideoChannelUploader {
|
|
|
17597
18166
|
url: filePath,
|
|
17598
18167
|
method: "get",
|
|
17599
18168
|
responseType: "arraybuffer"
|
|
17600
|
-
});
|
|
18169
|
+
}, this.reqOptions);
|
|
17601
18170
|
return Buffer.from(resp);
|
|
17602
18171
|
}
|
|
17603
18172
|
return __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].promises.readFile(filePath);
|
|
@@ -17627,7 +18196,7 @@ class VideoChannelUploader {
|
|
|
17627
18196
|
headers,
|
|
17628
18197
|
data: requestBody,
|
|
17629
18198
|
defaultErrorMsg: "获取UploadID失败"
|
|
17630
|
-
});
|
|
18199
|
+
}, this.reqOptions);
|
|
17631
18200
|
if (!resp?.UploadID) throw new Error(`获取 UploadID 失败: ${resp?.errMsg || "未知错误"}`);
|
|
17632
18201
|
return resp.UploadID;
|
|
17633
18202
|
}
|
|
@@ -17648,7 +18217,7 @@ class VideoChannelUploader {
|
|
|
17648
18217
|
headers,
|
|
17649
18218
|
data: chunk,
|
|
17650
18219
|
defaultErrorMsg: `分片 ${partNumber} 上传失败`
|
|
17651
|
-
});
|
|
18220
|
+
}, this.reqOptions);
|
|
17652
18221
|
if (resp?.errCode !== void 0 && 0 !== resp.errCode) throw new Error(`分片 ${partNumber} 上传失败: ${resp.errMsg}`);
|
|
17653
18222
|
if (onProgress) onProgress(chunk.length);
|
|
17654
18223
|
return resp.ETag || "";
|
|
@@ -17672,7 +18241,7 @@ class VideoChannelUploader {
|
|
|
17672
18241
|
headers,
|
|
17673
18242
|
data: requestBody,
|
|
17674
18243
|
defaultErrorMsg: "确认分片上传失败"
|
|
17675
|
-
});
|
|
18244
|
+
}, this.reqOptions);
|
|
17676
18245
|
if (resp?.ListPartsResult?.Part) return resp.ListPartsResult.Part.map((p)=>({
|
|
17677
18246
|
PartNumber: parseInt(p.PartNumber),
|
|
17678
18247
|
ETag: p.ETag
|
|
@@ -17698,7 +18267,7 @@ class VideoChannelUploader {
|
|
|
17698
18267
|
headers,
|
|
17699
18268
|
data: requestBody,
|
|
17700
18269
|
defaultErrorMsg: "完成上传失败"
|
|
17701
|
-
});
|
|
18270
|
+
}, this.reqOptions);
|
|
17702
18271
|
if (!resp?.DownloadURL) throw new Error(`完成上传失败: ${resp?.errMsg || "未知错误"}`);
|
|
17703
18272
|
return resp.DownloadURL;
|
|
17704
18273
|
}
|
|
@@ -18049,7 +18618,9 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18049
18618
|
task.logger.info("[shipinhaoPublish] 开始执行视频号发布 - Mock API 方式");
|
|
18050
18619
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
18051
18620
|
if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "fingerPrintDeviceId和aId 不能为空", "");
|
|
18621
|
+
let currentStep = "初始化";
|
|
18052
18622
|
try {
|
|
18623
|
+
currentStep = "解析认证信息";
|
|
18053
18624
|
const cookieString = params.cookies.map((c)=>`${c.name}=${c.value}`).join("; ");
|
|
18054
18625
|
const fingerPrintDeviceId = params.extraParam.fingerPrintDeviceId;
|
|
18055
18626
|
const aId = params.extraParam.aId;
|
|
@@ -18070,8 +18641,10 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18070
18641
|
headers
|
|
18071
18642
|
});
|
|
18072
18643
|
const proxyHttp = new Http(...args);
|
|
18644
|
+
currentStep = "验证发布参数";
|
|
18073
18645
|
if (!params.banners || 0 === params.banners.length) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "至少需要一张图片", "");
|
|
18074
18646
|
const images = params.banners.slice(0, 18).filter((img)=>"string" == typeof img);
|
|
18647
|
+
currentStep = "获取用户信息";
|
|
18075
18648
|
task.logger.info("[shipinhaoPublish] 获取用户信息...");
|
|
18076
18649
|
console.log("cookieString", cookieString);
|
|
18077
18650
|
const userInfo = await mock_getUserInfo(cookieString, http);
|
|
@@ -18082,6 +18655,7 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18082
18655
|
}
|
|
18083
18656
|
const finderUsername = userInfo.data.finderUser.finderUsername;
|
|
18084
18657
|
console.log(finderUsername);
|
|
18658
|
+
currentStep = "获取上传认证密钥";
|
|
18085
18659
|
task.logger.info("[shipinhaoPublish] 获取上传认证密钥...");
|
|
18086
18660
|
const authKeyResponse = await getUploadAuthKey(cookieString, finderUsername, http);
|
|
18087
18661
|
if (0 !== authKeyResponse.errCode || !authKeyResponse.data?.authKey) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(authKeyResponse.errCode || 500, `获取上传认证参数失败: ${authKeyResponse.errMsg}`, "");
|
|
@@ -18089,10 +18663,12 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18089
18663
|
const uin = authKeyResponse.data.uin;
|
|
18090
18664
|
if (!uin) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, "获取用户 uin 失败", "");
|
|
18091
18665
|
const taskId = String(generateUUID());
|
|
18666
|
+
currentStep = "上传图片";
|
|
18092
18667
|
task.logger.info(`[shipinhaoPublish] 开始上传 ${images.length} 张图片...`);
|
|
18093
18668
|
const uploadedImages = [];
|
|
18094
18669
|
for(let i = 0; i < images.length; i++){
|
|
18095
|
-
|
|
18670
|
+
currentStep = `上传图片 ${i + 1}/${images.length}`;
|
|
18671
|
+
task.logger.info(`[shipinhaoPublish] ${currentStep}...`);
|
|
18096
18672
|
const uploadResult = await uploadImageComplete(images[i], taskId, finderUsername, uin, authKey, http);
|
|
18097
18673
|
console.log(JSON.stringify(uploadResult));
|
|
18098
18674
|
if (!uploadResult.DownloadURL) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, `图片上传失败: ${uploadResult.errMsg}`, "");
|
|
@@ -18109,6 +18685,7 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18109
18685
|
urlCdnTaskId: ""
|
|
18110
18686
|
});
|
|
18111
18687
|
}
|
|
18688
|
+
currentStep = "发布图文内容";
|
|
18112
18689
|
task.logger.info("[shipinhaoPublish] 正在发布...");
|
|
18113
18690
|
const topicNames = params.topic || void 0;
|
|
18114
18691
|
const addressInfo = params.address ? {
|
|
@@ -18195,9 +18772,15 @@ const shipinhaoPublish_mock_mockAction = async (task, params)=>{
|
|
|
18195
18772
|
});
|
|
18196
18773
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(resultCode || 500, errorMessage, "");
|
|
18197
18774
|
} catch (error) {
|
|
18198
|
-
const
|
|
18199
|
-
|
|
18200
|
-
|
|
18775
|
+
const handledError = Http.handleApiError(error);
|
|
18776
|
+
const errorMsg = handledError.message || "发布失败,请稍后重试";
|
|
18777
|
+
const errorCode = handledError.code || 500;
|
|
18778
|
+
task.logger.error(`[shipinhaoPublish] 发布流程异常: ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
18779
|
+
await updateTaskState?.({
|
|
18780
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.FAILED,
|
|
18781
|
+
error: errorMsg
|
|
18782
|
+
});
|
|
18783
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(errorCode, errorMsg, "");
|
|
18201
18784
|
}
|
|
18202
18785
|
};
|
|
18203
18786
|
const shipinhaoPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -24703,6 +25286,24 @@ const bjhConfigDataSchema = schemas_object({
|
|
|
24703
25286
|
likeNumYesterday: schemas_number().nullable(),
|
|
24704
25287
|
commentNumYesterday: schemas_number().nullable()
|
|
24705
25288
|
});
|
|
25289
|
+
const douyinConfigDataSchema = schemas_object({
|
|
25290
|
+
fansNum: schemas_number(),
|
|
25291
|
+
favedNum: schemas_number(),
|
|
25292
|
+
fansNumLastWeek: schemas_number(),
|
|
25293
|
+
watchNumLastWeek: schemas_number(),
|
|
25294
|
+
likeNumLastWeek: schemas_number(),
|
|
25295
|
+
commentNumLastWeek: schemas_number(),
|
|
25296
|
+
shareNumLastWeek: schemas_number(),
|
|
25297
|
+
visitNumLastWeek: schemas_number()
|
|
25298
|
+
});
|
|
25299
|
+
const shipinhaoConfigDataSchema = schemas_object({
|
|
25300
|
+
fansNum: schemas_number(),
|
|
25301
|
+
feedsCount: schemas_number(),
|
|
25302
|
+
fansNumYesterday: schemas_number().nullable(),
|
|
25303
|
+
playNumYesterday: schemas_number().nullable(),
|
|
25304
|
+
likeNumYesterday: schemas_number().nullable(),
|
|
25305
|
+
commentNumYesterday: schemas_number().nullable()
|
|
25306
|
+
});
|
|
24706
25307
|
const BetaFlag = "HuiwenCanary";
|
|
24707
25308
|
class Action {
|
|
24708
25309
|
constructor(task){
|
|
@@ -24985,6 +25586,6 @@ class Action {
|
|
|
24985
25586
|
}
|
|
24986
25587
|
}
|
|
24987
25588
|
var __webpack_exports__version = package_namespaceObject.i8;
|
|
24988
|
-
export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
|
|
25589
|
+
export { Action, ActionCommonParamsSchema, BaijiahaoPublishParamsSchema, BetaFlag, CollectionDetailSchema, ConfigDataSchema, DouyinCheckVerifyQrCodeParamsSchema, DouyinCreateCommentReplyParamsSchema, DouyinGetCollectionParamsSchema, DouyinGetCommentListParamsSchema, DouyinGetCommentReplyListParamsSchema, DouyinGetHotParamsSchema, DouyinGetLocationParamsSchema, DouyinGetMusicByCategoryParamsSchema, DouyinGetMusicCategoryParamsSchema, DouyinGetMusicParamsSchema, DouyinGetTopicsParamsSchema, DouyinGetVerifyQrCodeParamsSchema, DouyinGetWorkListParamsSchema, DouyinPublishParamsSchema, FetchArticlesDataSchema, FetchArticlesParamsSchema, Http, ProxyAgent, SearchAccountInfoParamsSchema, SessionCheckResultSchema, ShipinhaoCheckLinkValidateParamsSchema, ShipinhaoGetLocationParamsSchema, ShipinhaoGetMsgParamsSchema, ShipinhaoPublishParamsSchema, ShipinhaoSendMsgParamsSchema, ToutiaoPublishParamsSchema, UnreadCountSchema, WeixinPublishParamsSchema, WxBjhSessionParamsSchema, XhsWebSearchParamsSchema, XiaohongshuPublishParamsSchema, bjhConfigDataSchema, douyinConfigDataSchema, getFileState, reportLogger, rpaAction_Server_Mock, shipinhaoConfigDataSchema, ttConfigDataSchema, wxConfigDataSchema, xhsConfigDataSchema, __webpack_exports__version as version };
|
|
24989
25590
|
|
|
24990
25591
|
//# sourceMappingURL=index.mjs.map
|