@iflyrpa/actions 4.0.4-beta.2 → 4.0.4-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +408 -371
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +406 -369
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +405 -370
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!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]="
|
|
2
|
+
!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]="6b7b33da-d2a4-5623-b09a-756a2fe8a917")}catch(e){}}();
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
4
|
"./src/utils/XhsXsCommonEnc.js": function(module) {
|
|
5
5
|
var encrypt_lookup = [
|
|
@@ -4396,11 +4396,13 @@ var __webpack_exports__ = {};
|
|
|
4396
4396
|
bjhConfigDataSchema: ()=>bjhConfigDataSchema,
|
|
4397
4397
|
Action: ()=>Action,
|
|
4398
4398
|
ProxyAgent: ()=>ProxyAgent,
|
|
4399
|
+
douyinConfigDataSchema: ()=>douyinConfigDataSchema,
|
|
4400
|
+
shipinhaoConfigDataSchema: ()=>shipinhaoConfigDataSchema,
|
|
4399
4401
|
version: ()=>package_namespaceObject.i8
|
|
4400
4402
|
});
|
|
4401
4403
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4402
4404
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4403
|
-
var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.
|
|
4405
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.3"}');
|
|
4404
4406
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4405
4407
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4406
4408
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -13443,400 +13445,421 @@ var __webpack_exports__ = {};
|
|
|
13443
13445
|
}
|
|
13444
13446
|
return randomString;
|
|
13445
13447
|
}
|
|
13448
|
+
function safeSerialize(obj) {
|
|
13449
|
+
if (!obj || "object" != typeof obj) return obj;
|
|
13450
|
+
try {
|
|
13451
|
+
return JSON.parse(JSON.stringify(obj));
|
|
13452
|
+
} catch (error) {
|
|
13453
|
+
return {};
|
|
13454
|
+
}
|
|
13455
|
+
}
|
|
13446
13456
|
const mock_mockAction = async (task, params)=>{
|
|
13447
13457
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
13448
13458
|
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, share_namespaceObject.response)(414, "extraParam 参数缺失或不完整", "");
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
|
|
13473
|
-
|
|
13474
|
-
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13459
|
+
let currentStep = "初始化";
|
|
13460
|
+
try {
|
|
13461
|
+
currentStep = "验证账号信息";
|
|
13462
|
+
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";
|
|
13463
|
+
const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
13464
|
+
if (!sessionidCookie) return {
|
|
13465
|
+
code: 414,
|
|
13466
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
13467
|
+
data: ""
|
|
13468
|
+
};
|
|
13469
|
+
currentStep = "准备请求参数";
|
|
13470
|
+
const headers = {
|
|
13471
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
13472
|
+
origin: "https://creator.douyin.com",
|
|
13473
|
+
referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13474
|
+
Accept: "application/json, text/plain, */*",
|
|
13475
|
+
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
13476
|
+
"Content-Type": "application/json",
|
|
13477
|
+
pragma: "no-cache",
|
|
13478
|
+
"cache-control": "no-cache",
|
|
13479
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
13480
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
13481
|
+
"bd-ticket-guard-web-version": "2",
|
|
13482
|
+
"sec-ch-ua-mobile": "?0",
|
|
13483
|
+
"user-agent": userAgent,
|
|
13484
|
+
"sec-fetch-site": "same-origin",
|
|
13485
|
+
"sec-fetch-mode": "cors",
|
|
13486
|
+
"sec-fetch-dest": "empty",
|
|
13487
|
+
"accept-language": "zh-CN,zh;q=0.9",
|
|
13488
|
+
priority: "u=1, i"
|
|
13489
|
+
};
|
|
13490
|
+
const publishParams = {
|
|
13491
|
+
read_aid: "2906",
|
|
13492
|
+
aid: "1128",
|
|
13493
|
+
cookie_enabled: "true",
|
|
13494
|
+
screen_width: params.extraParam?.browserInfo.screen_width || "1920",
|
|
13495
|
+
screen_height: params.extraParam?.browserInfo.screen_height || "1080",
|
|
13496
|
+
browser_language: params.extraParam?.browserInfo.browser_language || "zh-CN",
|
|
13497
|
+
browser_platform: params.extraParam?.browserInfo.browser_platform || "Win32",
|
|
13498
|
+
browser_name: params.extraParam?.browserInfo.browser_name || "Mozilla",
|
|
13499
|
+
browser_version: userAgent,
|
|
13500
|
+
browser_online: "true",
|
|
13501
|
+
timezone_name: "Asia/Shanghai",
|
|
13502
|
+
support_h265: "1",
|
|
13503
|
+
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
13504
|
+
a_bogus: ""
|
|
13505
|
+
};
|
|
13506
|
+
task.logger.info(`[douyinPublish] publishParams ${JSON.stringify(publishParams)}`);
|
|
13507
|
+
const publishData = {
|
|
13508
|
+
item: {
|
|
13509
|
+
common: {
|
|
13510
|
+
text: params.content,
|
|
13511
|
+
text_extra: params.textExtra,
|
|
13512
|
+
activity: "[]",
|
|
13513
|
+
challenges: params.challengeIds || "[]",
|
|
13514
|
+
hashtag_source: "",
|
|
13515
|
+
mentions: "[]",
|
|
13516
|
+
music_id: params.musicId || "",
|
|
13517
|
+
music_end_time: 1000 * (params.musicDuration || 0),
|
|
13518
|
+
hot_sentence: params.hotSentence || "",
|
|
13519
|
+
visibility_type: Number(params.visibleRange) || 0,
|
|
13520
|
+
download: params.allowSave ? 1 : 0,
|
|
13521
|
+
timing: params.isImmediatelyPublish ? -1 : params.scheduledPublish,
|
|
13522
|
+
media_type: Number(params.publishType) || 2,
|
|
13523
|
+
images: [],
|
|
13524
|
+
creation_id: ""
|
|
13525
|
+
},
|
|
13526
|
+
cover: {
|
|
13527
|
+
poster: ""
|
|
13528
|
+
},
|
|
13529
|
+
mix: params.mix ? {
|
|
13530
|
+
mix_id: params.mix.mix_id,
|
|
13531
|
+
mix_order: params.mix.mix_order || 0
|
|
13532
|
+
} : {},
|
|
13533
|
+
anchor: {},
|
|
13534
|
+
declare: {
|
|
13535
|
+
user_declare_info: "{}"
|
|
13536
|
+
}
|
|
13537
|
+
}
|
|
13538
|
+
};
|
|
13539
|
+
const args = [
|
|
13540
|
+
{
|
|
13541
|
+
headers
|
|
13514
13542
|
},
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13543
|
+
task.logger,
|
|
13544
|
+
"",
|
|
13545
|
+
"",
|
|
13546
|
+
params.accountId,
|
|
13547
|
+
"douyin"
|
|
13548
|
+
];
|
|
13549
|
+
const http = new Http({
|
|
13550
|
+
headers
|
|
13551
|
+
});
|
|
13552
|
+
const proxyHttp = new Http(...args);
|
|
13553
|
+
const uploadedImgList = params.uploadedImgList ? JSON.parse(params.uploadedImgList) : [];
|
|
13554
|
+
if (uploadedImgList.length > 0) publishData.item.common.images = uploadedImgList;
|
|
13555
|
+
else {
|
|
13556
|
+
const tmpCachePath = task.getTmpPath();
|
|
13557
|
+
const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
|
|
13558
|
+
if (params.coverImage) {
|
|
13559
|
+
const cover = await uploader.uploadCover(params.coverImage);
|
|
13560
|
+
if (cover) {
|
|
13561
|
+
publishData.item.common.images.push({
|
|
13562
|
+
uri: cover.uri,
|
|
13563
|
+
width: cover.width,
|
|
13564
|
+
height: cover.height
|
|
13565
|
+
});
|
|
13566
|
+
publishData.item.cover = {
|
|
13567
|
+
poster: cover.uri
|
|
13568
|
+
};
|
|
13569
|
+
}
|
|
13570
|
+
}
|
|
13571
|
+
if (params.banners && params.banners.length > 0) {
|
|
13572
|
+
const banners = params.banners.filter((i)=>i !== params.coverImage);
|
|
13573
|
+
const uploadResults = await uploader.uploadImages(banners);
|
|
13574
|
+
publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
|
|
13575
|
+
uri: result.uri,
|
|
13576
|
+
width: result.width,
|
|
13577
|
+
height: result.height
|
|
13578
|
+
})));
|
|
13522
13579
|
}
|
|
13523
13580
|
}
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
{
|
|
13527
|
-
headers
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
|
|
13543
|
-
const uploader = new DouyinImageUploader(proxyHttp, headers, publishParams, tmpCachePath);
|
|
13544
|
-
if (params.coverImage) {
|
|
13545
|
-
const cover = await uploader.uploadCover(params.coverImage);
|
|
13546
|
-
if (cover) {
|
|
13547
|
-
publishData.item.common.images.push({
|
|
13548
|
-
uri: cover.uri,
|
|
13549
|
-
width: cover.width,
|
|
13550
|
-
height: cover.height
|
|
13551
|
-
});
|
|
13552
|
-
publishData.item.cover = {
|
|
13553
|
-
poster: cover.uri
|
|
13581
|
+
publishData.item.common.creation_id = generateRandomString(8) + Date.now();
|
|
13582
|
+
let decision = null;
|
|
13583
|
+
proxyHttp.addResponseInterceptor((response)=>{
|
|
13584
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.headers: ${JSON.stringify(response.headers)} `);
|
|
13585
|
+
task.logger.info(`[douyinPublish] 拦截器收到响应response.data: ${JSON.stringify(response.data)} `);
|
|
13586
|
+
decision = parseVerifyPassportDecision(response.headers["x-tt-verify-passport-decision"]);
|
|
13587
|
+
if (needsVerification(decision)) {
|
|
13588
|
+
task.logger.info(`[douyinPublish] 检测到需要验证: ${JSON.stringify(decision)}`);
|
|
13589
|
+
return;
|
|
13590
|
+
}
|
|
13591
|
+
if (!response || !response.data) return;
|
|
13592
|
+
const responseData = response.data;
|
|
13593
|
+
if (response && responseData?.status_code && 0 !== responseData.status_code) {
|
|
13594
|
+
const errorCode = 4 === responseData.status_code ? 500 : responseData.status_code;
|
|
13595
|
+
if (4 === responseData.status_code) task.logger.warn(`[douyinPublish] 抖音服务器错误 status_code: 4,映射为 500 触发重试。原始响应: ${JSON.stringify(responseData)}`);
|
|
13596
|
+
return {
|
|
13597
|
+
code: errorCode,
|
|
13598
|
+
message: responseData.status_msg || "文章发布异常,请稍后重试。",
|
|
13599
|
+
data: responseData
|
|
13554
13600
|
};
|
|
13555
13601
|
}
|
|
13602
|
+
});
|
|
13603
|
+
task._timerRecord.PrePublish = Date.now();
|
|
13604
|
+
if (MockPublish) {
|
|
13605
|
+
const data = "123456789";
|
|
13606
|
+
const message = `图文模拟发布成功 ${http.proxyInfo}`;
|
|
13607
|
+
await updateTaskState?.({
|
|
13608
|
+
state: share_namespaceObject.TaskState.SUCCESS,
|
|
13609
|
+
result: {
|
|
13610
|
+
response: data
|
|
13611
|
+
}
|
|
13612
|
+
});
|
|
13613
|
+
return (0, share_namespaceObject.response)(0, message, data);
|
|
13556
13614
|
}
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13615
|
+
let webProtectData;
|
|
13616
|
+
try {
|
|
13617
|
+
webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
13618
|
+
if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
|
|
13619
|
+
task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
|
|
13620
|
+
return (0, share_namespaceObject.response)(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
|
|
13621
|
+
}
|
|
13622
|
+
} catch (error) {
|
|
13623
|
+
task.logger.error(`解析 webProtectData 失败: ${error}`);
|
|
13624
|
+
return (0, share_namespaceObject.response)(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
|
|
13625
|
+
}
|
|
13626
|
+
let ticket = webProtectData.ticket;
|
|
13627
|
+
let ts_sign = webProtectData.ts_sign;
|
|
13628
|
+
const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
|
|
13629
|
+
if (serverDataCookie) try {
|
|
13630
|
+
const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
|
|
13631
|
+
if (decoded.ticket && decoded.ts_sign) {
|
|
13632
|
+
if (decoded.ticket !== ticket) task.logger.info("[douyinPublish] 使用 cookie 中的最新 ticket(web_protect 已过期)");
|
|
13633
|
+
ticket = decoded.ticket;
|
|
13634
|
+
ts_sign = decoded.ts_sign;
|
|
13635
|
+
}
|
|
13636
|
+
} catch (error) {
|
|
13637
|
+
task.logger.info(`[douyinPublish] 解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
|
|
13576
13638
|
}
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13639
|
+
let ec_privateKey;
|
|
13640
|
+
try {
|
|
13641
|
+
ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
|
|
13642
|
+
if (!ec_privateKey) {
|
|
13643
|
+
task.logger.error("[douyinPublish] ec_privateKey 为空");
|
|
13644
|
+
return (0, share_namespaceObject.response)(414, "安全参数 ec_privateKey 缺失,请重新获取后重试", "");
|
|
13645
|
+
}
|
|
13646
|
+
} catch (error) {
|
|
13647
|
+
task.logger.error(`[douyinPublish] 解析 ec_privateKey 失败: ${error}`);
|
|
13648
|
+
return (0, share_namespaceObject.response)(414, "安全参数 ec_privateKey 解析失败,请重新获取后重试", "");
|
|
13587
13649
|
}
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
state: share_namespaceObject.TaskState.SUCCESS,
|
|
13595
|
-
result: {
|
|
13596
|
-
response: data
|
|
13650
|
+
let certificate;
|
|
13651
|
+
try {
|
|
13652
|
+
certificate = JSON.parse(params.extraParam["security-sdk/s_sdk_server_cert_key"] || "{}").cert;
|
|
13653
|
+
if (!certificate) {
|
|
13654
|
+
task.logger.error("[douyinPublish] certificate 为空");
|
|
13655
|
+
return (0, share_namespaceObject.response)(414, "安全参数 certificate 缺失,请重新获取后重试", "");
|
|
13597
13656
|
}
|
|
13598
|
-
})
|
|
13599
|
-
|
|
13600
|
-
|
|
13601
|
-
let webProtectData;
|
|
13602
|
-
try {
|
|
13603
|
-
webProtectData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
13604
|
-
if (!webProtectData.ticket || !webProtectData.ts_sign || !webProtectData.client_cert) {
|
|
13605
|
-
task.logger.error(`webProtectData 关键字段缺失: ${JSON.stringify(webProtectData)}`);
|
|
13606
|
-
return (0, share_namespaceObject.response)(414, "安全参数 webProtectData 不完整,请重新获取后重试", "");
|
|
13657
|
+
} catch (error) {
|
|
13658
|
+
task.logger.error(`[douyinPublish] 解析 certificate 失败: ${error}`);
|
|
13659
|
+
return (0, share_namespaceObject.response)(414, "安全参数 certificate 解析失败,请重新获取后重试", "");
|
|
13607
13660
|
}
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
if (
|
|
13619
|
-
|
|
13620
|
-
|
|
13661
|
+
const ree_public_key = webProtectData.client_cert.replace("pub.", "");
|
|
13662
|
+
let bdTicketGuardClientData;
|
|
13663
|
+
try {
|
|
13664
|
+
bdTicketGuardClientData = getBdV2({
|
|
13665
|
+
ticket,
|
|
13666
|
+
ts_sign: ts_sign,
|
|
13667
|
+
ec_privateKey: ec_privateKey,
|
|
13668
|
+
certificate: certificate,
|
|
13669
|
+
bd_ticket_guard_ree_public_key: ree_public_key
|
|
13670
|
+
});
|
|
13671
|
+
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
13672
|
+
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
13673
|
+
return (0, share_namespaceObject.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
13674
|
+
}
|
|
13675
|
+
} catch (error) {
|
|
13676
|
+
task.logger.error(`[douyinPublish] 生成 bdTicketGuardClientData 失败: ${error}`);
|
|
13677
|
+
return (0, share_namespaceObject.response)(414, "安全参数 bdTicketGuardClientData 生成异常,请重新获取后重试", "");
|
|
13621
13678
|
}
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13679
|
+
task.logger.info("[douyinPublish] bdTicketGuardClientData 生成成功");
|
|
13680
|
+
const publishQuery = {
|
|
13681
|
+
...publishParams,
|
|
13682
|
+
a_bogus: ""
|
|
13683
|
+
};
|
|
13684
|
+
const queryString = new URLSearchParams(publishQuery).toString();
|
|
13685
|
+
let aBogus;
|
|
13686
|
+
try {
|
|
13687
|
+
aBogus = mock_getABogus(`https://creator.douyin.com/web/api/media/aweme/create_v2/?${queryString}`, publishData, userAgent);
|
|
13688
|
+
if (!aBogus || aBogus.length < 10) {
|
|
13689
|
+
task.logger.error(`[douyinPublish] a_bogus 生成异常,长度过短: ${aBogus}`);
|
|
13690
|
+
return (0, share_namespaceObject.response)(414, "安全参数 a_bogus 生成失败,请重试", "");
|
|
13691
|
+
}
|
|
13692
|
+
} catch (error) {
|
|
13693
|
+
task.logger.error(`[douyinPublish] 生成 a_bogus 失败: ${error}`);
|
|
13694
|
+
return (0, share_namespaceObject.response)(414, "安全参数 a_bogus 生成异常,请重试", "");
|
|
13631
13695
|
}
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13696
|
+
publishQuery.a_bogus = aBogus;
|
|
13697
|
+
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
13698
|
+
let csrfToken;
|
|
13699
|
+
try {
|
|
13700
|
+
csrfToken = mock_generateCsrfTokenAdvanced({
|
|
13701
|
+
cookies: params.cookies,
|
|
13702
|
+
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
13703
|
+
method: "POST",
|
|
13704
|
+
userAgent
|
|
13705
|
+
});
|
|
13706
|
+
if (!csrfToken || csrfToken.length < 10) {
|
|
13707
|
+
task.logger.error(`[douyinPublish] csrfToken 生成异常,长度过短: ${csrfToken}`);
|
|
13708
|
+
return (0, share_namespaceObject.response)(414, "安全参数 csrfToken 生成失败,请重试", "");
|
|
13709
|
+
}
|
|
13710
|
+
task.logger.info(`[douyinPublish] csrfToken 生成成功: ${csrfToken.substring(0, 20)}...`);
|
|
13711
|
+
} catch (error) {
|
|
13712
|
+
task.logger.error(`[douyinPublish] 生成 csrfToken 失败: ${error}`);
|
|
13713
|
+
return (0, share_namespaceObject.response)(414, "安全参数 csrfToken 生成异常,请重试", "");
|
|
13642
13714
|
}
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
bdTicketGuardClientData = getBdV2({
|
|
13651
|
-
ticket,
|
|
13652
|
-
ts_sign: ts_sign,
|
|
13653
|
-
ec_privateKey: ec_privateKey,
|
|
13654
|
-
certificate: certificate,
|
|
13655
|
-
bd_ticket_guard_ree_public_key: ree_public_key
|
|
13656
|
-
});
|
|
13657
|
-
if (!bdTicketGuardClientData || !bdTicketGuardClientData["headers_bd_ticket_guard_client_data"]) {
|
|
13658
|
-
task.logger.error(`[douyinPublish] bdTicketGuardClientData 生成失败或不完整: ${JSON.stringify(bdTicketGuardClientData)}`);
|
|
13659
|
-
return (0, share_namespaceObject.response)(414, "安全参数 bdTicketGuardClientData 生成失败,请重新获取后重试", "");
|
|
13715
|
+
let sessionDtrait;
|
|
13716
|
+
try {
|
|
13717
|
+
sessionDtrait = mock_generateDtrait("/web/api/media/aweme/create_v2/");
|
|
13718
|
+
task.logger.info(`[douyinPublish] sessionDtrait 生成成功: ${sessionDtrait || "(空)"}`);
|
|
13719
|
+
} catch (error) {
|
|
13720
|
+
task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
|
|
13721
|
+
return (0, share_namespaceObject.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
|
|
13660
13722
|
}
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13723
|
+
task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
|
|
13724
|
+
...headers,
|
|
13725
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13726
|
+
"Content-Type": "application/json",
|
|
13727
|
+
Accept: "application/json, text/plain, */*",
|
|
13728
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13729
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13730
|
+
"bd-ticket-guard-version": "2",
|
|
13731
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
13732
|
+
"bd-ticket-guard-web-version": "2",
|
|
13733
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
13734
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13735
|
+
})}`);
|
|
13736
|
+
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
13737
|
+
let publishResult;
|
|
13738
|
+
try {
|
|
13739
|
+
publishResult = await proxyHttp.api({
|
|
13740
|
+
method: "post",
|
|
13741
|
+
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
13742
|
+
data: publishData,
|
|
13743
|
+
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
13744
|
+
headers: {
|
|
13745
|
+
...headers,
|
|
13746
|
+
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13747
|
+
"Content-Type": "application/json",
|
|
13748
|
+
Accept: "application/json, text/plain, */*",
|
|
13749
|
+
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13750
|
+
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13751
|
+
"bd-ticket-guard-version": "2",
|
|
13752
|
+
"bd-ticket-guard-web-sign-type": "1",
|
|
13753
|
+
"bd-ticket-guard-web-version": "2",
|
|
13754
|
+
"x-secsdk-csrf-token": csrfToken,
|
|
13755
|
+
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13756
|
+
}
|
|
13757
|
+
}, {
|
|
13758
|
+
timeout: 60000,
|
|
13759
|
+
retries: 3,
|
|
13760
|
+
retryDelay: 2000
|
|
13761
|
+
});
|
|
13762
|
+
} catch (error) {
|
|
13763
|
+
const handledError = Http.handleApiError(error);
|
|
13764
|
+
const isProxyOrNetworkError = [
|
|
13765
|
+
599,
|
|
13766
|
+
500,
|
|
13767
|
+
502,
|
|
13768
|
+
503,
|
|
13769
|
+
504
|
|
13770
|
+
].includes(handledError.code);
|
|
13771
|
+
if (isProxyOrNetworkError) {
|
|
13772
|
+
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13773
|
+
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13774
|
+
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13775
|
+
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13776
|
+
await updateTaskState?.({
|
|
13777
|
+
state: share_namespaceObject.TaskState.FAILED,
|
|
13778
|
+
error: message
|
|
13779
|
+
});
|
|
13780
|
+
return {
|
|
13781
|
+
code: 414,
|
|
13782
|
+
data: "",
|
|
13783
|
+
message
|
|
13784
|
+
};
|
|
13785
|
+
}
|
|
13786
|
+
throw error;
|
|
13677
13787
|
}
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13788
|
+
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
13789
|
+
if (needsVerification(decision)) {
|
|
13790
|
+
const details = [
|
|
13791
|
+
publishResult.status_msg,
|
|
13792
|
+
decision?.verify_title,
|
|
13793
|
+
decision?.verify_desc
|
|
13794
|
+
].filter(Boolean).join(" ");
|
|
13795
|
+
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13796
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
13797
|
+
const mockData = {
|
|
13798
|
+
state: share_namespaceObject.TaskState.FAILED,
|
|
13799
|
+
error: message,
|
|
13800
|
+
result: {
|
|
13801
|
+
...safeDecision,
|
|
13802
|
+
data: safeDecision,
|
|
13803
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13804
|
+
}
|
|
13805
|
+
};
|
|
13806
|
+
await updateTaskState?.(mockData);
|
|
13807
|
+
return {
|
|
13808
|
+
code: 0,
|
|
13809
|
+
data: mockData,
|
|
13810
|
+
message: "操作成功"
|
|
13811
|
+
};
|
|
13695
13812
|
}
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
|
|
13704
|
-
|
|
13705
|
-
|
|
13706
|
-
task.logger.error(`[douyinPublish] 生成 sessionDtrait 失败: ${error}`);
|
|
13707
|
-
return (0, share_namespaceObject.response)(414, "安全参数 sessionDtrait 生成异常,请重试", "");
|
|
13708
|
-
}
|
|
13709
|
-
task.logger.info(`[douyinPublish] headers: ${JSON.stringify({
|
|
13710
|
-
...headers,
|
|
13711
|
-
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13712
|
-
"Content-Type": "application/json",
|
|
13713
|
-
Accept: "application/json, text/plain, */*",
|
|
13714
|
-
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13715
|
-
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13716
|
-
"bd-ticket-guard-version": "2",
|
|
13717
|
-
"bd-ticket-guard-web-sign-type": "1",
|
|
13718
|
-
"bd-ticket-guard-web-version": "2",
|
|
13719
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
13720
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13721
|
-
})}`);
|
|
13722
|
-
task.logger.info(`[douyinPublish] url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
|
|
13723
|
-
let publishResult;
|
|
13724
|
-
try {
|
|
13725
|
-
publishResult = await proxyHttp.api({
|
|
13726
|
-
method: "post",
|
|
13727
|
-
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
13728
|
-
data: publishData,
|
|
13729
|
-
defaultErrorMsg: "发布异常,请稍后重试。",
|
|
13730
|
-
headers: {
|
|
13731
|
-
...headers,
|
|
13732
|
-
Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
|
|
13733
|
-
"Content-Type": "application/json",
|
|
13734
|
-
Accept: "application/json, text/plain, */*",
|
|
13735
|
-
"bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
|
|
13736
|
-
"bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
|
|
13737
|
-
"bd-ticket-guard-version": "2",
|
|
13738
|
-
"bd-ticket-guard-web-sign-type": "1",
|
|
13739
|
-
"bd-ticket-guard-web-version": "2",
|
|
13740
|
-
"x-secsdk-csrf-token": csrfToken,
|
|
13741
|
-
"x-tt-session-dtrait": sessionDtrait || ""
|
|
13742
|
-
}
|
|
13743
|
-
}, {
|
|
13744
|
-
timeout: 60000,
|
|
13745
|
-
retries: 3,
|
|
13746
|
-
retryDelay: 2000
|
|
13813
|
+
reportLogger({
|
|
13814
|
+
token: params.huiwenToken || "",
|
|
13815
|
+
enverionment: task.enverionment || "development",
|
|
13816
|
+
postId: params.articleId,
|
|
13817
|
+
eip: proxyHttp.proxyInfo,
|
|
13818
|
+
proxyIp: params.localIP,
|
|
13819
|
+
accountId: params.accountId,
|
|
13820
|
+
uid: params.uid,
|
|
13821
|
+
platform: "douyin",
|
|
13822
|
+
publishParams: publishData
|
|
13747
13823
|
});
|
|
13748
|
-
|
|
13749
|
-
const
|
|
13750
|
-
const
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
503,
|
|
13755
|
-
504
|
|
13756
|
-
].includes(handledError.code);
|
|
13757
|
-
if (isProxyOrNetworkError) {
|
|
13758
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13759
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13760
|
-
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13761
|
-
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13824
|
+
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
13825
|
+
const isSuccess = 0 === publishResult.status_code;
|
|
13826
|
+
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13827
|
+
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
13828
|
+
if (!isSuccess) {
|
|
13829
|
+
const safeDecision = safeSerialize(decision) ?? {};
|
|
13762
13830
|
await updateTaskState?.({
|
|
13763
13831
|
state: share_namespaceObject.TaskState.FAILED,
|
|
13764
|
-
error: message
|
|
13832
|
+
error: message,
|
|
13833
|
+
result: {
|
|
13834
|
+
...safeDecision,
|
|
13835
|
+
data: safeDecision,
|
|
13836
|
+
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13837
|
+
}
|
|
13765
13838
|
});
|
|
13766
13839
|
return {
|
|
13767
13840
|
code: 414,
|
|
13768
|
-
data:
|
|
13841
|
+
data: safeDecision,
|
|
13769
13842
|
message
|
|
13770
13843
|
};
|
|
13771
13844
|
}
|
|
13772
|
-
|
|
13773
|
-
|
|
13774
|
-
task.logger.info(`[douyinPublish] decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
|
|
13775
|
-
if (needsVerification(decision)) {
|
|
13776
|
-
const details = [
|
|
13777
|
-
publishResult.status_msg,
|
|
13778
|
-
decision?.verify_title,
|
|
13779
|
-
decision?.verify_desc
|
|
13780
|
-
].filter(Boolean).join(" ");
|
|
13781
|
-
const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13782
|
-
let decisionObj = {};
|
|
13783
|
-
if (decision) decisionObj = decision;
|
|
13784
|
-
const mockData = {
|
|
13785
|
-
state: share_namespaceObject.TaskState.FAILED,
|
|
13786
|
-
error: message,
|
|
13845
|
+
await updateTaskState?.({
|
|
13846
|
+
state: share_namespaceObject.TaskState.SUCCESS,
|
|
13787
13847
|
result: {
|
|
13788
|
-
|
|
13789
|
-
data: decision,
|
|
13790
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13848
|
+
response: data
|
|
13791
13849
|
}
|
|
13792
|
-
};
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
|
|
13797
|
-
|
|
13798
|
-
};
|
|
13799
|
-
}
|
|
13800
|
-
reportLogger({
|
|
13801
|
-
token: params.huiwenToken || "",
|
|
13802
|
-
enverionment: task.enverionment || "development",
|
|
13803
|
-
postId: params.articleId,
|
|
13804
|
-
eip: proxyHttp.proxyInfo,
|
|
13805
|
-
proxyIp: params.localIP,
|
|
13806
|
-
accountId: params.accountId,
|
|
13807
|
-
uid: params.uid,
|
|
13808
|
-
platform: "douyin",
|
|
13809
|
-
publishParams: publishData
|
|
13810
|
-
});
|
|
13811
|
-
task.logger.info(`[douyinPublish] 发布结果 ${JSON.stringify(publishResult)}`);
|
|
13812
|
-
const isSuccess = 0 === publishResult.status_code;
|
|
13813
|
-
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg} ${decision?.verify_title} ${decision?.verify_desc}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13814
|
-
const data = isSuccess ? publishResult.item_id || "" : "";
|
|
13815
|
-
if (!isSuccess) {
|
|
13816
|
-
let decisionObj = {};
|
|
13817
|
-
if (decision) decisionObj = decision;
|
|
13850
|
+
});
|
|
13851
|
+
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
13852
|
+
} catch (error) {
|
|
13853
|
+
const handledError = Http.handleApiError(error);
|
|
13854
|
+
const errorMsg = handledError.message || "发布失败";
|
|
13855
|
+
const errorCode = handledError.code || 500;
|
|
13856
|
+
task.logger.error(`[douyinPublish] 发布流程异常 (步骤: ${currentStep}): ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
13818
13857
|
await updateTaskState?.({
|
|
13819
13858
|
state: share_namespaceObject.TaskState.FAILED,
|
|
13820
|
-
error:
|
|
13821
|
-
result: {
|
|
13822
|
-
...decisionObj,
|
|
13823
|
-
data: decision,
|
|
13824
|
-
uploadedImgList: JSON.stringify(publishData.item.common.images)
|
|
13825
|
-
}
|
|
13859
|
+
error: `${currentStep}失败: ${errorMsg}`
|
|
13826
13860
|
});
|
|
13827
|
-
return
|
|
13828
|
-
code: 414,
|
|
13829
|
-
data,
|
|
13830
|
-
message
|
|
13831
|
-
};
|
|
13861
|
+
return (0, share_namespaceObject.response)(errorCode, errorMsg, "");
|
|
13832
13862
|
}
|
|
13833
|
-
await updateTaskState?.({
|
|
13834
|
-
state: share_namespaceObject.TaskState.SUCCESS,
|
|
13835
|
-
result: {
|
|
13836
|
-
response: data
|
|
13837
|
-
}
|
|
13838
|
-
});
|
|
13839
|
-
return (0, share_namespaceObject.response)(isSuccess ? 0 : 414, message, data);
|
|
13840
13863
|
};
|
|
13841
13864
|
const douyinPublish_rpa_rpaAction = async (task, params)=>{
|
|
13842
13865
|
const commonCookies = {
|
|
@@ -18612,7 +18635,9 @@ var __webpack_exports__ = {};
|
|
|
18612
18635
|
task.logger.info("[shipinhaoPublish] 开始执行视频号发布 - Mock API 方式");
|
|
18613
18636
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
18614
18637
|
if (!params.extraParam.fingerPrintDeviceId || !params.extraParam.aId) return (0, share_namespaceObject.response)(400, "fingerPrintDeviceId和aId 不能为空", "");
|
|
18638
|
+
let currentStep = "初始化";
|
|
18615
18639
|
try {
|
|
18640
|
+
currentStep = "解析认证信息";
|
|
18616
18641
|
const cookieString = params.cookies.map((c)=>`${c.name}=${c.value}`).join("; ");
|
|
18617
18642
|
const fingerPrintDeviceId = params.extraParam.fingerPrintDeviceId;
|
|
18618
18643
|
const aId = params.extraParam.aId;
|
|
@@ -18633,8 +18658,10 @@ var __webpack_exports__ = {};
|
|
|
18633
18658
|
headers
|
|
18634
18659
|
});
|
|
18635
18660
|
const proxyHttp = new Http(...args);
|
|
18661
|
+
currentStep = "验证发布参数";
|
|
18636
18662
|
if (!params.banners || 0 === params.banners.length) return (0, share_namespaceObject.response)(400, "至少需要一张图片", "");
|
|
18637
18663
|
const images = params.banners.slice(0, 18).filter((img)=>"string" == typeof img);
|
|
18664
|
+
currentStep = "获取用户信息";
|
|
18638
18665
|
task.logger.info("[shipinhaoPublish] 获取用户信息...");
|
|
18639
18666
|
console.log("cookieString", cookieString);
|
|
18640
18667
|
const userInfo = await mock_getUserInfo(cookieString, http);
|
|
@@ -18645,6 +18672,7 @@ var __webpack_exports__ = {};
|
|
|
18645
18672
|
}
|
|
18646
18673
|
const finderUsername = userInfo.data.finderUser.finderUsername;
|
|
18647
18674
|
console.log(finderUsername);
|
|
18675
|
+
currentStep = "获取上传认证密钥";
|
|
18648
18676
|
task.logger.info("[shipinhaoPublish] 获取上传认证密钥...");
|
|
18649
18677
|
const authKeyResponse = await getUploadAuthKey(cookieString, finderUsername, http);
|
|
18650
18678
|
if (0 !== authKeyResponse.errCode || !authKeyResponse.data?.authKey) return (0, share_namespaceObject.response)(authKeyResponse.errCode || 500, `获取上传认证参数失败: ${authKeyResponse.errMsg}`, "");
|
|
@@ -18652,10 +18680,12 @@ var __webpack_exports__ = {};
|
|
|
18652
18680
|
const uin = authKeyResponse.data.uin;
|
|
18653
18681
|
if (!uin) return (0, share_namespaceObject.response)(500, "获取用户 uin 失败", "");
|
|
18654
18682
|
const taskId = String(generateUUID());
|
|
18683
|
+
currentStep = "上传图片";
|
|
18655
18684
|
task.logger.info(`[shipinhaoPublish] 开始上传 ${images.length} 张图片...`);
|
|
18656
18685
|
const uploadedImages = [];
|
|
18657
18686
|
for(let i = 0; i < images.length; i++){
|
|
18658
|
-
|
|
18687
|
+
currentStep = `上传图片 ${i + 1}/${images.length}`;
|
|
18688
|
+
task.logger.info(`[shipinhaoPublish] ${currentStep}...`);
|
|
18659
18689
|
const uploadResult = await uploadImageComplete(images[i], taskId, finderUsername, uin, authKey, http);
|
|
18660
18690
|
console.log(JSON.stringify(uploadResult));
|
|
18661
18691
|
if (!uploadResult.DownloadURL) return (0, share_namespaceObject.response)(500, `图片上传失败: ${uploadResult.errMsg}`, "");
|
|
@@ -18672,6 +18702,7 @@ var __webpack_exports__ = {};
|
|
|
18672
18702
|
urlCdnTaskId: ""
|
|
18673
18703
|
});
|
|
18674
18704
|
}
|
|
18705
|
+
currentStep = "发布图文内容";
|
|
18675
18706
|
task.logger.info("[shipinhaoPublish] 正在发布...");
|
|
18676
18707
|
const topicNames = params.topic || void 0;
|
|
18677
18708
|
const addressInfo = params.address ? {
|
|
@@ -18758,9 +18789,15 @@ var __webpack_exports__ = {};
|
|
|
18758
18789
|
});
|
|
18759
18790
|
return (0, share_namespaceObject.response)(resultCode || 500, errorMessage, "");
|
|
18760
18791
|
} catch (error) {
|
|
18761
|
-
const
|
|
18762
|
-
|
|
18763
|
-
|
|
18792
|
+
const handledError = Http.handleApiError(error);
|
|
18793
|
+
const errorMsg = handledError.message || "发布失败,请稍后重试";
|
|
18794
|
+
const errorCode = handledError.code || 500;
|
|
18795
|
+
task.logger.error(`[shipinhaoPublish] 发布流程异常: ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
18796
|
+
await updateTaskState?.({
|
|
18797
|
+
state: share_namespaceObject.TaskState.FAILED,
|
|
18798
|
+
error: errorMsg
|
|
18799
|
+
});
|
|
18800
|
+
return (0, share_namespaceObject.response)(errorCode, errorMsg, "");
|
|
18764
18801
|
}
|
|
18765
18802
|
};
|
|
18766
18803
|
const shipinhaoPublish_rpa_rpaAction = async (task, params)=>{
|
|
@@ -25266,7 +25303,7 @@ var __webpack_exports__ = {};
|
|
|
25266
25303
|
likeNumYesterday: schemas_number().nullable(),
|
|
25267
25304
|
commentNumYesterday: schemas_number().nullable()
|
|
25268
25305
|
});
|
|
25269
|
-
schemas_object({
|
|
25306
|
+
const douyinConfigDataSchema = schemas_object({
|
|
25270
25307
|
fansNum: schemas_number(),
|
|
25271
25308
|
favedNum: schemas_number(),
|
|
25272
25309
|
fansNumLastWeek: schemas_number(),
|
|
@@ -25276,7 +25313,7 @@ var __webpack_exports__ = {};
|
|
|
25276
25313
|
shareNumLastWeek: schemas_number(),
|
|
25277
25314
|
visitNumLastWeek: schemas_number()
|
|
25278
25315
|
});
|
|
25279
|
-
schemas_object({
|
|
25316
|
+
const shipinhaoConfigDataSchema = schemas_object({
|
|
25280
25317
|
fansNum: schemas_number(),
|
|
25281
25318
|
feedsCount: schemas_number(),
|
|
25282
25319
|
fansNumYesterday: schemas_number().nullable(),
|
|
@@ -25573,4 +25610,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
25573
25610
|
});
|
|
25574
25611
|
|
|
25575
25612
|
//# sourceMappingURL=index.js.map
|
|
25576
|
-
//# debugId=
|
|
25613
|
+
//# debugId=6b7b33da-d2a4-5623-b09a-756a2fe8a917
|