@iflyrpa/actions 4.0.9-beta.4 → 4.1.0-beta.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/shipinhaoPublishVideo/index.d.ts +95 -0
- package/dist/actions/shipinhaoPublishVideo/mock.d.ts +4 -0
- package/dist/actions/shipinhaoPublishVideo/payload.d.ts +70 -0
- package/dist/actions/shipinhaoPublishVideo/rpa.d.ts +6 -0
- package/dist/actions/shipinhaoPublishVideo/uploader.d.ts +57 -0
- package/dist/actions/shipinhaoPublishVideo/videoMeta.d.ts +65 -0
- package/dist/actions/shipinhaoPublishVideo/videoValidator.d.ts +35 -0
- package/dist/bundle.js +1693 -9
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1895 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1895 -212
- package/dist/index.mjs.map +1 -1
- package/dist/utils/http.d.ts +7 -0
- package/dist/utils/imageValidator.d.ts +67 -0
- package/dist/utils/shipinhao/auth.d.ts +31 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
2
|
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ed6f9fc8-db66-5df4-be7c-d5593224a8b2")}catch(e){}}();
|
|
4
4
|
var __webpack_modules__ = {
|
|
5
5
|
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
6
6
|
"use strict";
|
|
@@ -12446,6 +12446,7 @@ var __webpack_exports__ = {};
|
|
|
12446
12446
|
SessionCheckResultSchema: ()=>SessionCheckResultSchema,
|
|
12447
12447
|
DouyinGetCommentReplyListParamsSchema: ()=>DouyinGetCommentReplyListParamsSchema,
|
|
12448
12448
|
DouyinCreateCommentReplyParamsSchema: ()=>DouyinCreateCommentReplyParamsSchema,
|
|
12449
|
+
ShipinhaoPublishVideoParamsSchema: ()=>ShipinhaoPublishVideoParamsSchema,
|
|
12449
12450
|
DouyinGetHotParamsSchema: ()=>DouyinGetHotParamsSchema,
|
|
12450
12451
|
DouyinGetMusicParamsSchema: ()=>DouyinGetMusicParamsSchema,
|
|
12451
12452
|
FetchArticlesDataSchema: ()=>FetchArticlesDataSchema,
|
|
@@ -12492,7 +12493,7 @@ var __webpack_exports__ = {};
|
|
|
12492
12493
|
var package_namespaceObject = {
|
|
12493
12494
|
i8: "0.1.2"
|
|
12494
12495
|
};
|
|
12495
|
-
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0
|
|
12496
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.1.0-beta.6"}');
|
|
12496
12497
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
12497
12498
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
12498
12499
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -13308,7 +13309,7 @@ var __webpack_exports__ = {};
|
|
|
13308
13309
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
13309
13310
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
13310
13311
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
13311
|
-
const
|
|
13312
|
+
const dist_duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
13312
13313
|
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
13313
13314
|
const dist_uuid = (version)=>{
|
|
13314
13315
|
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
@@ -13994,7 +13995,7 @@ var __webpack_exports__ = {};
|
|
|
13994
13995
|
$ZodStringFormat.init(inst, def);
|
|
13995
13996
|
});
|
|
13996
13997
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)=>{
|
|
13997
|
-
def.pattern ?? (def.pattern =
|
|
13998
|
+
def.pattern ?? (def.pattern = dist_duration);
|
|
13998
13999
|
$ZodStringFormat.init(inst, def);
|
|
13999
14000
|
});
|
|
14000
14001
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def)=>{
|
|
@@ -27491,23 +27492,33 @@ var __webpack_exports__ = {};
|
|
|
27491
27492
|
async api(config, options) {
|
|
27492
27493
|
const retries = options?.retries ?? 0;
|
|
27493
27494
|
const retryDelay = options?.retryDelay ?? 500;
|
|
27494
|
-
const reqTimeout = options?.timeout ??
|
|
27495
|
+
const reqTimeout = options?.timeout ?? 60000;
|
|
27496
|
+
const externalSignal = options?.signal;
|
|
27495
27497
|
let agent;
|
|
27496
27498
|
const sessionRt = async (Rtimes)=>{
|
|
27497
27499
|
try {
|
|
27498
27500
|
this.proxyInfo = agent ? `${agent.ip}:${agent.port}` : void 0;
|
|
27499
27501
|
const controller = new AbortController();
|
|
27500
27502
|
const timeoutId = setTimeout(()=>controller.abort(), reqTimeout + 500);
|
|
27503
|
+
const forwardAbort = ()=>controller.abort();
|
|
27504
|
+
if (externalSignal) {
|
|
27505
|
+
if (externalSignal.aborted) controller.abort();
|
|
27506
|
+
else externalSignal.addEventListener("abort", forwardAbort, {
|
|
27507
|
+
once: true
|
|
27508
|
+
});
|
|
27509
|
+
}
|
|
27501
27510
|
const response = await this.apiClient({
|
|
27502
27511
|
...config,
|
|
27503
27512
|
timeout: reqTimeout,
|
|
27504
27513
|
signal: controller.signal,
|
|
27514
|
+
onUploadProgress: options?.onUploadProgress,
|
|
27505
27515
|
...agent ? {
|
|
27506
27516
|
httpAgent: agent.agent,
|
|
27507
27517
|
httpsAgent: agent.agent
|
|
27508
27518
|
} : {}
|
|
27509
27519
|
}).finally(()=>{
|
|
27510
27520
|
clearTimeout(timeoutId);
|
|
27521
|
+
externalSignal?.removeEventListener("abort", forwardAbort);
|
|
27511
27522
|
});
|
|
27512
27523
|
return response.data;
|
|
27513
27524
|
} catch (error) {
|
|
@@ -32216,6 +32227,14 @@ var __webpack_exports__ = {};
|
|
|
32216
32227
|
};
|
|
32217
32228
|
return new schemas_ZodObject(def);
|
|
32218
32229
|
}
|
|
32230
|
+
function looseObject(shape, params) {
|
|
32231
|
+
return new schemas_ZodObject({
|
|
32232
|
+
type: "object",
|
|
32233
|
+
shape,
|
|
32234
|
+
catchall: schemas_unknown(),
|
|
32235
|
+
...util_normalizeParams(params)
|
|
32236
|
+
});
|
|
32237
|
+
}
|
|
32219
32238
|
const schemas_ZodUnion = /*@__PURE__*/ core_$constructor("ZodUnion", (inst, def)=>{
|
|
32220
32239
|
schemas_$ZodUnion.init(inst, def);
|
|
32221
32240
|
schemas_ZodType.init(inst, def);
|
|
@@ -32912,6 +32931,13 @@ var __webpack_exports__ = {};
|
|
|
32912
32931
|
data: ""
|
|
32913
32932
|
};
|
|
32914
32933
|
const image = await downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
32934
|
+
const stats = external_node_fs_default().statSync(image);
|
|
32935
|
+
const maxSize = 5242880;
|
|
32936
|
+
if (stats.size > maxSize) throw {
|
|
32937
|
+
code: 414,
|
|
32938
|
+
message: "百家号平台:单张图片不得超过 5MB",
|
|
32939
|
+
data: ""
|
|
32940
|
+
};
|
|
32915
32941
|
const formData = new (form_data_default())();
|
|
32916
32942
|
formData.append("org_file_name", fileName);
|
|
32917
32943
|
formData.append("type", "image");
|
|
@@ -38533,6 +38559,11 @@ var __webpack_exports__ = {};
|
|
|
38533
38559
|
}
|
|
38534
38560
|
async getImageInfo(localPath) {
|
|
38535
38561
|
const stats = external_node_fs_default().statSync(localPath);
|
|
38562
|
+
const maxSize = 52428800;
|
|
38563
|
+
if (stats.size > maxSize) {
|
|
38564
|
+
external_node_path_default().basename(localPath);
|
|
38565
|
+
throw new Error("抖音平台:单张图片不得超过 50MB");
|
|
38566
|
+
}
|
|
38536
38567
|
let width = 1080;
|
|
38537
38568
|
let height = 1920;
|
|
38538
38569
|
try {
|
|
@@ -44779,6 +44810,1643 @@ var __webpack_exports__ = {};
|
|
|
44779
44810
|
if ("server" === params.actionType) return rpa_server_rpaAction_Server(task, params);
|
|
44780
44811
|
return executeAction(shipinhaoPublish_mock_mockAction, rpa_server_rpaAction_Server)(task, params);
|
|
44781
44812
|
};
|
|
44813
|
+
function auth_getTimeStamp(length) {
|
|
44814
|
+
return Date.now().toString().substring(0, length);
|
|
44815
|
+
}
|
|
44816
|
+
async function auth_getUserInfo(cookies, http) {
|
|
44817
|
+
return http.api({
|
|
44818
|
+
method: "post",
|
|
44819
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
44820
|
+
data: {
|
|
44821
|
+
timestamp: auth_getTimeStamp(13),
|
|
44822
|
+
_log_finder_uin: "",
|
|
44823
|
+
_log_finder_id: "",
|
|
44824
|
+
rawKeyBuff: null,
|
|
44825
|
+
pluginSessionId: null,
|
|
44826
|
+
scene: 7,
|
|
44827
|
+
reqScene: 7
|
|
44828
|
+
},
|
|
44829
|
+
headers: {
|
|
44830
|
+
cookie: cookies,
|
|
44831
|
+
referer: "https://channels.weixin.qq.com",
|
|
44832
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
44833
|
+
},
|
|
44834
|
+
defaultErrorMsg: "获取用户信息失败"
|
|
44835
|
+
});
|
|
44836
|
+
}
|
|
44837
|
+
async function auth_getUploadAuthKey(cookies, finderUsername, http) {
|
|
44838
|
+
return http.api({
|
|
44839
|
+
method: "post",
|
|
44840
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/helper/helper_upload_params",
|
|
44841
|
+
data: {
|
|
44842
|
+
timestamp: auth_getTimeStamp(13),
|
|
44843
|
+
_log_finder_id: finderUsername,
|
|
44844
|
+
rawKeyBuff: null
|
|
44845
|
+
},
|
|
44846
|
+
headers: {
|
|
44847
|
+
cookie: cookies,
|
|
44848
|
+
referer: "https://channels.weixin.qq.com",
|
|
44849
|
+
Accept: "application/json, text/plain, */*",
|
|
44850
|
+
"Content-Type": "application/json",
|
|
44851
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
|
44852
|
+
},
|
|
44853
|
+
defaultErrorMsg: "获取上传认证密钥失败"
|
|
44854
|
+
});
|
|
44855
|
+
}
|
|
44856
|
+
class ShipinhaoAuthError extends Error {
|
|
44857
|
+
constructor(message, errCode){
|
|
44858
|
+
super(message), this.errCode = errCode;
|
|
44859
|
+
this.name = "ShipinhaoAuthError";
|
|
44860
|
+
}
|
|
44861
|
+
}
|
|
44862
|
+
async function getShipinhaoUploadAuth(cookies, http) {
|
|
44863
|
+
const userInfo = await auth_getUserInfo(cookies, http);
|
|
44864
|
+
if (0 !== userInfo.errCode || !userInfo.data?.finderUser) {
|
|
44865
|
+
const isLoginExpired = 300333 === userInfo.errCode || 300334 === userInfo.errCode;
|
|
44866
|
+
throw new ShipinhaoAuthError(isLoginExpired ? "登录失效" : userInfo.errMsg || "获取用户信息失败", userInfo.errCode || 500);
|
|
44867
|
+
}
|
|
44868
|
+
const finderUsername = userInfo.data.finderUser.finderUsername;
|
|
44869
|
+
const authKeyResponse = await auth_getUploadAuthKey(cookies, finderUsername, http);
|
|
44870
|
+
if (0 !== authKeyResponse.errCode || !authKeyResponse.data?.authKey) throw new ShipinhaoAuthError(`获取上传认证参数失败: ${authKeyResponse.errMsg}`, authKeyResponse.errCode || 500);
|
|
44871
|
+
const uin = authKeyResponse.data.uin;
|
|
44872
|
+
if (!uin) throw new ShipinhaoAuthError("获取用户 uin 失败", 500);
|
|
44873
|
+
const videoFileType = authKeyResponse.data.videoFileType || 20302;
|
|
44874
|
+
const pictureFileType = authKeyResponse.data.pictureFileType || 20304;
|
|
44875
|
+
return {
|
|
44876
|
+
uin,
|
|
44877
|
+
authKey: authKeyResponse.data.authKey,
|
|
44878
|
+
finderUsername,
|
|
44879
|
+
videoFileType,
|
|
44880
|
+
pictureFileType
|
|
44881
|
+
};
|
|
44882
|
+
}
|
|
44883
|
+
const MENTION_TEXT_SUFFIX = "\u0020";
|
|
44884
|
+
const MENTION_XML_SUFFIX = "\u2005";
|
|
44885
|
+
function payload_buildDescription(params) {
|
|
44886
|
+
let description = params.description || "";
|
|
44887
|
+
for (const topic of params.topics || [])description += `#${topic}`;
|
|
44888
|
+
for (const user of params.mentionedUsers || [])description += `@${user.nickname}${MENTION_TEXT_SUFFIX}`;
|
|
44889
|
+
return description;
|
|
44890
|
+
}
|
|
44891
|
+
function buildMentionedUser(mentionedUsers) {
|
|
44892
|
+
return (mentionedUsers || []).map((user)=>({
|
|
44893
|
+
nickname: `${user.nickname}${MENTION_TEXT_SUFFIX}`
|
|
44894
|
+
}));
|
|
44895
|
+
}
|
|
44896
|
+
function payload_buildTopicXml(params) {
|
|
44897
|
+
const values = [];
|
|
44898
|
+
let atIndex = null;
|
|
44899
|
+
if (params.description) values.push(`<![CDATA[${params.description}]]>`);
|
|
44900
|
+
for (const topic of params.topics || [])values.push(`<topic><![CDATA[#${topic}#]]></topic>`);
|
|
44901
|
+
for (const user of params.mentionedUsers || []){
|
|
44902
|
+
if (null === atIndex) atIndex = values.length;
|
|
44903
|
+
values.push(`<![CDATA[@${user.nickname}${MENTION_XML_SUFFIX}]]>`);
|
|
44904
|
+
}
|
|
44905
|
+
let xml = "<finder>";
|
|
44906
|
+
xml += "<version>1</version>";
|
|
44907
|
+
xml += `<valuecount>${values.length}</valuecount>`;
|
|
44908
|
+
xml += `<style><at>${atIndex ?? ""}</at></style>`;
|
|
44909
|
+
values.forEach((value, index)=>{
|
|
44910
|
+
xml += `<value${index}>${value}</value${index}>`;
|
|
44911
|
+
});
|
|
44912
|
+
xml += "</finder>";
|
|
44913
|
+
return xml;
|
|
44914
|
+
}
|
|
44915
|
+
function payload_buildLocation(location) {
|
|
44916
|
+
if (!location) return {
|
|
44917
|
+
latitude: 0,
|
|
44918
|
+
longitude: 0,
|
|
44919
|
+
city: "",
|
|
44920
|
+
poiName: "",
|
|
44921
|
+
address: "",
|
|
44922
|
+
poiClassifyId: ""
|
|
44923
|
+
};
|
|
44924
|
+
return {
|
|
44925
|
+
latitude: location.latitude,
|
|
44926
|
+
longitude: location.longitude,
|
|
44927
|
+
city: location.city,
|
|
44928
|
+
poiName: location.poiName || "",
|
|
44929
|
+
address: location.address || "",
|
|
44930
|
+
poiClassifyId: location.poiClassifyId || ""
|
|
44931
|
+
};
|
|
44932
|
+
}
|
|
44933
|
+
function buildTopic(params) {
|
|
44934
|
+
const topic = {
|
|
44935
|
+
finderTopicInfo: payload_buildTopicXml(params)
|
|
44936
|
+
};
|
|
44937
|
+
if (params.collection) {
|
|
44938
|
+
topic.collectionId = params.collection.collectionId;
|
|
44939
|
+
topic.collectionName = params.collection.collectionName;
|
|
44940
|
+
}
|
|
44941
|
+
return topic;
|
|
44942
|
+
}
|
|
44943
|
+
function buildEvent(event) {
|
|
44944
|
+
if (!event) return {};
|
|
44945
|
+
return {
|
|
44946
|
+
eventTopicId: event.eventTopicId,
|
|
44947
|
+
eventName: event.eventName,
|
|
44948
|
+
eventCreatorNickname: event.eventCreatorNickname || ""
|
|
44949
|
+
};
|
|
44950
|
+
}
|
|
44951
|
+
function buildExtReading(link) {
|
|
44952
|
+
if (!link) return {
|
|
44953
|
+
link: "",
|
|
44954
|
+
title: "",
|
|
44955
|
+
urlType: 1
|
|
44956
|
+
};
|
|
44957
|
+
return {
|
|
44958
|
+
link: link.link.replace(/[\s\u200b]/g, ""),
|
|
44959
|
+
title: link.title,
|
|
44960
|
+
urlType: link.urlType ?? 1
|
|
44961
|
+
};
|
|
44962
|
+
}
|
|
44963
|
+
function buildTagInfo(tagInfo, tagKey) {
|
|
44964
|
+
return {
|
|
44965
|
+
...tagInfo,
|
|
44966
|
+
tagKey
|
|
44967
|
+
};
|
|
44968
|
+
}
|
|
44969
|
+
const CHUNK_SIZE = 8388608;
|
|
44970
|
+
const UPLOAD_STAGE_TIMEOUT = 180000;
|
|
44971
|
+
const DEFAULT_TUNING = {
|
|
44972
|
+
metaTimeout: UPLOAD_STAGE_TIMEOUT,
|
|
44973
|
+
partTimeout: UPLOAD_STAGE_TIMEOUT,
|
|
44974
|
+
partRetries: 3,
|
|
44975
|
+
completeTimeout: UPLOAD_STAGE_TIMEOUT
|
|
44976
|
+
};
|
|
44977
|
+
async function uploader_uploadFile(opts) {
|
|
44978
|
+
const { filePath, fileType, uin, authKey, http, logger, tuning } = opts;
|
|
44979
|
+
const stat = external_node_fs_default().statSync(filePath);
|
|
44980
|
+
const fileSize = stat.size;
|
|
44981
|
+
const fileName = filePath.split(/[\\/]/).pop() || "file";
|
|
44982
|
+
const metaTimeout = tuning?.metaTimeout ?? DEFAULT_TUNING.metaTimeout;
|
|
44983
|
+
const partTimeout = tuning?.partTimeout ?? DEFAULT_TUNING.partTimeout;
|
|
44984
|
+
const partRetries = tuning?.partRetries ?? DEFAULT_TUNING.partRetries;
|
|
44985
|
+
const completeTimeout = tuning?.completeTimeout ?? DEFAULT_TUNING.completeTimeout;
|
|
44986
|
+
logger?.info(`开始上传: ${fileName} (${fileSize} B, filetype=${fileType})`);
|
|
44987
|
+
logger?.info(`上传超时策略: 单片 ${partTimeout / 1000}s(重试 ${partRetries} 次)、合并 ${completeTimeout / 1000}s`);
|
|
44988
|
+
const fileMd5 = await computeFileMd5(filePath);
|
|
44989
|
+
const taskId = generateTaskId(fileName, fileSize, fileMd5);
|
|
44990
|
+
const baseUrl = "https://finderassistancea.video.qq.com";
|
|
44991
|
+
const headers = {
|
|
44992
|
+
Authorization: authKey
|
|
44993
|
+
};
|
|
44994
|
+
const xArgs = `apptype=251&filetype=${fileType}&weixinnum=${uin}&filekey=${encodeURIComponent(fileName)}&filesize=${fileSize}&taskid=${taskId}&scene=2`;
|
|
44995
|
+
const chunkCount = Math.ceil(fileSize / CHUNK_SIZE);
|
|
44996
|
+
const blockPartLength = [];
|
|
44997
|
+
for(let i = 0; i < chunkCount; i++)blockPartLength.push(Math.min((i + 1) * CHUNK_SIZE, fileSize));
|
|
44998
|
+
logger?.info(`申请 UploadID: ${chunkCount} 片`);
|
|
44999
|
+
const applyRes = await http.api({
|
|
45000
|
+
method: "PUT",
|
|
45001
|
+
url: `${baseUrl}/applyuploaddfs`,
|
|
45002
|
+
headers: {
|
|
45003
|
+
...headers,
|
|
45004
|
+
"X-Arguments": xArgs
|
|
45005
|
+
},
|
|
45006
|
+
data: {
|
|
45007
|
+
BlockSum: chunkCount,
|
|
45008
|
+
BlockPartLength: blockPartLength
|
|
45009
|
+
}
|
|
45010
|
+
}, {
|
|
45011
|
+
timeout: metaTimeout,
|
|
45012
|
+
retries: 2,
|
|
45013
|
+
retryDelay: 2000
|
|
45014
|
+
});
|
|
45015
|
+
if (!applyRes.UploadID && !applyRes.ListPartsResult) throw new Error("申请 UploadID 失败: " + JSON.stringify(applyRes));
|
|
45016
|
+
let uploadId = applyRes.UploadID;
|
|
45017
|
+
const uploadedParts = new Set();
|
|
45018
|
+
if (applyRes.ListPartsResult) {
|
|
45019
|
+
logger?.info("检测到已上传分片,执行续传");
|
|
45020
|
+
const parts = Array.isArray(applyRes.ListPartsResult.Part) ? applyRes.ListPartsResult.Part : applyRes.ListPartsResult.Part ? [
|
|
45021
|
+
applyRes.ListPartsResult.Part
|
|
45022
|
+
] : [];
|
|
45023
|
+
for (const p of parts)uploadedParts.add(p.PartNumber);
|
|
45024
|
+
const retryRes = await http.api({
|
|
45025
|
+
method: "PUT",
|
|
45026
|
+
url: `${baseUrl}/applyuploaddfs`,
|
|
45027
|
+
headers: {
|
|
45028
|
+
...headers,
|
|
45029
|
+
"X-Arguments": xArgs
|
|
45030
|
+
},
|
|
45031
|
+
data: {
|
|
45032
|
+
BlockSum: chunkCount,
|
|
45033
|
+
BlockPartLength: blockPartLength
|
|
45034
|
+
}
|
|
45035
|
+
}, {
|
|
45036
|
+
timeout: metaTimeout,
|
|
45037
|
+
retries: 2,
|
|
45038
|
+
retryDelay: 2000
|
|
45039
|
+
});
|
|
45040
|
+
uploadId = retryRes.UploadID;
|
|
45041
|
+
if (!uploadId) throw new Error("续传获取 UploadID 失败");
|
|
45042
|
+
}
|
|
45043
|
+
const partInfo = [];
|
|
45044
|
+
const fd = external_node_fs_default().openSync(filePath, "r");
|
|
45045
|
+
try {
|
|
45046
|
+
for(let i = 0; i < chunkCount; i++){
|
|
45047
|
+
const partNumber = i + 1;
|
|
45048
|
+
if (uploadedParts.has(partNumber)) {
|
|
45049
|
+
const existing = applyRes.ListPartsResult.Part.find((p)=>p.PartNumber === partNumber);
|
|
45050
|
+
if (existing) {
|
|
45051
|
+
partInfo.push({
|
|
45052
|
+
PartNumber: partNumber,
|
|
45053
|
+
ETag: existing.ETag
|
|
45054
|
+
});
|
|
45055
|
+
logger?.info(`分片 ${partNumber}/${chunkCount} 已存在,跳过`);
|
|
45056
|
+
continue;
|
|
45057
|
+
}
|
|
45058
|
+
}
|
|
45059
|
+
const start = i * CHUNK_SIZE;
|
|
45060
|
+
const end = Math.min(start + CHUNK_SIZE, fileSize);
|
|
45061
|
+
const chunkSize = end - start;
|
|
45062
|
+
const chunk = Buffer.alloc(chunkSize);
|
|
45063
|
+
external_node_fs_default().readSync(fd, chunk, 0, chunkSize, start);
|
|
45064
|
+
const chunkMd5 = external_node_crypto_default().createHash("md5").update(chunk).digest("hex");
|
|
45065
|
+
const partStart = Date.now();
|
|
45066
|
+
await http.api({
|
|
45067
|
+
method: "PUT",
|
|
45068
|
+
url: `${baseUrl}/uploadpartdfs?PartNumber=${partNumber}&UploadID=${encodeURIComponent(uploadId)}`,
|
|
45069
|
+
headers: {
|
|
45070
|
+
...headers,
|
|
45071
|
+
"X-Arguments": xArgs.replace(/scene=2/, "scene=0"),
|
|
45072
|
+
"Content-MD5": chunkMd5
|
|
45073
|
+
},
|
|
45074
|
+
data: chunk
|
|
45075
|
+
}, {
|
|
45076
|
+
timeout: partTimeout,
|
|
45077
|
+
retries: partRetries,
|
|
45078
|
+
retryDelay: 2000
|
|
45079
|
+
});
|
|
45080
|
+
const partElapsed = Date.now() - partStart;
|
|
45081
|
+
const throughput = Math.round(chunkSize / (partElapsed / 1000));
|
|
45082
|
+
partInfo.push({
|
|
45083
|
+
PartNumber: partNumber,
|
|
45084
|
+
ETag: `"${chunkMd5}"`
|
|
45085
|
+
});
|
|
45086
|
+
logger?.info(`分片 ${partNumber}/${chunkCount} 完成 (${chunkSize} B, ${partElapsed}ms, ${Math.round(throughput / 1024)}KB/s)`);
|
|
45087
|
+
}
|
|
45088
|
+
} finally{
|
|
45089
|
+
external_node_fs_default().closeSync(fd);
|
|
45090
|
+
}
|
|
45091
|
+
logger?.info("合并分片...");
|
|
45092
|
+
const completeRes = await http.api({
|
|
45093
|
+
method: "POST",
|
|
45094
|
+
url: `${baseUrl}/completepartuploaddfs?UploadID=${encodeURIComponent(uploadId)}`,
|
|
45095
|
+
headers: {
|
|
45096
|
+
...headers,
|
|
45097
|
+
"X-Arguments": xArgs
|
|
45098
|
+
},
|
|
45099
|
+
data: {
|
|
45100
|
+
TransFlag: "0_0",
|
|
45101
|
+
PartInfo: partInfo
|
|
45102
|
+
}
|
|
45103
|
+
}, {
|
|
45104
|
+
timeout: completeTimeout,
|
|
45105
|
+
retries: 1,
|
|
45106
|
+
retryDelay: 3000
|
|
45107
|
+
});
|
|
45108
|
+
if (!completeRes.DownloadURL) throw new Error("合并分片失败: " + JSON.stringify(completeRes));
|
|
45109
|
+
logger?.info("上传成功");
|
|
45110
|
+
return {
|
|
45111
|
+
downloadUrl: completeRes.DownloadURL,
|
|
45112
|
+
md5: fileMd5,
|
|
45113
|
+
fileSize
|
|
45114
|
+
};
|
|
45115
|
+
}
|
|
45116
|
+
async function computeFileMd5(filePath) {
|
|
45117
|
+
return new Promise((resolve, reject)=>{
|
|
45118
|
+
const hash = external_node_crypto_default().createHash("md5");
|
|
45119
|
+
const stream = external_node_fs_default().createReadStream(filePath);
|
|
45120
|
+
stream.on("data", (chunk)=>hash.update(chunk));
|
|
45121
|
+
stream.on("end", ()=>resolve(hash.digest("hex")));
|
|
45122
|
+
stream.on("error", reject);
|
|
45123
|
+
});
|
|
45124
|
+
}
|
|
45125
|
+
function generateTaskId(fileName, fileSize, fileMd5) {
|
|
45126
|
+
const input = `${fileName}-${fileSize}-${fileMd5}`;
|
|
45127
|
+
return external_node_crypto_default().createHash("md5").update(input).digest("hex").slice(0, 32);
|
|
45128
|
+
}
|
|
45129
|
+
const MAX_METADATA_BOX_SIZE = 268435456;
|
|
45130
|
+
function readBoxHeader(fd, offset, limit) {
|
|
45131
|
+
if (offset + 8 > limit) return null;
|
|
45132
|
+
const head = Buffer.alloc(16);
|
|
45133
|
+
const read = external_node_fs_default().readSync(fd, head, 0, 16, offset);
|
|
45134
|
+
if (read < 8) return null;
|
|
45135
|
+
let size = head.readUInt32BE(0);
|
|
45136
|
+
const type = head.toString("latin1", 4, 8);
|
|
45137
|
+
let headerSize = 8;
|
|
45138
|
+
if (1 === size) {
|
|
45139
|
+
if (read < 16) return null;
|
|
45140
|
+
size = head.readUInt32BE(8) * 2 ** 32 + head.readUInt32BE(12);
|
|
45141
|
+
headerSize = 16;
|
|
45142
|
+
} else if (0 === size) size = limit - offset;
|
|
45143
|
+
if (size < headerSize || offset + size > limit) return null;
|
|
45144
|
+
return {
|
|
45145
|
+
type,
|
|
45146
|
+
size,
|
|
45147
|
+
headerSize
|
|
45148
|
+
};
|
|
45149
|
+
}
|
|
45150
|
+
function parseVideoMeta(filePath) {
|
|
45151
|
+
let fd;
|
|
45152
|
+
let fileSize;
|
|
45153
|
+
try {
|
|
45154
|
+
fd = external_node_fs_default().openSync(filePath, "r");
|
|
45155
|
+
} catch {
|
|
45156
|
+
return null;
|
|
45157
|
+
}
|
|
45158
|
+
try {
|
|
45159
|
+
fileSize = external_node_fs_default().fstatSync(fd).size;
|
|
45160
|
+
const state = {
|
|
45161
|
+
movie: null,
|
|
45162
|
+
tracks: [],
|
|
45163
|
+
trexDefaults: new Map(),
|
|
45164
|
+
fragmentDurations: new Map(),
|
|
45165
|
+
trafTrackId: 0,
|
|
45166
|
+
trafDefaultSampleDuration: 0
|
|
45167
|
+
};
|
|
45168
|
+
let offset = 0;
|
|
45169
|
+
while(offset + 8 <= fileSize){
|
|
45170
|
+
const header = readBoxHeader(fd, offset, fileSize);
|
|
45171
|
+
if (!header) break;
|
|
45172
|
+
if ("moov" === header.type || "moof" === header.type) {
|
|
45173
|
+
const bodyLength = header.size - header.headerSize;
|
|
45174
|
+
if (bodyLength > 0 && bodyLength <= MAX_METADATA_BOX_SIZE) {
|
|
45175
|
+
const body = Buffer.alloc(bodyLength);
|
|
45176
|
+
const read = external_node_fs_default().readSync(fd, body, 0, bodyLength, offset + header.headerSize);
|
|
45177
|
+
state.trafTrackId = 0;
|
|
45178
|
+
state.trafDefaultSampleDuration = 0;
|
|
45179
|
+
walkBoxes(body.subarray(0, read), 0, read, state);
|
|
45180
|
+
}
|
|
45181
|
+
}
|
|
45182
|
+
offset += header.size;
|
|
45183
|
+
}
|
|
45184
|
+
const { movie, tracks } = state;
|
|
45185
|
+
const video = tracks.find((t)=>"vide" === t.handler) || tracks.find((t)=>t.width > 0 && t.height > 0);
|
|
45186
|
+
if (!video) return null;
|
|
45187
|
+
let { width, height } = video;
|
|
45188
|
+
if (90 === video.rotation || 270 === video.rotation) [width, height] = [
|
|
45189
|
+
height,
|
|
45190
|
+
width
|
|
45191
|
+
];
|
|
45192
|
+
return {
|
|
45193
|
+
width: Math.round(width),
|
|
45194
|
+
height: Math.round(height),
|
|
45195
|
+
duration: resolveDuration(movie, video, state.fragmentDurations),
|
|
45196
|
+
rotation: video.rotation,
|
|
45197
|
+
fileSize,
|
|
45198
|
+
codec: video.codec
|
|
45199
|
+
};
|
|
45200
|
+
} catch {
|
|
45201
|
+
return null;
|
|
45202
|
+
} finally{
|
|
45203
|
+
try {
|
|
45204
|
+
external_node_fs_default().closeSync(fd);
|
|
45205
|
+
} catch {}
|
|
45206
|
+
}
|
|
45207
|
+
}
|
|
45208
|
+
function walkBoxes(buf, start, end, state) {
|
|
45209
|
+
let off = start;
|
|
45210
|
+
while(off + 8 <= end){
|
|
45211
|
+
let size = buf.readUInt32BE(off);
|
|
45212
|
+
const type = buf.toString("latin1", off + 4, off + 8);
|
|
45213
|
+
let headerSize = 8;
|
|
45214
|
+
if (1 === size) {
|
|
45215
|
+
if (off + 16 > end) break;
|
|
45216
|
+
const hi = buf.readUInt32BE(off + 8);
|
|
45217
|
+
const lo = buf.readUInt32BE(off + 12);
|
|
45218
|
+
size = hi * 2 ** 32 + lo;
|
|
45219
|
+
headerSize = 16;
|
|
45220
|
+
} else if (0 === size) size = end - off;
|
|
45221
|
+
if (size < headerSize || off + size > end) break;
|
|
45222
|
+
const bodyStart = off + headerSize;
|
|
45223
|
+
const bodyEnd = off + size;
|
|
45224
|
+
switch(type){
|
|
45225
|
+
case "trak":
|
|
45226
|
+
case "mdia":
|
|
45227
|
+
case "minf":
|
|
45228
|
+
case "stbl":
|
|
45229
|
+
case "mvex":
|
|
45230
|
+
case "traf":
|
|
45231
|
+
walkBoxes(buf, bodyStart, bodyEnd, state);
|
|
45232
|
+
break;
|
|
45233
|
+
case "mvhd":
|
|
45234
|
+
state.movie = parseMvhd(buf, bodyStart, bodyEnd);
|
|
45235
|
+
break;
|
|
45236
|
+
case "tkhd":
|
|
45237
|
+
state.tracks.push({
|
|
45238
|
+
...parseTkhd(buf, bodyStart, bodyEnd),
|
|
45239
|
+
handler: null,
|
|
45240
|
+
codec: null,
|
|
45241
|
+
timescale: 0,
|
|
45242
|
+
mdhdDuration: 0,
|
|
45243
|
+
sttsDuration: 0
|
|
45244
|
+
});
|
|
45245
|
+
break;
|
|
45246
|
+
case "mdhd":
|
|
45247
|
+
{
|
|
45248
|
+
const mdhd = parseMvhd(buf, bodyStart, bodyEnd);
|
|
45249
|
+
if (mdhd && state.tracks.length) {
|
|
45250
|
+
const track = state.tracks[state.tracks.length - 1];
|
|
45251
|
+
track.timescale = mdhd.timescale;
|
|
45252
|
+
track.mdhdDuration = mdhd.duration;
|
|
45253
|
+
}
|
|
45254
|
+
break;
|
|
45255
|
+
}
|
|
45256
|
+
case "hdlr":
|
|
45257
|
+
if (bodyEnd - bodyStart >= 12 && state.tracks.length) state.tracks[state.tracks.length - 1].handler = buf.toString("latin1", bodyStart + 8, bodyStart + 12);
|
|
45258
|
+
break;
|
|
45259
|
+
case "stsd":
|
|
45260
|
+
{
|
|
45261
|
+
const codec = parseStsdCodec(buf, bodyStart, bodyEnd);
|
|
45262
|
+
if (codec && state.tracks.length) state.tracks[state.tracks.length - 1].codec = codec;
|
|
45263
|
+
break;
|
|
45264
|
+
}
|
|
45265
|
+
case "stts":
|
|
45266
|
+
if (state.tracks.length) state.tracks[state.tracks.length - 1].sttsDuration = parseSttsDuration(buf, bodyStart, bodyEnd);
|
|
45267
|
+
break;
|
|
45268
|
+
case "trex":
|
|
45269
|
+
if (bodyStart + 20 > bodyEnd) break;
|
|
45270
|
+
state.trexDefaults.set(buf.readUInt32BE(bodyStart + 4), buf.readUInt32BE(bodyStart + 12));
|
|
45271
|
+
break;
|
|
45272
|
+
case "tfhd":
|
|
45273
|
+
{
|
|
45274
|
+
const tfhd = parseTfhd(buf, bodyStart, bodyEnd);
|
|
45275
|
+
state.trafTrackId = tfhd.trackId;
|
|
45276
|
+
state.trafDefaultSampleDuration = tfhd.defaultSampleDuration || state.trexDefaults.get(tfhd.trackId) || 0;
|
|
45277
|
+
break;
|
|
45278
|
+
}
|
|
45279
|
+
case "trun":
|
|
45280
|
+
{
|
|
45281
|
+
const duration = parseTrunDuration(buf, bodyStart, bodyEnd, state.trafDefaultSampleDuration);
|
|
45282
|
+
state.fragmentDurations.set(state.trafTrackId, (state.fragmentDurations.get(state.trafTrackId) || 0) + duration);
|
|
45283
|
+
break;
|
|
45284
|
+
}
|
|
45285
|
+
}
|
|
45286
|
+
off += size;
|
|
45287
|
+
}
|
|
45288
|
+
}
|
|
45289
|
+
const UNKNOWN_DURATION_32 = 0xffffffff;
|
|
45290
|
+
function isUsableDuration(duration) {
|
|
45291
|
+
return duration > 0 && duration !== UNKNOWN_DURATION_32;
|
|
45292
|
+
}
|
|
45293
|
+
function resolveDuration(movie, video, fragmentDurations) {
|
|
45294
|
+
if (movie && movie.timescale && isUsableDuration(movie.duration)) return movie.duration / movie.timescale;
|
|
45295
|
+
if (video.timescale) {
|
|
45296
|
+
if (isUsableDuration(video.mdhdDuration)) return video.mdhdDuration / video.timescale;
|
|
45297
|
+
if (video.sttsDuration > 0) return video.sttsDuration / video.timescale;
|
|
45298
|
+
const fragment = fragmentDurations.get(video.trackId) ?? (1 === fragmentDurations.size ? [
|
|
45299
|
+
...fragmentDurations.values()
|
|
45300
|
+
][0] : 0);
|
|
45301
|
+
if (fragment > 0) return fragment / video.timescale;
|
|
45302
|
+
}
|
|
45303
|
+
return 0;
|
|
45304
|
+
}
|
|
45305
|
+
function parseSttsDuration(buf, start, end) {
|
|
45306
|
+
if (start + 8 > end) return 0;
|
|
45307
|
+
const entryCount = buf.readUInt32BE(start + 4);
|
|
45308
|
+
let total = 0;
|
|
45309
|
+
for(let i = 0; i < entryCount; i++){
|
|
45310
|
+
const off = start + 8 + 8 * i;
|
|
45311
|
+
if (off + 8 > end) break;
|
|
45312
|
+
total += buf.readUInt32BE(off) * buf.readUInt32BE(off + 4);
|
|
45313
|
+
}
|
|
45314
|
+
return total;
|
|
45315
|
+
}
|
|
45316
|
+
function parseTfhd(buf, start, end) {
|
|
45317
|
+
if (start + 8 > end) return {
|
|
45318
|
+
trackId: 0,
|
|
45319
|
+
defaultSampleDuration: 0
|
|
45320
|
+
};
|
|
45321
|
+
const flags = buf.readUIntBE(start + 1, 3);
|
|
45322
|
+
const trackId = buf.readUInt32BE(start + 4);
|
|
45323
|
+
let off = start + 8;
|
|
45324
|
+
if (0x000001 & flags) off += 8;
|
|
45325
|
+
if (0x000002 & flags) off += 4;
|
|
45326
|
+
if (0x000008 & flags && off + 4 <= end) return {
|
|
45327
|
+
trackId,
|
|
45328
|
+
defaultSampleDuration: buf.readUInt32BE(off)
|
|
45329
|
+
};
|
|
45330
|
+
return {
|
|
45331
|
+
trackId,
|
|
45332
|
+
defaultSampleDuration: 0
|
|
45333
|
+
};
|
|
45334
|
+
}
|
|
45335
|
+
function parseTrunDuration(buf, start, end, defaultSampleDuration) {
|
|
45336
|
+
if (start + 8 > end) return 0;
|
|
45337
|
+
const flags = buf.readUIntBE(start + 1, 3);
|
|
45338
|
+
const sampleCount = buf.readUInt32BE(start + 4);
|
|
45339
|
+
let off = start + 8;
|
|
45340
|
+
if (0x000001 & flags) off += 4;
|
|
45341
|
+
if (0x000004 & flags) off += 4;
|
|
45342
|
+
const hasDuration = (0x000100 & flags) !== 0;
|
|
45343
|
+
if (!hasDuration) return sampleCount * defaultSampleDuration;
|
|
45344
|
+
const entrySize = 4 + ((0x000200 & flags) !== 0 ? 4 : 0) + ((0x000400 & flags) !== 0 ? 4 : 0) + ((0x000800 & flags) !== 0 ? 4 : 0);
|
|
45345
|
+
let total = 0;
|
|
45346
|
+
for(let i = 0; i < sampleCount; i++){
|
|
45347
|
+
const entryOff = off + i * entrySize;
|
|
45348
|
+
if (entryOff + 4 > end) break;
|
|
45349
|
+
total += buf.readUInt32BE(entryOff);
|
|
45350
|
+
}
|
|
45351
|
+
return total;
|
|
45352
|
+
}
|
|
45353
|
+
function parseStsdCodec(buf, start, end) {
|
|
45354
|
+
if (start + 16 > end) return null;
|
|
45355
|
+
if (0 === buf.readUInt32BE(start + 4)) return null;
|
|
45356
|
+
return buf.toString("latin1", start + 12, start + 16).toLowerCase();
|
|
45357
|
+
}
|
|
45358
|
+
function parseMvhd(buf, start, end) {
|
|
45359
|
+
const version = buf.readUInt8(start);
|
|
45360
|
+
if (1 === version) {
|
|
45361
|
+
if (start + 28 > end) return null;
|
|
45362
|
+
const timescale = buf.readUInt32BE(start + 20);
|
|
45363
|
+
const hi = buf.readUInt32BE(start + 24);
|
|
45364
|
+
const lo = buf.readUInt32BE(start + 28);
|
|
45365
|
+
return {
|
|
45366
|
+
timescale,
|
|
45367
|
+
duration: hi * 2 ** 32 + lo
|
|
45368
|
+
};
|
|
45369
|
+
}
|
|
45370
|
+
if (start + 20 > end) return null;
|
|
45371
|
+
return {
|
|
45372
|
+
timescale: buf.readUInt32BE(start + 12),
|
|
45373
|
+
duration: buf.readUInt32BE(start + 16)
|
|
45374
|
+
};
|
|
45375
|
+
}
|
|
45376
|
+
function parseTkhd(buf, start, end) {
|
|
45377
|
+
const version = buf.readUInt8(start);
|
|
45378
|
+
const afterDuration = 1 === version ? 36 : 24;
|
|
45379
|
+
const matrixOff = start + afterDuration + 16;
|
|
45380
|
+
const whOff = matrixOff + 36;
|
|
45381
|
+
const trackIdOff = start + (1 === version ? 20 : 12);
|
|
45382
|
+
const trackId = trackIdOff + 4 <= end ? buf.readUInt32BE(trackIdOff) : 0;
|
|
45383
|
+
if (whOff + 8 > end) return {
|
|
45384
|
+
trackId,
|
|
45385
|
+
width: 0,
|
|
45386
|
+
height: 0,
|
|
45387
|
+
rotation: 0
|
|
45388
|
+
};
|
|
45389
|
+
const width = buf.readUInt32BE(whOff) / 65536;
|
|
45390
|
+
const height = buf.readUInt32BE(whOff + 4) / 65536;
|
|
45391
|
+
const a = buf.readInt32BE(matrixOff) / 65536;
|
|
45392
|
+
const b = buf.readInt32BE(matrixOff + 4) / 65536;
|
|
45393
|
+
let rotation = 0;
|
|
45394
|
+
if (Math.abs(a) < 0.01 && Math.abs(b - 1) < 0.01) rotation = 90;
|
|
45395
|
+
else if (Math.abs(a + 1) < 0.01 && Math.abs(b) < 0.01) rotation = 180;
|
|
45396
|
+
else if (Math.abs(a) < 0.01 && Math.abs(b + 1) < 0.01) rotation = 270;
|
|
45397
|
+
return {
|
|
45398
|
+
trackId,
|
|
45399
|
+
width,
|
|
45400
|
+
height,
|
|
45401
|
+
rotation
|
|
45402
|
+
};
|
|
45403
|
+
}
|
|
45404
|
+
function parseVideoCodec(filePath) {
|
|
45405
|
+
return parseVideoMeta(filePath)?.codec ?? null;
|
|
45406
|
+
}
|
|
45407
|
+
function buildVideoMetaFromParams(filePath, metadata) {
|
|
45408
|
+
return {
|
|
45409
|
+
width: Math.round(metadata.width),
|
|
45410
|
+
height: Math.round(metadata.height),
|
|
45411
|
+
duration: metadata.duration,
|
|
45412
|
+
rotation: 0,
|
|
45413
|
+
fileSize: metadata.fileSize,
|
|
45414
|
+
codec: parseVideoCodec(filePath)
|
|
45415
|
+
};
|
|
45416
|
+
}
|
|
45417
|
+
const MAX_DURATION_SECONDS = 28800;
|
|
45418
|
+
const MAX_FILE_SIZE = 21474836480;
|
|
45419
|
+
const ALLOWED_EXTENSIONS = [
|
|
45420
|
+
".mp4"
|
|
45421
|
+
];
|
|
45422
|
+
const ALLOWED_CODECS = [
|
|
45423
|
+
"avc1",
|
|
45424
|
+
"avc3"
|
|
45425
|
+
];
|
|
45426
|
+
const MIN_TITLE_LENGTH = 6;
|
|
45427
|
+
function formatFileSize(bytes) {
|
|
45428
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(2)} KB`;
|
|
45429
|
+
if (bytes < 1073741824) return `${(bytes / 1024 / 1024).toFixed(2)} MB`;
|
|
45430
|
+
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
|
|
45431
|
+
}
|
|
45432
|
+
function formatDuration(seconds) {
|
|
45433
|
+
const total = Math.round(seconds);
|
|
45434
|
+
const h = Math.floor(total / 3600);
|
|
45435
|
+
const m = Math.floor(total % 3600 / 60);
|
|
45436
|
+
const s = total % 60;
|
|
45437
|
+
if (h > 0) return `${h}小时${m}分${s}秒`;
|
|
45438
|
+
if (m > 0) return `${m}分${s}秒`;
|
|
45439
|
+
return `${s}秒`;
|
|
45440
|
+
}
|
|
45441
|
+
function validateShipinhaoVideo(filePath, meta) {
|
|
45442
|
+
const fileName = external_node_path_default().basename(filePath);
|
|
45443
|
+
const ext = external_node_path_default().extname(fileName).toLowerCase();
|
|
45444
|
+
if (!ALLOWED_EXTENSIONS.includes(ext)) return `视频格式不支持:${fileName}。视频号仅支持 MP4/H.264 格式,请转换后重试。`;
|
|
45445
|
+
if (meta.duration > MAX_DURATION_SECONDS) return `视频时长超过限制:${fileName}(${formatDuration(meta.duration)})。视频号视频时长不能超过 8 小时,请剪辑后重试。`;
|
|
45446
|
+
if (meta.fileSize > MAX_FILE_SIZE) return `视频大小超过限制:${fileName}(${formatFileSize(meta.fileSize)})。视频号视频不能超过 20GB,请压缩后重试。`;
|
|
45447
|
+
if (meta.codec && !ALLOWED_CODECS.includes(meta.codec)) return `视频编码不支持:${fileName}(${meta.codec})。视频号仅支持 H.264 编码,请转码后重试。`;
|
|
45448
|
+
return null;
|
|
45449
|
+
}
|
|
45450
|
+
function validateShipinhaoTitle(title) {
|
|
45451
|
+
if (void 0 === title) return null;
|
|
45452
|
+
const trimmed = title.trim();
|
|
45453
|
+
const length = [
|
|
45454
|
+
...trimmed
|
|
45455
|
+
].length;
|
|
45456
|
+
if (length < MIN_TITLE_LENGTH) return `视频号标题至少需要 ${MIN_TITLE_LENGTH} 个字符,请补充后重试。`;
|
|
45457
|
+
return null;
|
|
45458
|
+
}
|
|
45459
|
+
const POST_CREATE_PAGE_URL = "https://channels.weixin.qq.com/micro/content/post/create";
|
|
45460
|
+
const MICRO_CONTENT_BASE = "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin";
|
|
45461
|
+
function resolveClientContext(params, fallbackUin) {
|
|
45462
|
+
const extra = params.extraParam || {};
|
|
45463
|
+
const deviceIdCookie = params.cookies.find((c)=>"device_id" === c.name || "finger_print_device_id" === c.name)?.value;
|
|
45464
|
+
return {
|
|
45465
|
+
aId: "string" == typeof extra.aId ? extra.aId : "",
|
|
45466
|
+
fingerPrintDeviceId: "string" == typeof extra.fingerPrintDeviceId ? extra.fingerPrintDeviceId : deviceIdCookie || "",
|
|
45467
|
+
uin: "string" == typeof extra.uin ? extra.uin : String(fallbackUin)
|
|
45468
|
+
};
|
|
45469
|
+
}
|
|
45470
|
+
function buildPublishHeaders(cookieString, client) {
|
|
45471
|
+
const headers = {
|
|
45472
|
+
cookie: cookieString,
|
|
45473
|
+
referer: POST_CREATE_PAGE_URL,
|
|
45474
|
+
origin: "https://channels.weixin.qq.com",
|
|
45475
|
+
"content-type": "application/json"
|
|
45476
|
+
};
|
|
45477
|
+
if (client.fingerPrintDeviceId) headers["finger-print-device-id"] = client.fingerPrintDeviceId;
|
|
45478
|
+
if (client.uin) headers["x-wechat-uin"] = client.uin;
|
|
45479
|
+
return headers;
|
|
45480
|
+
}
|
|
45481
|
+
function buildPublishQuery(client) {
|
|
45482
|
+
const query = {
|
|
45483
|
+
_rid: rid(),
|
|
45484
|
+
_pageUrl: POST_CREATE_PAGE_URL
|
|
45485
|
+
};
|
|
45486
|
+
if (client.aId) query._aid = client.aId;
|
|
45487
|
+
return query;
|
|
45488
|
+
}
|
|
45489
|
+
function buildCommonBody(finderUsername) {
|
|
45490
|
+
return {
|
|
45491
|
+
timestamp: String(Date.now()),
|
|
45492
|
+
_log_finder_uin: "",
|
|
45493
|
+
_log_finder_id: finderUsername,
|
|
45494
|
+
rawKeyBuff: "",
|
|
45495
|
+
pluginSessionId: null,
|
|
45496
|
+
scene: 7,
|
|
45497
|
+
reqScene: 7
|
|
45498
|
+
};
|
|
45499
|
+
}
|
|
45500
|
+
async function getTraceKey(auth, client, http, logger) {
|
|
45501
|
+
logger.info("[getTraceKey] 开始获取 traceKey...");
|
|
45502
|
+
const res = await http.api({
|
|
45503
|
+
method: "POST",
|
|
45504
|
+
url: `${MICRO_CONTENT_BASE}/post/get-finder-post-trace-key`,
|
|
45505
|
+
params: buildPublishQuery(client),
|
|
45506
|
+
data: {
|
|
45507
|
+
objectId: "",
|
|
45508
|
+
...buildCommonBody(auth.finderUsername)
|
|
45509
|
+
},
|
|
45510
|
+
defaultErrorMsg: "获取 traceKey 失败"
|
|
45511
|
+
});
|
|
45512
|
+
if (0 !== res.errCode || !res.data?.traceKey) {
|
|
45513
|
+
logger.error("[getTraceKey] 获取失败:", JSON.stringify(res));
|
|
45514
|
+
throw new Error(`获取 traceKey 失败: ${JSON.stringify(res)}`);
|
|
45515
|
+
}
|
|
45516
|
+
logger.info(`[getTraceKey] 获取成功: ${res.data.traceKey}`);
|
|
45517
|
+
return res.data.traceKey;
|
|
45518
|
+
}
|
|
45519
|
+
async function getObjectTagKey(auth, client, http, logger) {
|
|
45520
|
+
logger.info("[getObjectTagKey] 获取内容声明 tagKey...");
|
|
45521
|
+
try {
|
|
45522
|
+
const res = await http.api({
|
|
45523
|
+
method: "POST",
|
|
45524
|
+
url: `${MICRO_CONTENT_BASE}/post/finder_get_object_tag_list`,
|
|
45525
|
+
params: buildPublishQuery(client),
|
|
45526
|
+
data: {
|
|
45527
|
+
source: 1,
|
|
45528
|
+
...buildCommonBody(auth.finderUsername)
|
|
45529
|
+
},
|
|
45530
|
+
defaultErrorMsg: "获取内容声明标注失败"
|
|
45531
|
+
});
|
|
45532
|
+
if (0 !== res.errCode || !res.data?.tagKey) {
|
|
45533
|
+
logger.warn(`[getObjectTagKey] 未取到 tagKey: ${JSON.stringify(res)}`);
|
|
45534
|
+
return null;
|
|
45535
|
+
}
|
|
45536
|
+
logger.info(`[getObjectTagKey] tagKey: ${res.data.tagKey}`);
|
|
45537
|
+
return res.data.tagKey;
|
|
45538
|
+
} catch (error) {
|
|
45539
|
+
logger.warn(`[getObjectTagKey] 获取 tagKey 异常: ${stringifyError(error)}`);
|
|
45540
|
+
return null;
|
|
45541
|
+
}
|
|
45542
|
+
}
|
|
45543
|
+
async function submitAndPollTranscode(opts) {
|
|
45544
|
+
const { videoUrl, videoMeta, traceKey, uploadStartTime, uploadEndTime, finderUsername, client, http, logger } = opts;
|
|
45545
|
+
logger.info("[submitAndPollTranscode] 开始提交转码任务...");
|
|
45546
|
+
const finderUrl = videoUrl.includes("wxapp.tc.qq.com") ? `https://finder.video.qq.com${videoUrl.split("qq.com")[1]}` : videoUrl;
|
|
45547
|
+
logger.info(`[submitAndPollTranscode] 视频尺寸: ${videoMeta.width}x${videoMeta.height}, 时长: ${videoMeta.duration}s`);
|
|
45548
|
+
const submitRes = await http.api({
|
|
45549
|
+
method: "POST",
|
|
45550
|
+
url: `${MICRO_CONTENT_BASE}/post/post_clip_video`,
|
|
45551
|
+
params: buildPublishQuery(client),
|
|
45552
|
+
data: {
|
|
45553
|
+
url: finderUrl,
|
|
45554
|
+
timeStart: 0,
|
|
45555
|
+
cropDuration: 0,
|
|
45556
|
+
height: videoMeta.height,
|
|
45557
|
+
width: videoMeta.width,
|
|
45558
|
+
x: 0,
|
|
45559
|
+
y: 0,
|
|
45560
|
+
clipOriginVideoInfo: {
|
|
45561
|
+
width: videoMeta.width,
|
|
45562
|
+
height: videoMeta.height,
|
|
45563
|
+
duration: videoMeta.duration,
|
|
45564
|
+
fileSize: videoMeta.fileSize
|
|
45565
|
+
},
|
|
45566
|
+
traceInfo: {
|
|
45567
|
+
traceKey,
|
|
45568
|
+
uploadCdnStart: uploadStartTime,
|
|
45569
|
+
uploadCdnEnd: uploadEndTime
|
|
45570
|
+
},
|
|
45571
|
+
targetWidth: videoMeta.width,
|
|
45572
|
+
targetHeight: videoMeta.height,
|
|
45573
|
+
type: 4,
|
|
45574
|
+
useAstraThumbCover: 1,
|
|
45575
|
+
...buildCommonBody(finderUsername)
|
|
45576
|
+
},
|
|
45577
|
+
defaultErrorMsg: "提交转码失败"
|
|
45578
|
+
});
|
|
45579
|
+
if (0 !== submitRes.errCode || !submitRes.data?.clipKey) {
|
|
45580
|
+
logger.error("[submitAndPollTranscode] 提交转码失败:", JSON.stringify(submitRes));
|
|
45581
|
+
throw new Error(`提交转码失败: ${JSON.stringify(submitRes)}`);
|
|
45582
|
+
}
|
|
45583
|
+
const { clipKey, draftId } = submitRes.data;
|
|
45584
|
+
logger.info(`[submitAndPollTranscode] 转码任务已提交,clipKey: ${clipKey}, draftId: ${draftId}`);
|
|
45585
|
+
const pollInterval = 5000;
|
|
45586
|
+
const pollBudget = Math.min(1800000, 300000 + 1000 * Math.ceil(1.5 * videoMeta.duration));
|
|
45587
|
+
const maxPolls = Math.ceil(pollBudget / pollInterval);
|
|
45588
|
+
let pollCount = 0;
|
|
45589
|
+
logger.info(`[submitAndPollTranscode] 开始轮询转码结果,最多 ${maxPolls} 次(${Math.round(pollBudget / 1000)}s),间隔 ${pollInterval / 1000}s`);
|
|
45590
|
+
while(pollCount < maxPolls){
|
|
45591
|
+
await mock_sleep(pollInterval);
|
|
45592
|
+
pollCount++;
|
|
45593
|
+
const pollRes = await http.api({
|
|
45594
|
+
method: "POST",
|
|
45595
|
+
url: `${MICRO_CONTENT_BASE}/post/post_clip_video_result`,
|
|
45596
|
+
params: buildPublishQuery(client),
|
|
45597
|
+
data: {
|
|
45598
|
+
clipKey,
|
|
45599
|
+
draftId,
|
|
45600
|
+
...buildCommonBody(finderUsername)
|
|
45601
|
+
},
|
|
45602
|
+
defaultErrorMsg: "转码轮询失败"
|
|
45603
|
+
}, {
|
|
45604
|
+
timeout: 60000,
|
|
45605
|
+
retries: 2,
|
|
45606
|
+
retryDelay: 3000
|
|
45607
|
+
});
|
|
45608
|
+
if (0 !== pollRes.errCode) {
|
|
45609
|
+
logger.error(`[submitAndPollTranscode] 转码轮询失败 (poll ${pollCount}):`, JSON.stringify(pollRes));
|
|
45610
|
+
throw new Error(`转码轮询失败 (poll ${pollCount}): ${JSON.stringify(pollRes)}`);
|
|
45611
|
+
}
|
|
45612
|
+
const { flag, url, width, height, duration, md5, fileSize } = pollRes.data || {};
|
|
45613
|
+
logger.info(`[submitAndPollTranscode] 轮询第 ${pollCount} 次,flag=${flag}`);
|
|
45614
|
+
if (1 === flag) {
|
|
45615
|
+
if (!url || !width || !height || !duration || !md5 || !fileSize) {
|
|
45616
|
+
logger.error("[submitAndPollTranscode] 转码完成但返回数据不完整:", JSON.stringify(pollRes.data));
|
|
45617
|
+
throw new Error(`转码完成但返回数据不完整: ${JSON.stringify(pollRes.data)}`);
|
|
45618
|
+
}
|
|
45619
|
+
logger.info(`[submitAndPollTranscode] 转码完成! 用时: ${pollCount * pollInterval / 1000}s`);
|
|
45620
|
+
logger.info(`[submitAndPollTranscode] 视频信息: ${width}x${height}, 时长: ${duration}s, 大小: ${fileSize}`);
|
|
45621
|
+
return {
|
|
45622
|
+
clipKey,
|
|
45623
|
+
url,
|
|
45624
|
+
width,
|
|
45625
|
+
height,
|
|
45626
|
+
duration,
|
|
45627
|
+
md5,
|
|
45628
|
+
fileSize
|
|
45629
|
+
};
|
|
45630
|
+
}
|
|
45631
|
+
if (2 === flag) logger.info(`[submitAndPollTranscode] 转码中... (${pollCount}/${maxPolls})`);
|
|
45632
|
+
else {
|
|
45633
|
+
logger.error(`[submitAndPollTranscode] 转码失败,未知 flag=${flag}:`, JSON.stringify(pollRes.data));
|
|
45634
|
+
throw new Error(`转码失败,未知 flag=${flag}: ${JSON.stringify(pollRes.data)}`);
|
|
45635
|
+
}
|
|
45636
|
+
}
|
|
45637
|
+
logger.error(`[submitAndPollTranscode] 转码超时,已轮询 ${maxPolls} 次,用时: ${maxPolls * pollInterval / 1000}s`);
|
|
45638
|
+
throw new Error(`转码超时 (${maxPolls * pollInterval / 1000}s)`);
|
|
45639
|
+
}
|
|
45640
|
+
async function publishVideo(opts) {
|
|
45641
|
+
const { params, auth, client, clipResult, videoUpload, coverUpload, verticalCoverUpload, videoMeta, traceKey, tagKey, uploadStartTime, uploadEndTime, proxyHttp, logger } = opts;
|
|
45642
|
+
logger.info("[publishVideo] 开始构建发布请求...");
|
|
45643
|
+
const toFinderUrl = (url)=>url.includes("wxapp.tc.qq.com") ? `https://finder.video.qq.com${url.split("qq.com")[1]}` : url;
|
|
45644
|
+
const thumbFinderUrl = toFinderUrl(coverUpload.downloadUrl);
|
|
45645
|
+
const coverFinderUrl = toFinderUrl(verticalCoverUpload.downloadUrl);
|
|
45646
|
+
const md5sumUuid = external_node_crypto_default().randomUUID();
|
|
45647
|
+
const description = params.description;
|
|
45648
|
+
logger.info("[publishVideo] 发布参数:");
|
|
45649
|
+
logger.info(` - 短标题: ${params.title || "(无)"}`);
|
|
45650
|
+
logger.info(` - 描述: ${description.substring(0, 50)}${description.length > 50 ? "..." : ""}`);
|
|
45651
|
+
logger.info(` - 定时发布: ${params.scheduledTime ? new Date(1000 * params.scheduledTime).toLocaleString() : "立即发布"}`);
|
|
45652
|
+
const objectDesc = {
|
|
45653
|
+
mpTitle: "",
|
|
45654
|
+
description,
|
|
45655
|
+
extReading: buildExtReading(params.link),
|
|
45656
|
+
mediaType: 4,
|
|
45657
|
+
location: payload_buildLocation(params.location),
|
|
45658
|
+
topic: buildTopic({
|
|
45659
|
+
description: params.description,
|
|
45660
|
+
topics: params.topics,
|
|
45661
|
+
mentionedUsers: params.mentionedUsers,
|
|
45662
|
+
collection: params.collection
|
|
45663
|
+
}),
|
|
45664
|
+
event: buildEvent(params.event),
|
|
45665
|
+
mentionedUser: buildMentionedUser(params.mentionedUsers),
|
|
45666
|
+
media: [
|
|
45667
|
+
{
|
|
45668
|
+
url: clipResult.url,
|
|
45669
|
+
fileSize: clipResult.fileSize,
|
|
45670
|
+
thumbUrl: thumbFinderUrl,
|
|
45671
|
+
fullThumbUrl: thumbFinderUrl,
|
|
45672
|
+
coverUrl: coverFinderUrl,
|
|
45673
|
+
fullCoverUrl: coverFinderUrl,
|
|
45674
|
+
shareCoverUrl: coverFinderUrl,
|
|
45675
|
+
mediaType: 4,
|
|
45676
|
+
videoPlayLen: Math.round(clipResult.duration),
|
|
45677
|
+
width: clipResult.width,
|
|
45678
|
+
height: clipResult.height,
|
|
45679
|
+
md5sum: md5sumUuid,
|
|
45680
|
+
cardShowStyle: 2,
|
|
45681
|
+
urlCdnTaskId: clipResult.clipKey
|
|
45682
|
+
}
|
|
45683
|
+
],
|
|
45684
|
+
shortTitle: params.title ? [
|
|
45685
|
+
{
|
|
45686
|
+
shortTitle: params.title
|
|
45687
|
+
}
|
|
45688
|
+
] : [],
|
|
45689
|
+
member: {}
|
|
45690
|
+
};
|
|
45691
|
+
const publishData = {
|
|
45692
|
+
objectType: 0,
|
|
45693
|
+
longitude: 0,
|
|
45694
|
+
latitude: 0,
|
|
45695
|
+
feedLongitude: 0,
|
|
45696
|
+
feedLatitude: 0,
|
|
45697
|
+
originalFlag: params.originalFlag ?? 0,
|
|
45698
|
+
topics: params.topics || [],
|
|
45699
|
+
isFullPost: 1,
|
|
45700
|
+
handleFlag: 2,
|
|
45701
|
+
videoClipTaskId: clipResult.clipKey,
|
|
45702
|
+
traceInfo: {
|
|
45703
|
+
traceKey,
|
|
45704
|
+
uploadCdnStart: uploadStartTime,
|
|
45705
|
+
uploadCdnEnd: uploadEndTime
|
|
45706
|
+
},
|
|
45707
|
+
objectDesc,
|
|
45708
|
+
report: {
|
|
45709
|
+
clipKey: clipResult.clipKey,
|
|
45710
|
+
draftId: clipResult.clipKey,
|
|
45711
|
+
...buildCommonBody(auth.finderUsername),
|
|
45712
|
+
height: videoMeta.height,
|
|
45713
|
+
width: videoMeta.width,
|
|
45714
|
+
duration: videoMeta.duration,
|
|
45715
|
+
fileSize: videoUpload.fileSize,
|
|
45716
|
+
uploadCost: (uploadEndTime - uploadStartTime) * 1000
|
|
45717
|
+
},
|
|
45718
|
+
postFlag: 0,
|
|
45719
|
+
mode: 1,
|
|
45720
|
+
clientid: external_node_crypto_default().randomUUID(),
|
|
45721
|
+
...buildCommonBody(auth.finderUsername)
|
|
45722
|
+
};
|
|
45723
|
+
if (params.scheduledTime) publishData.effectiveTime = params.scheduledTime;
|
|
45724
|
+
if (params.tagInfo && tagKey) publishData.tagInfo = buildTagInfo(params.tagInfo, tagKey);
|
|
45725
|
+
logger.info("[publishVideo] 开始发布视频,全部参数:" + JSON.stringify(publishData));
|
|
45726
|
+
const publishRes = await proxyHttp.api({
|
|
45727
|
+
method: "POST",
|
|
45728
|
+
url: `${MICRO_CONTENT_BASE}/post/post_create`,
|
|
45729
|
+
params: buildPublishQuery(client),
|
|
45730
|
+
data: publishData,
|
|
45731
|
+
defaultErrorMsg: "发布视频失败"
|
|
45732
|
+
});
|
|
45733
|
+
logger.info(`[publishVideo] 发布响应: errCode=${publishRes.errCode}, baseResp.errcode=${publishRes.data?.baseResp?.errcode}`);
|
|
45734
|
+
return publishRes;
|
|
45735
|
+
}
|
|
45736
|
+
function mock_sleep(ms) {
|
|
45737
|
+
return new Promise((resolve)=>setTimeout(resolve, ms));
|
|
45738
|
+
}
|
|
45739
|
+
async function resolveLocalCoverPath(coverPath, label, tmpCachePath, logger) {
|
|
45740
|
+
if (!/^https?:\/\//i.test(coverPath)) return coverPath;
|
|
45741
|
+
const fileName = getFilenameFromUrl(coverPath);
|
|
45742
|
+
const savePath = external_node_path_default().join(tmpCachePath, `${Date.now()}-${label}-${fileName}`);
|
|
45743
|
+
await downloadImage(coverPath, savePath);
|
|
45744
|
+
return savePath;
|
|
45745
|
+
}
|
|
45746
|
+
const shipinhaoPublishVideo_mock_mockAction = async (task, params)=>{
|
|
45747
|
+
task.logger.info("[shipinhaoPublishVideo] 开始执行视频号视频发布 - Mock API 方式");
|
|
45748
|
+
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
45749
|
+
let currentStep = "初始化";
|
|
45750
|
+
try {
|
|
45751
|
+
task.logger.info(`[shipinhaoPublishVideo] 发布方式: ${params.scheduledTime ? `定时 ${new Date(1000 * params.scheduledTime).toLocaleString()}` : "立即发布"}`);
|
|
45752
|
+
currentStep = "解析认证信息";
|
|
45753
|
+
const cookieString = params.cookies.map((c)=>`${c.name}=${c.value}`).join("; ");
|
|
45754
|
+
const http = new Http({
|
|
45755
|
+
headers: {
|
|
45756
|
+
cookie: cookieString
|
|
45757
|
+
}
|
|
45758
|
+
});
|
|
45759
|
+
currentStep = "验证发布参数";
|
|
45760
|
+
if (!params.videoPath) return utils_response(414, "视频文件路径不能为空", "");
|
|
45761
|
+
if (!params.coverPath) return utils_response(414, "横屏封面图片路径不能为空", "");
|
|
45762
|
+
currentStep = "获取上传认证";
|
|
45763
|
+
task.logger.info("[shipinhaoPublishVideo] 获取上传认证...");
|
|
45764
|
+
const auth = await getShipinhaoUploadAuth(cookieString, http);
|
|
45765
|
+
const client = resolveClientContext(params, auth.uin);
|
|
45766
|
+
if (!client.aId) task.logger.warn("[shipinhaoPublishVideo] extraParam.aId 缺失,query 将不带 _aid");
|
|
45767
|
+
if (!client.fingerPrintDeviceId) task.logger.warn("[shipinhaoPublishVideo] extraParam.fingerPrintDeviceId 缺失,请求将不带 finger-print-device-id");
|
|
45768
|
+
const publishHeaders = buildPublishHeaders(cookieString, client);
|
|
45769
|
+
const microHttp = new Http({
|
|
45770
|
+
headers: publishHeaders
|
|
45771
|
+
});
|
|
45772
|
+
const args = [
|
|
45773
|
+
{
|
|
45774
|
+
headers: publishHeaders
|
|
45775
|
+
},
|
|
45776
|
+
task.logger,
|
|
45777
|
+
params.proxyLoc,
|
|
45778
|
+
params.accountId,
|
|
45779
|
+
"shipinhao"
|
|
45780
|
+
];
|
|
45781
|
+
const proxyHttp = new Http(...args);
|
|
45782
|
+
currentStep = "组装视频元数据";
|
|
45783
|
+
task.logger.info("[shipinhaoPublishVideo] 组装视频元数据...");
|
|
45784
|
+
const videoMeta = buildVideoMetaFromParams(params.videoPath, params.videoMetadata);
|
|
45785
|
+
task.logger.info(`[shipinhaoPublishVideo] 视频: ${videoMeta.width}×${videoMeta.height}, ${videoMeta.duration.toFixed(2)}s, ${(videoMeta.fileSize / 1024 / 1024).toFixed(2)}MB, codec=${videoMeta.codec || "unknown"}`);
|
|
45786
|
+
if (!videoMeta.codec) task.logger.warn("[shipinhaoPublishVideo] 未能读取视频编码格式,跳过 H.264 预检,交由服务端判断");
|
|
45787
|
+
currentStep = "校验视频限制";
|
|
45788
|
+
const validationError = validateShipinhaoVideo(params.videoPath, videoMeta);
|
|
45789
|
+
if (validationError) {
|
|
45790
|
+
task.logger.error(`[shipinhaoPublishVideo] 视频校验未通过: ${validationError}`);
|
|
45791
|
+
await updateTaskState?.({
|
|
45792
|
+
state: types_TaskState.FAILED,
|
|
45793
|
+
error: validationError
|
|
45794
|
+
});
|
|
45795
|
+
return utils_response(414, validationError, "");
|
|
45796
|
+
}
|
|
45797
|
+
task.logger.info("[shipinhaoPublishVideo] 视频校验通过");
|
|
45798
|
+
currentStep = "校验标题";
|
|
45799
|
+
const titleError = validateShipinhaoTitle(params.title);
|
|
45800
|
+
if (titleError) {
|
|
45801
|
+
task.logger.error(`[shipinhaoPublishVideo] 标题校验未通过: ${titleError}`);
|
|
45802
|
+
await updateTaskState?.({
|
|
45803
|
+
state: types_TaskState.FAILED,
|
|
45804
|
+
error: titleError
|
|
45805
|
+
});
|
|
45806
|
+
return utils_response(414, titleError, "");
|
|
45807
|
+
}
|
|
45808
|
+
currentStep = "获取 traceKey";
|
|
45809
|
+
task.logger.info("[shipinhaoPublishVideo] 获取 traceKey...");
|
|
45810
|
+
const traceKey = await getTraceKey(auth, client, microHttp, task.logger);
|
|
45811
|
+
let tagKey = null;
|
|
45812
|
+
if (params.tagInfo) {
|
|
45813
|
+
currentStep = "获取内容声明 tagKey";
|
|
45814
|
+
tagKey = await getObjectTagKey(auth, client, microHttp, task.logger);
|
|
45815
|
+
}
|
|
45816
|
+
const uploadStartTime = Math.floor(Date.now() / 1000);
|
|
45817
|
+
task.logger.info(`[shipinhaoPublishVideo] 上传开始时间: ${uploadStartTime}`);
|
|
45818
|
+
currentStep = "上传视频";
|
|
45819
|
+
task.logger.info("[shipinhaoPublishVideo] 上传视频...");
|
|
45820
|
+
task.logger.info(`[shipinhaoPublishVideo] 视频路径: ${params.videoPath}`);
|
|
45821
|
+
task.logger.info(`[shipinhaoPublishVideo] 视频文件类型: ${auth.videoFileType}`);
|
|
45822
|
+
const videoUpload = await uploader_uploadFile({
|
|
45823
|
+
filePath: params.videoPath,
|
|
45824
|
+
fileType: auth.videoFileType,
|
|
45825
|
+
uin: auth.uin,
|
|
45826
|
+
authKey: auth.authKey,
|
|
45827
|
+
http,
|
|
45828
|
+
logger: task.logger
|
|
45829
|
+
});
|
|
45830
|
+
task.logger.info("[shipinhaoPublishVideo] 视频上传完成");
|
|
45831
|
+
const uploadEndTime = Math.floor(Date.now() / 1000);
|
|
45832
|
+
task.logger.info(`[shipinhaoPublishVideo] 上传结束时间: ${uploadEndTime}, 耗时: ${uploadEndTime - uploadStartTime}s`);
|
|
45833
|
+
currentStep = "上传横屏封面";
|
|
45834
|
+
const localCoverPath = await resolveLocalCoverPath(params.coverPath, "横屏封面", task.getTmpPath(), task.logger);
|
|
45835
|
+
task.logger.info("[shipinhaoPublishVideo] 上传横屏封面...");
|
|
45836
|
+
const coverUpload = await uploader_uploadFile({
|
|
45837
|
+
filePath: localCoverPath,
|
|
45838
|
+
fileType: auth.pictureFileType,
|
|
45839
|
+
uin: auth.uin,
|
|
45840
|
+
authKey: auth.authKey,
|
|
45841
|
+
http,
|
|
45842
|
+
logger: task.logger
|
|
45843
|
+
});
|
|
45844
|
+
task.logger.info("[shipinhaoPublishVideo] 横屏封面上传完成");
|
|
45845
|
+
let verticalCoverUpload = coverUpload;
|
|
45846
|
+
if (params.verticalCoverPath) {
|
|
45847
|
+
currentStep = "上传竖屏封面";
|
|
45848
|
+
const localVerticalPath = await resolveLocalCoverPath(params.verticalCoverPath, "竖屏封面", task.getTmpPath(), task.logger);
|
|
45849
|
+
task.logger.info("[shipinhaoPublishVideo] 上传竖屏封面");
|
|
45850
|
+
verticalCoverUpload = await uploader_uploadFile({
|
|
45851
|
+
filePath: localVerticalPath,
|
|
45852
|
+
fileType: auth.pictureFileType,
|
|
45853
|
+
uin: auth.uin,
|
|
45854
|
+
authKey: auth.authKey,
|
|
45855
|
+
http,
|
|
45856
|
+
logger: task.logger
|
|
45857
|
+
});
|
|
45858
|
+
task.logger.info("[shipinhaoPublishVideo] 竖屏封面上传完成");
|
|
45859
|
+
} else task.logger.info("[shipinhaoPublishVideo] 未传竖屏封面,复用横屏封面");
|
|
45860
|
+
currentStep = "提交转码";
|
|
45861
|
+
task.logger.info("[shipinhaoPublishVideo] 提交转码...");
|
|
45862
|
+
const clipResult = await submitAndPollTranscode({
|
|
45863
|
+
videoUrl: videoUpload.downloadUrl,
|
|
45864
|
+
videoMeta,
|
|
45865
|
+
traceKey,
|
|
45866
|
+
uploadStartTime,
|
|
45867
|
+
uploadEndTime,
|
|
45868
|
+
finderUsername: auth.finderUsername,
|
|
45869
|
+
client,
|
|
45870
|
+
http: microHttp,
|
|
45871
|
+
logger: task.logger
|
|
45872
|
+
});
|
|
45873
|
+
currentStep = "发布视频";
|
|
45874
|
+
task.logger.info("[shipinhaoPublishVideo] 发布视频...");
|
|
45875
|
+
task.logger.info(`[shipinhaoPublishVideo] clipKey: ${clipResult.clipKey}`);
|
|
45876
|
+
let publishResult;
|
|
45877
|
+
try {
|
|
45878
|
+
publishResult = await publishVideo({
|
|
45879
|
+
params,
|
|
45880
|
+
auth,
|
|
45881
|
+
client,
|
|
45882
|
+
clipResult,
|
|
45883
|
+
videoUpload,
|
|
45884
|
+
coverUpload,
|
|
45885
|
+
verticalCoverUpload,
|
|
45886
|
+
videoMeta,
|
|
45887
|
+
traceKey,
|
|
45888
|
+
tagKey,
|
|
45889
|
+
uploadStartTime,
|
|
45890
|
+
uploadEndTime,
|
|
45891
|
+
proxyHttp,
|
|
45892
|
+
logger: task.logger
|
|
45893
|
+
});
|
|
45894
|
+
} catch (error) {
|
|
45895
|
+
const handledError = Http.handleApiError(error);
|
|
45896
|
+
task.logger.error(`[shipinhaoPublishVideo] 发布请求失败: ${handledError.message}`, stringifyError(handledError));
|
|
45897
|
+
const classified = classifyPublishError(handledError);
|
|
45898
|
+
if (classified) {
|
|
45899
|
+
const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
45900
|
+
task.logger.error(`[shipinhaoPublishVideo] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
|
|
45901
|
+
await updateTaskState?.({
|
|
45902
|
+
state: types_TaskState.FAILED,
|
|
45903
|
+
error: message
|
|
45904
|
+
});
|
|
45905
|
+
return {
|
|
45906
|
+
code: 414,
|
|
45907
|
+
data: "",
|
|
45908
|
+
message
|
|
45909
|
+
};
|
|
45910
|
+
}
|
|
45911
|
+
throw error;
|
|
45912
|
+
}
|
|
45913
|
+
task.logger.info(`[shipinhaoPublishVideo] publishResult: ${JSON.stringify(publishResult)}`);
|
|
45914
|
+
const resultCode = publishResult.data?.baseResp?.errcode ?? publishResult.errCode;
|
|
45915
|
+
const resultMsg = publishResult.data?.baseResp?.errmsg ?? (0 === resultCode ? "发布成功" : `发布失败(errCode=${resultCode})`);
|
|
45916
|
+
if (0 === resultCode) {
|
|
45917
|
+
task.logger.info("[shipinhaoPublishVideo] 发布成功");
|
|
45918
|
+
task.logger.info(`[shipinhaoPublishVideo] 作品ID: ${clipResult.clipKey}`);
|
|
45919
|
+
task.logger.info(`[shipinhaoPublishVideo] 视频URL: ${clipResult.url}`);
|
|
45920
|
+
task.logger.info(`[shipinhaoPublishVideo] 横屏封面URL: ${coverUpload.downloadUrl}`);
|
|
45921
|
+
task.logger.info(`[shipinhaoPublishVideo] 竖屏封面URL: ${verticalCoverUpload.downloadUrl}`);
|
|
45922
|
+
await updateTaskState?.({
|
|
45923
|
+
state: types_TaskState.SUCCESS,
|
|
45924
|
+
result: {
|
|
45925
|
+
response: resultMsg
|
|
45926
|
+
}
|
|
45927
|
+
});
|
|
45928
|
+
reportLogger({
|
|
45929
|
+
token: params.huiwenToken || "",
|
|
45930
|
+
enverionment: task.enverionment || "development",
|
|
45931
|
+
postId: params.articleId,
|
|
45932
|
+
eip: proxyHttp.proxyInfo,
|
|
45933
|
+
accountId: params.accountId,
|
|
45934
|
+
uid: params.uid,
|
|
45935
|
+
publishParams: {
|
|
45936
|
+
videoPath: params.videoPath,
|
|
45937
|
+
coverPath: params.coverPath,
|
|
45938
|
+
verticalCoverPath: params.verticalCoverPath,
|
|
45939
|
+
title: params.title,
|
|
45940
|
+
topics: params.topics,
|
|
45941
|
+
mentionedUsers: params.mentionedUsers,
|
|
45942
|
+
collection: params.collection,
|
|
45943
|
+
event: params.event,
|
|
45944
|
+
link: params.link,
|
|
45945
|
+
tagInfo: params.tagInfo,
|
|
45946
|
+
originalFlag: params.originalFlag,
|
|
45947
|
+
scheduledTime: params.scheduledTime
|
|
45948
|
+
},
|
|
45949
|
+
platform: "shipinhao"
|
|
45950
|
+
});
|
|
45951
|
+
task.logger.info("[shipinhaoPublishVideo] 日志上报完成");
|
|
45952
|
+
return utils_response(0, "发布成功", clipResult.clipKey);
|
|
45953
|
+
}
|
|
45954
|
+
let errorMessage = resultMsg;
|
|
45955
|
+
if (-11224 === resultCode) errorMessage = "视频号管理员完成实名且绑定手机号后才可以发表";
|
|
45956
|
+
else if (300333 === resultCode || 300334 === resultCode) errorMessage = "登录失效";
|
|
45957
|
+
else if (300330 === resultCode) errorMessage = "未登录";
|
|
45958
|
+
else if (300002 === resultCode) errorMessage = "官方平台在校验音乐/位置/定时信息时失败了,请重新编辑后发布";
|
|
45959
|
+
task.logger.error(`[shipinhaoPublishVideo] 发布失败: ${errorMessage} (errCode=${resultCode})`);
|
|
45960
|
+
await updateTaskState?.({
|
|
45961
|
+
state: types_TaskState.FAILED,
|
|
45962
|
+
error: errorMessage
|
|
45963
|
+
});
|
|
45964
|
+
return utils_response(resultCode || 414, errorMessage, "");
|
|
45965
|
+
} catch (error) {
|
|
45966
|
+
const handledError = Http.handleApiError(error);
|
|
45967
|
+
const errorMsg = handledError.message || "发布失败,请稍后重试";
|
|
45968
|
+
const errorCode = handledError.code || 414;
|
|
45969
|
+
task.logger.error(`[shipinhaoPublishVideo] 发布流程异常 [${currentStep}]: ${errorMsg}`, stringifyError(error), handledError.extra);
|
|
45970
|
+
task.logger.error(`[shipinhaoPublishVideo] 错误码: ${errorCode}, 当前步骤: ${currentStep}`);
|
|
45971
|
+
await updateTaskState?.({
|
|
45972
|
+
state: types_TaskState.FAILED,
|
|
45973
|
+
error: errorMsg
|
|
45974
|
+
});
|
|
45975
|
+
return utils_response(errorCode, errorMsg, "");
|
|
45976
|
+
}
|
|
45977
|
+
};
|
|
45978
|
+
const shipinhaoPublishVideo_rpa_rpaAction = async (task, params)=>{
|
|
45979
|
+
task.logger.info("开始微信视频号视频发布(RPA 模式)");
|
|
45980
|
+
const videoMeta = buildVideoMetaFromParams(params.videoPath, params.videoMetadata);
|
|
45981
|
+
task.logger.info(`视频: ${videoMeta.width}×${videoMeta.height}, ${videoMeta.duration.toFixed(2)}s, ${(videoMeta.fileSize / 1024 / 1024).toFixed(2)}MB, codec=${videoMeta.codec || "unknown"}`);
|
|
45982
|
+
if (!videoMeta.codec) task.logger.warn("未能读取视频编码格式,跳过 H.264 预检,交由服务端判断");
|
|
45983
|
+
const validationError = validateShipinhaoVideo(params.videoPath, videoMeta);
|
|
45984
|
+
if (validationError) {
|
|
45985
|
+
task.logger.error(`视频校验未通过: ${validationError}`);
|
|
45986
|
+
return utils_response(414, validationError, "");
|
|
45987
|
+
}
|
|
45988
|
+
task.logger.info("视频校验通过");
|
|
45989
|
+
const titleError = validateShipinhaoTitle(params.title);
|
|
45990
|
+
if (titleError) {
|
|
45991
|
+
task.logger.error(`标题校验未通过: ${titleError}`);
|
|
45992
|
+
return utils_response(414, titleError, "");
|
|
45993
|
+
}
|
|
45994
|
+
const unsupported = [
|
|
45995
|
+
params.verticalCoverPath && "verticalCoverPath",
|
|
45996
|
+
params.collection && "collection",
|
|
45997
|
+
params.originalFlag && "originalFlag",
|
|
45998
|
+
params.postWithMemberZoneLink && "postWithMemberZoneLink"
|
|
45999
|
+
].filter(Boolean);
|
|
46000
|
+
if (unsupported.length) task.logger.warn(`RPA 模式不支持以下参数,将被忽略: ${unsupported.join("、")};如需生效请使用 mockApi 模式`);
|
|
46001
|
+
if (params.tagInfo && 5 === params.tagInfo.tagType) {
|
|
46002
|
+
const shootInfo = params.tagInfo.shootInfo;
|
|
46003
|
+
if (shootInfo && (shootInfo.provinceCode || shootInfo.cityCode)) task.logger.warn("tagInfo.tagType=5 在 RPA 模式下仅支持拍摄时间和国家选择,省市选择需要使用 mockApi 模式");
|
|
46004
|
+
}
|
|
46005
|
+
const tmpCachePath = task.getTmpPath();
|
|
46006
|
+
const page = await task.createPage({
|
|
46007
|
+
url: "https://channels.weixin.qq.com/platform/post/create",
|
|
46008
|
+
show: task.debug,
|
|
46009
|
+
cookies: params.cookies
|
|
46010
|
+
});
|
|
46011
|
+
try {
|
|
46012
|
+
const waitForElement = async (selector, timeout = 10000)=>{
|
|
46013
|
+
try {
|
|
46014
|
+
const element = page.locator(selector);
|
|
46015
|
+
await element.waitFor({
|
|
46016
|
+
state: "visible",
|
|
46017
|
+
timeout
|
|
46018
|
+
});
|
|
46019
|
+
return element;
|
|
46020
|
+
} catch {
|
|
46021
|
+
task.logger.warn(`元素未找到: ${selector}`);
|
|
46022
|
+
return null;
|
|
46023
|
+
}
|
|
46024
|
+
};
|
|
46025
|
+
const retryAction = async (action, maxRetries = 3, delay = 1000)=>{
|
|
46026
|
+
let lastError;
|
|
46027
|
+
for(let i = 0; i < maxRetries; i++)try {
|
|
46028
|
+
return await action();
|
|
46029
|
+
} catch (error) {
|
|
46030
|
+
lastError = error;
|
|
46031
|
+
task.logger.warn(`重试 ${i + 1}/${maxRetries}: ${lastError.message}`);
|
|
46032
|
+
if (i < maxRetries - 1) await page.waitForTimeout(delay);
|
|
46033
|
+
}
|
|
46034
|
+
throw lastError;
|
|
46035
|
+
};
|
|
46036
|
+
task.logger.info("等待页面加载...");
|
|
46037
|
+
task.logger.info("检查登录状态...");
|
|
46038
|
+
if (task.debug) {
|
|
46039
|
+
task.logger.info(`当前页面 URL: ${page.url()}`);
|
|
46040
|
+
const title = await page.title();
|
|
46041
|
+
task.logger.info(`页面标题: ${title}`);
|
|
46042
|
+
}
|
|
46043
|
+
try {
|
|
46044
|
+
await page.waitForSelector(".post-edit-wrap", {
|
|
46045
|
+
state: "visible",
|
|
46046
|
+
timeout: 30000
|
|
46047
|
+
});
|
|
46048
|
+
task.logger.info("✓ 登录状态正常,找到编辑器容器");
|
|
46049
|
+
} catch {
|
|
46050
|
+
task.logger.error("✗ 未找到编辑器,可能登录失效");
|
|
46051
|
+
return {
|
|
46052
|
+
code: 414,
|
|
46053
|
+
message: "登录失效或页面加载异常",
|
|
46054
|
+
data: page.url()
|
|
46055
|
+
};
|
|
46056
|
+
}
|
|
46057
|
+
task.logger.info("页面加载完成,开始填充内容");
|
|
46058
|
+
task.logger.info("开始上传视频");
|
|
46059
|
+
await retryAction(async ()=>{
|
|
46060
|
+
const videoUploadSelectors = [
|
|
46061
|
+
'.ant-upload-btn input[type="file"][accept*="video"]',
|
|
46062
|
+
'.upload input[type="file"][accept*="video"]',
|
|
46063
|
+
'input[type="file"][accept*="video"]'
|
|
46064
|
+
];
|
|
46065
|
+
let uploadInput = null;
|
|
46066
|
+
if (task.debug) {
|
|
46067
|
+
const allFileInputs = await page.locator('input[type="file"]').count();
|
|
46068
|
+
task.logger.info(`页面中共找到 ${allFileInputs} 个文件上传输入框`);
|
|
46069
|
+
}
|
|
46070
|
+
for (const selector of videoUploadSelectors){
|
|
46071
|
+
const input = page.locator(selector);
|
|
46072
|
+
const count = await input.count();
|
|
46073
|
+
if (count > 0) {
|
|
46074
|
+
uploadInput = input.first();
|
|
46075
|
+
task.logger.info(`找到视频上传输入框: ${selector}`);
|
|
46076
|
+
break;
|
|
46077
|
+
}
|
|
46078
|
+
}
|
|
46079
|
+
if (!uploadInput) {
|
|
46080
|
+
task.logger.warn("未找到视频上传输入框,等待 3 秒后重试...");
|
|
46081
|
+
await page.waitForTimeout(3000);
|
|
46082
|
+
const anyFileInput = page.locator('input[type="file"]');
|
|
46083
|
+
const inputCount = await anyFileInput.count();
|
|
46084
|
+
if (inputCount > 0) {
|
|
46085
|
+
uploadInput = anyFileInput.first();
|
|
46086
|
+
task.logger.info(`找到文件输入框(共 ${inputCount} 个)`);
|
|
46087
|
+
} else {
|
|
46088
|
+
if (task.debug) {
|
|
46089
|
+
const screenshotPath = external_node_path_default().join(tmpCachePath, `upload-error-${Date.now()}.png`);
|
|
46090
|
+
await page.screenshot({
|
|
46091
|
+
path: screenshotPath,
|
|
46092
|
+
fullPage: true
|
|
46093
|
+
});
|
|
46094
|
+
task.logger.error(`未找到上传输入框,已截图保存至: ${screenshotPath}`);
|
|
46095
|
+
}
|
|
46096
|
+
throw new Error("未找到视频上传输入框");
|
|
46097
|
+
}
|
|
46098
|
+
}
|
|
46099
|
+
await uploadInput.setInputFiles(params.videoPath);
|
|
46100
|
+
task.logger.info("视频上传成功");
|
|
46101
|
+
await page.waitForTimeout(5000);
|
|
46102
|
+
});
|
|
46103
|
+
if (params.coverPath) {
|
|
46104
|
+
task.logger.info("开始上传封面");
|
|
46105
|
+
await retryAction(async ()=>{
|
|
46106
|
+
const coverUploadBtn = await waitForElement(".cover-upload-btn", 10000);
|
|
46107
|
+
if (coverUploadBtn) {
|
|
46108
|
+
const coverInput = page.locator('.cover-upload-btn input[type="file"]');
|
|
46109
|
+
await coverInput.setInputFiles(params.coverPath);
|
|
46110
|
+
task.logger.info("封面上传成功");
|
|
46111
|
+
await page.waitForTimeout(2000);
|
|
46112
|
+
}
|
|
46113
|
+
});
|
|
46114
|
+
}
|
|
46115
|
+
const descriptionText = payload_buildDescription({
|
|
46116
|
+
description: params.description,
|
|
46117
|
+
topics: params.topics,
|
|
46118
|
+
mentionedUsers: params.mentionedUsers
|
|
46119
|
+
});
|
|
46120
|
+
if (descriptionText) {
|
|
46121
|
+
task.logger.info("填写视频描述");
|
|
46122
|
+
await retryAction(async ()=>{
|
|
46123
|
+
const descEditor = await waitForElement(".input-editor", 10000);
|
|
46124
|
+
if (!descEditor) throw new Error("未找到描述编辑器");
|
|
46125
|
+
await descEditor.click();
|
|
46126
|
+
await page.waitForTimeout(500);
|
|
46127
|
+
await descEditor.evaluate((el)=>{
|
|
46128
|
+
el.textContent = "";
|
|
46129
|
+
});
|
|
46130
|
+
await page.waitForTimeout(300);
|
|
46131
|
+
task.logger.info("已清空编辑器内容");
|
|
46132
|
+
await descEditor.pressSequentially(descriptionText, {
|
|
46133
|
+
delay: 10
|
|
46134
|
+
});
|
|
46135
|
+
await page.waitForTimeout(500);
|
|
46136
|
+
task.logger.info("描述填写完成");
|
|
46137
|
+
});
|
|
46138
|
+
}
|
|
46139
|
+
if (params.title) {
|
|
46140
|
+
task.logger.info(`填写标题: ${params.title}`);
|
|
46141
|
+
const title = params.title;
|
|
46142
|
+
await retryAction(async ()=>{
|
|
46143
|
+
const titleInput = await waitForElement("#container-wrap div.form-item-body.short-title-wrap input", 10000);
|
|
46144
|
+
if (!titleInput) throw new Error("未找到标题输入框");
|
|
46145
|
+
await titleInput.click();
|
|
46146
|
+
await titleInput.clear({
|
|
46147
|
+
timeout: 3000
|
|
46148
|
+
});
|
|
46149
|
+
await titleInput.fill(title, {
|
|
46150
|
+
timeout: 5000
|
|
46151
|
+
});
|
|
46152
|
+
task.logger.info("标题填写完成");
|
|
46153
|
+
});
|
|
46154
|
+
}
|
|
46155
|
+
if (params.location) {
|
|
46156
|
+
task.logger.info(`选择地点: ${params.location.city}`);
|
|
46157
|
+
const instance = page.locator(".position-display-wrap");
|
|
46158
|
+
await instance.click();
|
|
46159
|
+
await page.waitForTimeout(1000);
|
|
46160
|
+
await page.locator(".location-filter-wrap input").fill(params.location.city);
|
|
46161
|
+
await page.waitForTimeout(2000);
|
|
46162
|
+
const poperInstance = page.locator(".location-filter-wrap .common-option-list-wrap .option-item");
|
|
46163
|
+
await poperInstance.nth(1).waitFor();
|
|
46164
|
+
await poperInstance.nth(1).click();
|
|
46165
|
+
task.logger.info("地点选择完成");
|
|
46166
|
+
}
|
|
46167
|
+
if (params.collection) {
|
|
46168
|
+
task.logger.info(`选择合集: ${params.collection.collectionName}`);
|
|
46169
|
+
const instanceCollection = page.locator(".post-album-display-wrap");
|
|
46170
|
+
await instanceCollection.click();
|
|
46171
|
+
await page.waitForTimeout(1000);
|
|
46172
|
+
page.locator(".post-album-wrap .option-item").filter({
|
|
46173
|
+
hasText: params.collection.collectionName
|
|
46174
|
+
}).first().click({
|
|
46175
|
+
force: true
|
|
46176
|
+
});
|
|
46177
|
+
}
|
|
46178
|
+
if (params.link) {
|
|
46179
|
+
task.logger.info(`设置扩展阅读链接: ${params.link.title}`);
|
|
46180
|
+
await page.locator(".post-link-wrap .link-display-wrap").click();
|
|
46181
|
+
await page.waitForTimeout(300);
|
|
46182
|
+
const linkTypeText = 2 === params.link.urlType ? "红包封面" : "公众号文章";
|
|
46183
|
+
await page.locator(".link-option-item .title-wrap span").filter({
|
|
46184
|
+
hasText: linkTypeText
|
|
46185
|
+
}).click();
|
|
46186
|
+
await page.waitForTimeout(300);
|
|
46187
|
+
const placeholder = 2 === params.link.urlType ? "粘贴红包封面链接" : "粘贴公众号文章链接";
|
|
46188
|
+
await page.locator(`.link-input-wrap input[placeholder="${placeholder}"]`).fill(params.link.link);
|
|
46189
|
+
await page.waitForTimeout(500);
|
|
46190
|
+
task.logger.info(`已设置${linkTypeText}: ${params.link.link}`);
|
|
46191
|
+
}
|
|
46192
|
+
if (params.event) {
|
|
46193
|
+
task.logger.info(`选择活动: ${params.event.eventName}`);
|
|
46194
|
+
await page.locator(".post-activity-wrap .activity-display").click();
|
|
46195
|
+
await page.waitForTimeout(500);
|
|
46196
|
+
await page.locator(".activity-filter-wrap .weui-desktop-form__input[placeholder='搜索活动']").fill(params.event.eventName);
|
|
46197
|
+
await page.waitForTimeout(500);
|
|
46198
|
+
const searchLoading = page.locator(".search-loading");
|
|
46199
|
+
await searchLoading.waitFor({
|
|
46200
|
+
state: "hidden",
|
|
46201
|
+
timeout: 5000
|
|
46202
|
+
}).catch(()=>{
|
|
46203
|
+
task.logger.warn("活动搜索加载超时,继续尝试选择");
|
|
46204
|
+
});
|
|
46205
|
+
const activityItem = page.locator(".option-item .activity-item .activity-item-info .name").filter({
|
|
46206
|
+
hasText: params.event.eventName
|
|
46207
|
+
});
|
|
46208
|
+
const count = await activityItem.count();
|
|
46209
|
+
if (count > 0) {
|
|
46210
|
+
await activityItem.first().click();
|
|
46211
|
+
await page.waitForTimeout(300);
|
|
46212
|
+
task.logger.info(`已选择活动: ${params.event.eventName}`);
|
|
46213
|
+
} else {
|
|
46214
|
+
task.logger.warn(`未找到活动: ${params.event.eventName},将不参与活动`);
|
|
46215
|
+
await page.locator(".post-activity-wrap .activity-display").click();
|
|
46216
|
+
await page.waitForTimeout(300);
|
|
46217
|
+
}
|
|
46218
|
+
}
|
|
46219
|
+
if (params.scheduledTime) {
|
|
46220
|
+
task.logger.info("设置定时发布");
|
|
46221
|
+
const timingRadio = page.locator(".weui-desktop-form__check-label").filter({
|
|
46222
|
+
hasNotText: "不定时"
|
|
46223
|
+
}).first();
|
|
46224
|
+
await timingRadio.click();
|
|
46225
|
+
await page.waitForTimeout(500);
|
|
46226
|
+
const instance = page.locator(".weui-desktop-picker__date");
|
|
46227
|
+
await instance.click();
|
|
46228
|
+
const dateD = utils_TimeFormatter.format(1000 * params.scheduledTime, "d");
|
|
46229
|
+
const nowMonth = utils_TimeFormatter.format(Date.now(), "MM月");
|
|
46230
|
+
const nowMonthText = utils_TimeFormatter.format(Date.now(), "M月");
|
|
46231
|
+
const month = utils_TimeFormatter.format(1000 * params.scheduledTime, "MM月");
|
|
46232
|
+
const monthLocator = await page.locator("weui-desktop-picker__panel__label").filter({
|
|
46233
|
+
hasText: month
|
|
46234
|
+
}).first();
|
|
46235
|
+
if (!monthLocator) {
|
|
46236
|
+
await page.locator(".weui-desktop-picker__panel__label").filter({
|
|
46237
|
+
hasText: nowMonth
|
|
46238
|
+
}).first().click();
|
|
46239
|
+
await page.waitForTimeout(500);
|
|
46240
|
+
await page.locator(".weui-desktop-picker__table-row td a").filter({
|
|
46241
|
+
hasText: nowMonthText
|
|
46242
|
+
}).first().click();
|
|
46243
|
+
}
|
|
46244
|
+
await page.waitForTimeout(500);
|
|
46245
|
+
await page.locator(".weui-desktop-picker__table-row td a").filter({
|
|
46246
|
+
hasText: dateD
|
|
46247
|
+
}).first().click();
|
|
46248
|
+
await page.locator(".weui-desktop-form__input-wrp input[placeholder*='请选择时间']").fill(utils_TimeFormatter.format(1000 * params.scheduledTime, "hh:mm"));
|
|
46249
|
+
await page.locator("i.weui-desktop-icon__time").click();
|
|
46250
|
+
await page.locator(".post-time-wrap .form-item .label").filter({
|
|
46251
|
+
hasText: "发表时间"
|
|
46252
|
+
}).click();
|
|
46253
|
+
}
|
|
46254
|
+
if (params.tagInfo) {
|
|
46255
|
+
task.logger.info(`设置视频标注: tagType=${params.tagInfo.tagType}`);
|
|
46256
|
+
await page.locator(".mark-tag-select").click();
|
|
46257
|
+
await page.waitForTimeout(300);
|
|
46258
|
+
const tagTypeTextMap = {
|
|
46259
|
+
0: "无需标注",
|
|
46260
|
+
1: "含AI生成内容",
|
|
46261
|
+
2: "内容包含营销广告",
|
|
46262
|
+
3: "内容为虚构剧情,仅供娱乐",
|
|
46263
|
+
5: "内容为自行拍摄",
|
|
46264
|
+
7: "内容为转载",
|
|
46265
|
+
8: "个人观点,仅供参考"
|
|
46266
|
+
};
|
|
46267
|
+
const tagText = tagTypeTextMap[params.tagInfo.tagType];
|
|
46268
|
+
if (tagText) {
|
|
46269
|
+
await page.locator(".mark-tag-option .option-main").filter({
|
|
46270
|
+
hasText: tagText
|
|
46271
|
+
}).click();
|
|
46272
|
+
await page.waitForTimeout(300);
|
|
46273
|
+
if (5 === params.tagInfo.tagType) {
|
|
46274
|
+
const shootInfo = params.tagInfo.shootInfo;
|
|
46275
|
+
if (shootInfo) {
|
|
46276
|
+
task.logger.info("填写拍摄时间和地点...");
|
|
46277
|
+
await page.waitForTimeout(500);
|
|
46278
|
+
if (shootInfo.postTimestamp) {
|
|
46279
|
+
task.logger.info(`设置拍摄时间: ${shootInfo.postTimestamp}`);
|
|
46280
|
+
const timestamp = 1000 * parseInt(shootInfo.postTimestamp, 10);
|
|
46281
|
+
const date = new Date(timestamp);
|
|
46282
|
+
await page.locator(".original-dialog-content .weui-desktop-picker__date input[placeholder*='请选择拍摄时间']").click();
|
|
46283
|
+
await page.waitForTimeout(300);
|
|
46284
|
+
const dayNum = date.getDate();
|
|
46285
|
+
await page.locator(".weui-desktop-picker__table a").filter({
|
|
46286
|
+
hasText: new RegExp(`^\\s*${dayNum}\\s*$`)
|
|
46287
|
+
}).first().click();
|
|
46288
|
+
await page.waitForTimeout(300);
|
|
46289
|
+
}
|
|
46290
|
+
if (shootInfo.countryCode || shootInfo.provinceCode || shootInfo.cityCode) {
|
|
46291
|
+
task.logger.info("设置拍摄地点...");
|
|
46292
|
+
await page.locator(".original-dialog-content .weui-desktop-form__dropdowncascade .weui-desktop-form__dropdowncascade__dt").click();
|
|
46293
|
+
await page.waitForTimeout(300);
|
|
46294
|
+
if (1156 === shootInfo.countryCode) {
|
|
46295
|
+
await page.locator(".weui-desktop-dropdown__list-ele .weui-desktop-dropdown__list-ele__text").filter({
|
|
46296
|
+
hasText: "中国"
|
|
46297
|
+
}).click();
|
|
46298
|
+
await page.waitForTimeout(300);
|
|
46299
|
+
task.logger.warn("RPA 模式下暂不支持选择具体省份和城市,仅选择了国家");
|
|
46300
|
+
} else task.logger.warn(`不支持的国家代码: ${shootInfo.countryCode},跳过地点设置`);
|
|
46301
|
+
}
|
|
46302
|
+
const confirmBtn = await waitForElement(".weui-desktop-dialog .weui-desktop-btn_primary");
|
|
46303
|
+
if (confirmBtn) {
|
|
46304
|
+
await confirmBtn.click();
|
|
46305
|
+
await page.waitForTimeout(300);
|
|
46306
|
+
}
|
|
46307
|
+
} else task.logger.warn("tagType=5 需要提供 shootInfo 字段(拍摄时间和地点)");
|
|
46308
|
+
}
|
|
46309
|
+
if (7 === params.tagInfo.tagType) {
|
|
46310
|
+
const repostSource = params.tagInfo.repostSource;
|
|
46311
|
+
if (repostSource) {
|
|
46312
|
+
task.logger.info(`填写转载来源: ${repostSource}`);
|
|
46313
|
+
await page.waitForTimeout(500);
|
|
46314
|
+
await page.locator(".repost-dialog-content .repost-textarea").fill(repostSource);
|
|
46315
|
+
await page.waitForTimeout(300);
|
|
46316
|
+
const confirmBtn = await waitForElement(".weui-desktop-dialog .weui-desktop-btn_primary");
|
|
46317
|
+
if (confirmBtn) {
|
|
46318
|
+
await confirmBtn.click();
|
|
46319
|
+
await page.waitForTimeout(300);
|
|
46320
|
+
}
|
|
46321
|
+
} else task.logger.warn("tagType=7 需要提供 repostSource 字段(转载来源)");
|
|
46322
|
+
}
|
|
46323
|
+
} else task.logger.warn(`未知的 tagType: ${params.tagInfo.tagType},跳过标注设置`);
|
|
46324
|
+
}
|
|
46325
|
+
task.logger.info("准备发布...");
|
|
46326
|
+
await page.waitForTimeout(500);
|
|
46327
|
+
let videoId = "";
|
|
46328
|
+
const handleResponse = async (response)=>{
|
|
46329
|
+
const url = response.url();
|
|
46330
|
+
if (url.includes("/post/post_create")) {
|
|
46331
|
+
const jsonResponse = await response.json();
|
|
46332
|
+
page.off("response", handleResponse);
|
|
46333
|
+
videoId = jsonResponse.object?.id || jsonResponse.data?.objectId || "";
|
|
46334
|
+
}
|
|
46335
|
+
};
|
|
46336
|
+
page.on("response", handleResponse);
|
|
46337
|
+
task._timerRecord.PrePublish = Date.now();
|
|
46338
|
+
const MEDIA_OPR_SELECTOR = "#container-wrap > div.container-center > div > div > div.main-body-wrap.post-create > div.main-body > div > div.post-edit-wrap.material-edit-wrap > div.material > div.preview > div > div.media-opr > div > span > div > div > div";
|
|
46339
|
+
task.logger.info("等待视频上传完成(预览区媒体操作栏出现)...");
|
|
46340
|
+
const uploadTimeout = 600000;
|
|
46341
|
+
const uploadWaitStart = Date.now();
|
|
46342
|
+
let lastProgressLog = 0;
|
|
46343
|
+
while(true){
|
|
46344
|
+
const ready = await page.evaluate((selector)=>{
|
|
46345
|
+
const host = document.querySelector("#container-wrap > div.container-center > div > wujie-app");
|
|
46346
|
+
const root = host?.shadowRoot;
|
|
46347
|
+
if (!root) return false;
|
|
46348
|
+
return !!root.querySelector(selector);
|
|
46349
|
+
}, MEDIA_OPR_SELECTOR);
|
|
46350
|
+
if (ready) break;
|
|
46351
|
+
const elapsed = Date.now() - uploadWaitStart;
|
|
46352
|
+
if (elapsed > uploadTimeout) throw new Error(`视频上传超时,预览区未就绪(已等待 ${Math.round(elapsed / 1000)}s)`);
|
|
46353
|
+
if (elapsed - lastProgressLog >= 15000) {
|
|
46354
|
+
lastProgressLog = elapsed;
|
|
46355
|
+
task.logger.info(`视频仍在上传中... 已等待 ${Math.round(elapsed / 1000)}s`);
|
|
46356
|
+
}
|
|
46357
|
+
await page.waitForTimeout(1000);
|
|
46358
|
+
}
|
|
46359
|
+
task.logger.info(`视频上传完成(等待 ${Math.round((Date.now() - uploadWaitStart) / 1000)}s)`);
|
|
46360
|
+
const clicked = await page.evaluate(()=>{
|
|
46361
|
+
const host = document.querySelector("#container-wrap > div.container-center > div > wujie-app");
|
|
46362
|
+
const root = host?.shadowRoot;
|
|
46363
|
+
if (!root) return "未找到 wujie-app shadowRoot";
|
|
46364
|
+
const btns = Array.from(root.querySelectorAll(".form-btns .weui-desktop-btn"));
|
|
46365
|
+
const target = btns.find((el)=>(el.textContent || "").includes("发表"));
|
|
46366
|
+
if (!target) return "未找到发表按钮";
|
|
46367
|
+
if (target.classList.contains("weui-desktop-btn_disabled")) return "发表按钮仍处于禁用状态";
|
|
46368
|
+
target.click();
|
|
46369
|
+
return null;
|
|
46370
|
+
});
|
|
46371
|
+
if (clicked) throw new Error(clicked);
|
|
46372
|
+
task.logger.info("已点击发布按钮,等待响应...");
|
|
46373
|
+
try {
|
|
46374
|
+
await page.waitForURL((url)=>url.href !== page.url(), {
|
|
46375
|
+
timeout: 30000
|
|
46376
|
+
});
|
|
46377
|
+
task.logger.info(`发布成功,页面已跳转: ${page.url()}`);
|
|
46378
|
+
} catch {
|
|
46379
|
+
task.logger.warn("等待页面跳转超时,可能发布失败或网络慢,继续关闭页面");
|
|
46380
|
+
}
|
|
46381
|
+
await page.close();
|
|
46382
|
+
return success(videoId, "发布成功");
|
|
46383
|
+
} catch (error) {
|
|
46384
|
+
let errorMsg = error instanceof Error ? error.message : String(error);
|
|
46385
|
+
if (errorMsg.includes("context or browser has been closed")) errorMsg = "浏览器上下文已被关闭";
|
|
46386
|
+
task.logger.error(`微信视频号视频发布失败: ${errorMsg}`);
|
|
46387
|
+
return utils_response(414, `微信视频号视频发布失败: ${errorMsg}`, "");
|
|
46388
|
+
}
|
|
46389
|
+
};
|
|
46390
|
+
const ShipinhaoPublishVideoParamsSchema = ActionCommonParamsSchema.extend({
|
|
46391
|
+
videoPath: classic_schemas_string().min(1),
|
|
46392
|
+
videoMetadata: classic_schemas_object({
|
|
46393
|
+
duration: classic_schemas_number().positive(),
|
|
46394
|
+
width: classic_schemas_number().int().positive(),
|
|
46395
|
+
height: classic_schemas_number().int().positive(),
|
|
46396
|
+
fileSize: classic_schemas_number().int().positive(),
|
|
46397
|
+
path: classic_schemas_string().min(1).optional(),
|
|
46398
|
+
fileName: classic_schemas_string().min(1)
|
|
46399
|
+
}),
|
|
46400
|
+
coverPath: classic_schemas_string().min(1),
|
|
46401
|
+
verticalCoverPath: classic_schemas_string().min(1).optional(),
|
|
46402
|
+
description: classic_schemas_string(),
|
|
46403
|
+
title: classic_schemas_string().optional(),
|
|
46404
|
+
scheduledTime: classic_schemas_number().int().positive().optional(),
|
|
46405
|
+
isImmediatelyPublish: classic_schemas_boolean().optional(),
|
|
46406
|
+
topics: classic_schemas_array(classic_schemas_string()).optional(),
|
|
46407
|
+
mentionedUsers: classic_schemas_array(classic_schemas_object({
|
|
46408
|
+
nickname: classic_schemas_string()
|
|
46409
|
+
})).optional(),
|
|
46410
|
+
collection: classic_schemas_object({
|
|
46411
|
+
collectionId: classic_schemas_string(),
|
|
46412
|
+
collectionName: classic_schemas_string()
|
|
46413
|
+
}).optional(),
|
|
46414
|
+
event: classic_schemas_object({
|
|
46415
|
+
eventTopicId: classic_schemas_string(),
|
|
46416
|
+
eventName: classic_schemas_string(),
|
|
46417
|
+
eventCreatorNickname: classic_schemas_string().optional()
|
|
46418
|
+
}).optional(),
|
|
46419
|
+
link: classic_schemas_object({
|
|
46420
|
+
link: classic_schemas_string(),
|
|
46421
|
+
title: classic_schemas_string(),
|
|
46422
|
+
urlType: classic_schemas_number().int().default(1)
|
|
46423
|
+
}).optional(),
|
|
46424
|
+
tagInfo: looseObject({
|
|
46425
|
+
tagType: classic_schemas_number().int()
|
|
46426
|
+
}).optional(),
|
|
46427
|
+
originalFlag: schemas_union([
|
|
46428
|
+
literal(0),
|
|
46429
|
+
literal(1)
|
|
46430
|
+
]).optional(),
|
|
46431
|
+
postWithMemberZoneLink: schemas_union([
|
|
46432
|
+
literal(0),
|
|
46433
|
+
literal(1)
|
|
46434
|
+
]).optional(),
|
|
46435
|
+
location: classic_schemas_object({
|
|
46436
|
+
latitude: classic_schemas_number(),
|
|
46437
|
+
longitude: classic_schemas_number(),
|
|
46438
|
+
city: classic_schemas_string(),
|
|
46439
|
+
poiName: classic_schemas_string().optional(),
|
|
46440
|
+
address: classic_schemas_string().optional(),
|
|
46441
|
+
poiClassifyId: classic_schemas_string().optional()
|
|
46442
|
+
}).optional()
|
|
46443
|
+
});
|
|
46444
|
+
const shipinhaoPublishVideo = async (task, params)=>{
|
|
46445
|
+
task.logger.info(`[shipinhaoPublishVideo] actionType: ${params.actionType}`);
|
|
46446
|
+
if ("rpa" === params.actionType) return shipinhaoPublishVideo_rpa_rpaAction(task, params);
|
|
46447
|
+
if ("mockApi" === params.actionType) return shipinhaoPublishVideo_mock_mockAction(task, params);
|
|
46448
|
+
return executeAction(shipinhaoPublishVideo_mock_mockAction, shipinhaoPublishVideo_rpa_rpaAction)(task, params);
|
|
46449
|
+
};
|
|
44782
46450
|
const ShipinhaoSendMsgParamsSchema = ActionCommonParamsSchema.extend({
|
|
44783
46451
|
toUsername: classic_schemas_string().min(1, "接收者用户名不能为空"),
|
|
44784
46452
|
sessionId: classic_schemas_string().min(1, "会话ID不能为空"),
|
|
@@ -44793,7 +46461,7 @@ var __webpack_exports__ = {};
|
|
|
44793
46461
|
pathOrUrl: classic_schemas_string().min(1, "图片路径或URL不能为空")
|
|
44794
46462
|
}).optional()
|
|
44795
46463
|
});
|
|
44796
|
-
const
|
|
46464
|
+
const shipinhaoSendMsg_CHUNK_SIZE = 524288;
|
|
44797
46465
|
async function shipinhaoSendMsg_getUserInfo(cookieStr, http) {
|
|
44798
46466
|
const url = `https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data?_rid=${rid()}`;
|
|
44799
46467
|
const headers = {
|
|
@@ -44876,11 +46544,11 @@ var __webpack_exports__ = {};
|
|
|
44876
46544
|
}
|
|
44877
46545
|
const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
|
|
44878
46546
|
const timestamp = Date.now().toString();
|
|
44879
|
-
const totalChunks = Math.ceil(imageBuffer.length /
|
|
46547
|
+
const totalChunks = Math.ceil(imageBuffer.length / shipinhaoSendMsg_CHUNK_SIZE);
|
|
44880
46548
|
console.log(`分片上传md5${md5}`);
|
|
44881
46549
|
let lastRes;
|
|
44882
46550
|
for(let i = 0; i < totalChunks; i++){
|
|
44883
|
-
const chunkBuffer = imageBuffer.slice(i *
|
|
46551
|
+
const chunkBuffer = imageBuffer.slice(i * shipinhaoSendMsg_CHUNK_SIZE, (i + 1) * shipinhaoSendMsg_CHUNK_SIZE);
|
|
44884
46552
|
const requestData = {
|
|
44885
46553
|
content: `data:application/octet-stream;base64,${chunkBuffer.toString("base64")}`,
|
|
44886
46554
|
chunk: i,
|
|
@@ -45333,6 +47001,13 @@ var __webpack_exports__ = {};
|
|
|
45333
47001
|
const uploadImages = async (images)=>await Promise.all(images.map(async (url)=>{
|
|
45334
47002
|
const fileName = getFilenameFromUrl(url);
|
|
45335
47003
|
const image = await downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
47004
|
+
const stats = external_node_fs_default().statSync(image);
|
|
47005
|
+
const maxSize = 20971520;
|
|
47006
|
+
if (stats.size > maxSize) throw {
|
|
47007
|
+
code: 414,
|
|
47008
|
+
message: "头条号平台:单张图片不得超过 20MB",
|
|
47009
|
+
data: ""
|
|
47010
|
+
};
|
|
45336
47011
|
const formData = new (form_data_default())();
|
|
45337
47012
|
formData.append("image", external_node_fs_default().createReadStream(image));
|
|
45338
47013
|
const response = await http.api({
|
|
@@ -48616,6 +50291,12 @@ var __webpack_exports__ = {};
|
|
|
48616
50291
|
const fileName = getFilenameFromUrl(url);
|
|
48617
50292
|
const localUrl = await downloadImage(url, external_node_path_default().join(tmpCachePath, fileName));
|
|
48618
50293
|
const fileBuffer = external_node_fs_default().readFileSync(localUrl);
|
|
50294
|
+
const maxSize = 33554432;
|
|
50295
|
+
if (fileBuffer.byteLength > maxSize) throw {
|
|
50296
|
+
code: 414,
|
|
50297
|
+
message: "小红书平台:单张图片不得超过 32MB",
|
|
50298
|
+
data: ""
|
|
50299
|
+
};
|
|
48619
50300
|
let width = 0;
|
|
48620
50301
|
let height = 0;
|
|
48621
50302
|
try {
|
|
@@ -50800,6 +52481,9 @@ var __webpack_exports__ = {};
|
|
|
50800
52481
|
shipinhaoPublish(params) {
|
|
50801
52482
|
return this.bindTask(shipinhaoPublish, params);
|
|
50802
52483
|
}
|
|
52484
|
+
shipinhaoPublishVideo(params) {
|
|
52485
|
+
return this.bindTask(shipinhaoPublishVideo, params);
|
|
52486
|
+
}
|
|
50803
52487
|
douyinGetTopics(params) {
|
|
50804
52488
|
return this.bindTask(douyinGetTopics, params);
|
|
50805
52489
|
}
|
|
@@ -50860,4 +52544,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
50860
52544
|
});
|
|
50861
52545
|
|
|
50862
52546
|
//# sourceMappingURL=bundle.js.map
|
|
50863
|
-
//# debugId=
|
|
52547
|
+
//# debugId=ed6f9fc8-db66-5df4-be7c-d5593224a8b2
|