@iflyrpa/actions 3.0.0-beta.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +595 -18
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +42 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -14
- package/dist/index.mjs.map +1 -1
- package/dist/utils/douyin/imageUploader.d.ts +1 -0
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_axios__ from "axios";
|
|
|
22
22
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fetch_7c57b483__ from "node-fetch";
|
|
23
23
|
import * as __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__ from "form-data";
|
|
24
24
|
import * as __WEBPACK_EXTERNAL_MODULE_node_https_626f33a7__ from "node:https";
|
|
25
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fzstd__ from "fzstd";
|
|
25
26
|
import * as __WEBPACK_EXTERNAL_MODULE_node_http_2dc67212__ from "node:http";
|
|
26
27
|
import * as __WEBPACK_EXTERNAL_MODULE_image_size_bc738ffb__ from "image-size";
|
|
27
28
|
import * as __WEBPACK_EXTERNAL_MODULE_vm__ from "vm";
|
|
@@ -5433,7 +5434,7 @@ function __webpack_require__(moduleId) {
|
|
|
5433
5434
|
return module;
|
|
5434
5435
|
};
|
|
5435
5436
|
})();
|
|
5436
|
-
var package_namespaceObject = JSON.parse('{"i8":"3.0.0-beta.
|
|
5437
|
+
var package_namespaceObject = JSON.parse('{"i8":"3.0.0-beta.3"}');
|
|
5437
5438
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5438
5439
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5439
5440
|
const http = new Http({
|
|
@@ -5451,7 +5452,11 @@ async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
|
5451
5452
|
url: "http://172.29.194.32:9998/pool/eip/proxy",
|
|
5452
5453
|
data: params
|
|
5453
5454
|
}).catch((err)=>{
|
|
5454
|
-
throw
|
|
5455
|
+
throw {
|
|
5456
|
+
code: 414,
|
|
5457
|
+
message: `请求代理失败:${err.message}`,
|
|
5458
|
+
data: {}
|
|
5459
|
+
};
|
|
5455
5460
|
});
|
|
5456
5461
|
const loggerInfo = {
|
|
5457
5462
|
params,
|
|
@@ -12797,8 +12802,11 @@ const douyinGetMusic = async (_task, params)=>{
|
|
|
12797
12802
|
browser_version: userAgent,
|
|
12798
12803
|
browser_online: "true",
|
|
12799
12804
|
timezone_name: "Asia/Shanghai",
|
|
12800
|
-
support_h265: "1"
|
|
12805
|
+
support_h265: "1",
|
|
12806
|
+
a_bogus: ""
|
|
12801
12807
|
};
|
|
12808
|
+
const authQueryBefore = new URLSearchParams(authorizationParams).toString();
|
|
12809
|
+
authorizationParams.a_bogus = douyinGetMusic_getABogus(`https://creator.douyin.com/web/api/media/aweme/search/post/auth/?${authQueryBefore}`, {}, userAgent);
|
|
12802
12810
|
const authorizationQueryString = new URLSearchParams(authorizationParams).toString();
|
|
12803
12811
|
const authorization = await http.api({
|
|
12804
12812
|
method: "get",
|
|
@@ -12817,20 +12825,36 @@ const douyinGetMusic = async (_task, params)=>{
|
|
|
12817
12825
|
total: 0
|
|
12818
12826
|
});
|
|
12819
12827
|
console.log("抖音获取音乐权限:", authorization);
|
|
12820
|
-
const
|
|
12828
|
+
const musicRes = await http.api({
|
|
12821
12829
|
method: "get",
|
|
12822
12830
|
url: `https://tsearch.amemv.com/openapi/aweme/v1/music/search/?${queryString}`,
|
|
12823
12831
|
headers: {
|
|
12824
|
-
|
|
12832
|
+
Accept: "application/json, text/plain, */*",
|
|
12833
|
+
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
12834
|
+
"cache-control": "no-cache",
|
|
12835
|
+
pragma: "no-cache",
|
|
12836
|
+
priority: "u=1, i",
|
|
12837
|
+
origin: "https://creator.douyin.com",
|
|
12838
|
+
referer: "https://creator.douyin.com/",
|
|
12839
|
+
"sec-ch-ua": params.extraParam?.browserInfo?.["sec-ch-ua"] || "",
|
|
12840
|
+
"sec-ch-ua-mobile": "?0",
|
|
12841
|
+
"sec-ch-ua-platform": params.extraParam?.browserInfo?.["sec-ch-ua-platform"] || "",
|
|
12842
|
+
"sec-fetch-dest": "empty",
|
|
12843
|
+
"sec-fetch-mode": "cors",
|
|
12844
|
+
"sec-fetch-site": "cross-site",
|
|
12845
|
+
"user-agent": userAgent,
|
|
12825
12846
|
"agw-auth": authorization?.signature || "",
|
|
12826
|
-
"
|
|
12827
|
-
}
|
|
12847
|
+
"openapi-omit-shark": "1"
|
|
12848
|
+
},
|
|
12849
|
+
responseType: "arraybuffer"
|
|
12828
12850
|
}, {
|
|
12829
12851
|
retries: 3,
|
|
12830
12852
|
retryDelay: 20,
|
|
12831
12853
|
timeout: 3000
|
|
12832
12854
|
});
|
|
12833
|
-
|
|
12855
|
+
const decompressed = (0, __WEBPACK_EXTERNAL_MODULE_fzstd__.decompress)(new Uint8Array(musicRes));
|
|
12856
|
+
const res = JSON.parse(Buffer.from(decompressed).toString("utf-8"));
|
|
12857
|
+
console.log("抖音获取音乐响应:", JSON.stringify(res));
|
|
12834
12858
|
const isSuccess = 0 === res.status_code;
|
|
12835
12859
|
const message = `抖音获取音乐${isSuccess ? "成功" : `失败,原因:${res.status_msg}`}${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
12836
12860
|
const data = isSuccess ? {
|
|
@@ -13899,9 +13923,10 @@ class DouyinImageUploader {
|
|
|
13899
13923
|
this.authCache = null;
|
|
13900
13924
|
this.authExpireTime = 0;
|
|
13901
13925
|
this.AUTH_REFRESH_BUFFER = 300000;
|
|
13902
|
-
this.CONCURRENT_LIMIT =
|
|
13926
|
+
this.CONCURRENT_LIMIT = 5;
|
|
13903
13927
|
this.UPLOAD_DELAY = 1000;
|
|
13904
|
-
this.UPLOAD_TIMEOUT =
|
|
13928
|
+
this.UPLOAD_TIMEOUT = 300000;
|
|
13929
|
+
this.TOS_UPLOAD_TIMEOUT = 600000;
|
|
13905
13930
|
this.proxyHttp = proxyHttp;
|
|
13906
13931
|
this.headers = headers;
|
|
13907
13932
|
this.queryParams = queryParams;
|
|
@@ -13911,7 +13936,7 @@ class DouyinImageUploader {
|
|
|
13911
13936
|
keepAlive: true,
|
|
13912
13937
|
maxSockets: this.CONCURRENT_LIMIT,
|
|
13913
13938
|
maxFreeSockets: 2,
|
|
13914
|
-
timeout: this.
|
|
13939
|
+
timeout: this.TOS_UPLOAD_TIMEOUT
|
|
13915
13940
|
};
|
|
13916
13941
|
agentOptions.freeSocketTimeout = 30000;
|
|
13917
13942
|
this.uploadAgent = new Agent(agentOptions);
|
|
@@ -13935,7 +13960,7 @@ class DouyinImageUploader {
|
|
|
13935
13960
|
"Content-Type": "application/json"
|
|
13936
13961
|
}
|
|
13937
13962
|
}, {
|
|
13938
|
-
timeout:
|
|
13963
|
+
timeout: 300000
|
|
13939
13964
|
});
|
|
13940
13965
|
if (!uploadAuth.auth) throw new Error(uploadAuth.status_msg || "获取上传权限失败");
|
|
13941
13966
|
try {
|
|
@@ -13986,6 +14011,8 @@ class DouyinImageUploader {
|
|
|
13986
14011
|
"X-amz-date": amzDate,
|
|
13987
14012
|
"X-amz-security-token": authData.SessionToken
|
|
13988
14013
|
}
|
|
14014
|
+
}, {
|
|
14015
|
+
timeout: this.UPLOAD_TIMEOUT
|
|
13989
14016
|
});
|
|
13990
14017
|
if (!response) throw new Error("获取上传地址失败: 响应为空");
|
|
13991
14018
|
if (response.ResponseMetadata?.Error) throw new Error(`ImageX错误: ${response.ResponseMetadata.Error.Code} - ${response.ResponseMetadata.Error.Message}`);
|
|
@@ -14030,7 +14057,7 @@ class DouyinImageUploader {
|
|
|
14030
14057
|
data: fileBuffer,
|
|
14031
14058
|
httpAgent: this.uploadAgent,
|
|
14032
14059
|
httpsAgent: this.uploadAgent,
|
|
14033
|
-
timeout: this.
|
|
14060
|
+
timeout: this.TOS_UPLOAD_TIMEOUT,
|
|
14034
14061
|
maxBodyLength: 1 / 0,
|
|
14035
14062
|
maxContentLength: 1 / 0
|
|
14036
14063
|
});
|
|
@@ -14337,7 +14364,8 @@ const mock_mockAction = async (task, params)=>{
|
|
|
14337
14364
|
};
|
|
14338
14365
|
}
|
|
14339
14366
|
if (params.banners && params.banners.length > 0) {
|
|
14340
|
-
const
|
|
14367
|
+
const banners = params.banners.filter((i)=>i !== params.coverImage);
|
|
14368
|
+
const uploadResults = await uploader.uploadImages(banners);
|
|
14341
14369
|
publishData.item.common.images = publishData.item.common.images.concat(uploadResults.map((result)=>({
|
|
14342
14370
|
uri: result.uri,
|
|
14343
14371
|
width: result.width,
|