@iflyrpa/actions 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +46 -15
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +46 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -15
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4951,7 +4951,9 @@ function __webpack_require__(moduleId) {
|
|
|
4951
4951
|
return module;
|
|
4952
4952
|
};
|
|
4953
4953
|
})();
|
|
4954
|
-
var package_namespaceObject =
|
|
4954
|
+
var package_namespaceObject = {
|
|
4955
|
+
i8: "2.0.0"
|
|
4956
|
+
};
|
|
4955
4957
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
4956
4958
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
4957
4959
|
const http = new Http({
|
|
@@ -9064,7 +9066,7 @@ const types_errorResponse = (message, code = 500)=>({
|
|
|
9064
9066
|
message,
|
|
9065
9067
|
data: null
|
|
9066
9068
|
});
|
|
9067
|
-
const MockPublish =
|
|
9069
|
+
const MockPublish = false;
|
|
9068
9070
|
const rpa_server_scanRetryMaxCount = 60;
|
|
9069
9071
|
const rpa_server_waitQrcodeResultMaxTime = 2000 * rpa_server_scanRetryMaxCount;
|
|
9070
9072
|
const rpaServer = async (task, params)=>{
|
|
@@ -11124,8 +11126,7 @@ const DySessionCheck = async (_task, params)=>{
|
|
|
11124
11126
|
const http = new Http({
|
|
11125
11127
|
headers: {
|
|
11126
11128
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11127
|
-
referer: "https://creator.douyin.com/"
|
|
11128
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
|
11129
|
+
referer: "https://creator.douyin.com/"
|
|
11129
11130
|
}
|
|
11130
11131
|
});
|
|
11131
11132
|
const res = await http.api({
|
|
@@ -12706,7 +12707,7 @@ class DouyinImageUploader {
|
|
|
12706
12707
|
const batch = imageUrls.slice(i, i + this.CONCURRENT_LIMIT);
|
|
12707
12708
|
const batchIndex = Math.floor(i / this.CONCURRENT_LIMIT) + 1;
|
|
12708
12709
|
const totalBatches = Math.ceil(total / this.CONCURRENT_LIMIT);
|
|
12709
|
-
console.log(`\n--- 批次 ${batchIndex}/${totalBatches} (${batch
|
|
12710
|
+
console.log(`\n--- 批次 ${batchIndex}/${totalBatches} (${batch?.length} 张) ---`);
|
|
12710
12711
|
const batchPromises = batch.map((url, idx)=>{
|
|
12711
12712
|
const globalIndex = i + idx;
|
|
12712
12713
|
return this.processSingleImage(url, globalIndex, total);
|
|
@@ -12751,11 +12752,15 @@ const { generateReqSignFromTicket } = __webpack_require__("./src/utils/douyin/re
|
|
|
12751
12752
|
const { generateCsrfTokenAdvanced: mock_generateCsrfTokenAdvanced } = __webpack_require__("./src/utils/douyin/csrfToken.js");
|
|
12752
12753
|
const mock_mockAction = async (task, params)=>{
|
|
12753
12754
|
if (!params.extraParam || !params.extraParam["security-sdk/s_sdk_pri_key"] || !params.extraParam["security-sdk/s_sdk_pub_key"] || !params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"]) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "extraParam 参数缺失或不完整", "");
|
|
12755
|
+
const userAgent = params.userAgent || "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36";
|
|
12754
12756
|
const tmpCachePath = task.getTmpPath();
|
|
12755
12757
|
let bdTicketGuardClientDataV2 = params.cookies.find((e)=>"bd_ticket_guard_client_data" === e.name)?.value || "";
|
|
12756
12758
|
if (!bdTicketGuardClientDataV2) return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(400, "bdTicketGuardClientDataV2 不能为空", "");
|
|
12757
12759
|
bdTicketGuardClientDataV2 = decodeURIComponent(bdTicketGuardClientDataV2);
|
|
12758
12760
|
console.log("原始 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
|
|
12761
|
+
task.logger.warn("原始 bdTicketGuardClientDataV2", {
|
|
12762
|
+
bdTicketGuardClientDataV2
|
|
12763
|
+
});
|
|
12759
12764
|
try {
|
|
12760
12765
|
bdTicketGuardClientDataV2 = atob(bdTicketGuardClientDataV2);
|
|
12761
12766
|
console.log("解码后 bdTicketGuardClientDataV2:", bdTicketGuardClientDataV2);
|
|
@@ -12763,6 +12768,9 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12763
12768
|
console.error("bdTicketGuardClientDataV2 解码失败:", error);
|
|
12764
12769
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(500, "bdTicketGuardClientDataV2 解码失败", "");
|
|
12765
12770
|
}
|
|
12771
|
+
task.logger.warn("解码后 bdTicketGuardClientDataV2:", {
|
|
12772
|
+
bdTicketGuardClientDataV2
|
|
12773
|
+
});
|
|
12766
12774
|
let ree_public_key = "";
|
|
12767
12775
|
let ts_sign = "";
|
|
12768
12776
|
try {
|
|
@@ -12774,16 +12782,23 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12774
12782
|
const publicKey = JSON.parse(params.extraParam["security-sdk/s_sdk_pub_key"] || "{}").data;
|
|
12775
12783
|
const signData = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_sign_data_key/web_protect"] || "{}").data || "{}");
|
|
12776
12784
|
console.log("privateKey:", privateKey);
|
|
12785
|
+
task.logger.warn("privateKey", {
|
|
12786
|
+
privateKey
|
|
12787
|
+
});
|
|
12777
12788
|
console.log("publicKey:", publicKey);
|
|
12778
|
-
|
|
12789
|
+
task.logger.warn("signData", {
|
|
12790
|
+
signData
|
|
12791
|
+
});
|
|
12779
12792
|
let bdTicketGuardClientData = {
|
|
12780
12793
|
ts_sign,
|
|
12781
12794
|
req_content: "ticket,path,timestamp",
|
|
12782
12795
|
timestamp: Math.floor(Date.now() / 1000),
|
|
12783
12796
|
req_sign: generateReqSignFromTicket(signData.ticket, privateKey)
|
|
12784
12797
|
};
|
|
12785
|
-
console.log("bdTicketGuardClientData:", bdTicketGuardClientData);
|
|
12786
12798
|
bdTicketGuardClientData = btoa(JSON.stringify(bdTicketGuardClientData));
|
|
12799
|
+
task.logger.warn("bdTicketGuardClientData", {
|
|
12800
|
+
bdTicketGuardClientData
|
|
12801
|
+
});
|
|
12787
12802
|
const sessionidCookie = params.cookies.find((it)=>"msToken" === it.name)?.value;
|
|
12788
12803
|
if (!sessionidCookie) return {
|
|
12789
12804
|
code: 414,
|
|
@@ -12794,7 +12809,7 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12794
12809
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
12795
12810
|
origin: "https://creator.douyin.com",
|
|
12796
12811
|
referer: "https://creator.douyin.com/",
|
|
12797
|
-
"user-agent":
|
|
12812
|
+
"user-agent": userAgent
|
|
12798
12813
|
};
|
|
12799
12814
|
const publishParams = {
|
|
12800
12815
|
read_aid: "2906",
|
|
@@ -12805,13 +12820,16 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12805
12820
|
browser_language: "zh-CN",
|
|
12806
12821
|
browser_platform: "Win32",
|
|
12807
12822
|
browser_name: "Mozilla",
|
|
12808
|
-
browser_version:
|
|
12823
|
+
browser_version: userAgent,
|
|
12809
12824
|
browser_online: "true",
|
|
12810
12825
|
timezone_name: "Asia/Shanghai",
|
|
12811
12826
|
support_h265: "1",
|
|
12812
12827
|
msToken: params.cookies.find((e)=>"msToken" === e.name)?.value || "",
|
|
12813
12828
|
a_bogus: ""
|
|
12814
12829
|
};
|
|
12830
|
+
task.logger.warn("publishParams", {
|
|
12831
|
+
publishParams
|
|
12832
|
+
});
|
|
12815
12833
|
const publishData = {
|
|
12816
12834
|
item: {
|
|
12817
12835
|
common: {
|
|
@@ -12841,7 +12859,10 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12841
12859
|
}
|
|
12842
12860
|
}
|
|
12843
12861
|
};
|
|
12844
|
-
const aBogus = mock_sign_reply(publishParams,
|
|
12862
|
+
const aBogus = mock_sign_reply(publishParams, userAgent);
|
|
12863
|
+
task.logger.warn("aBogusaBogusaBogus", {
|
|
12864
|
+
aBogus
|
|
12865
|
+
});
|
|
12845
12866
|
publishParams.a_bogus = aBogus;
|
|
12846
12867
|
const queryString = new URLSearchParams(publishParams).toString();
|
|
12847
12868
|
const args = [
|
|
@@ -12857,6 +12878,9 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12857
12878
|
headers
|
|
12858
12879
|
});
|
|
12859
12880
|
const proxyHttp = new Http(...args);
|
|
12881
|
+
task.logger.warn("queryString", {
|
|
12882
|
+
queryString
|
|
12883
|
+
});
|
|
12860
12884
|
const uploader = new DouyinImageUploader(proxyHttp, headers, queryString, tmpCachePath);
|
|
12861
12885
|
if (params.coverImage) {
|
|
12862
12886
|
const coverUri = await uploader.uploadCover(params.coverImage);
|
|
@@ -12874,6 +12898,9 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12874
12898
|
}
|
|
12875
12899
|
proxyHttp.addResponseInterceptor((response)=>{
|
|
12876
12900
|
console.log("拦截器收到响应:", JSON.stringify(response.data));
|
|
12901
|
+
task.logger.warn("拦截器收到响应", {
|
|
12902
|
+
data: JSON.stringify(response.data)
|
|
12903
|
+
});
|
|
12877
12904
|
if (!response || !response.data) return;
|
|
12878
12905
|
const responseData = response.data;
|
|
12879
12906
|
if (response && responseData?.status_code && 0 !== responseData.status_code) return {
|
|
@@ -12887,7 +12914,7 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12887
12914
|
const publishQuery = {
|
|
12888
12915
|
...publishParams
|
|
12889
12916
|
};
|
|
12890
|
-
publishQuery.a_bogus = mock_sign_reply(publishQuery,
|
|
12917
|
+
publishQuery.a_bogus = mock_sign_reply(publishQuery, userAgent);
|
|
12891
12918
|
const publishQueryParams = new URLSearchParams(publishQuery).toString();
|
|
12892
12919
|
function generateRandomString(length) {
|
|
12893
12920
|
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
@@ -12903,9 +12930,12 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12903
12930
|
cookies: params.cookies,
|
|
12904
12931
|
url: "https://creator.douyin.com/web/api/media/aweme/create_v2/",
|
|
12905
12932
|
method: "POST",
|
|
12906
|
-
userAgent
|
|
12933
|
+
userAgent
|
|
12907
12934
|
});
|
|
12908
12935
|
console.log("发布数据", JSON.stringify(publishData));
|
|
12936
|
+
task.logger.warn("发布数据", {
|
|
12937
|
+
data: JSON.stringify(publishData)
|
|
12938
|
+
});
|
|
12909
12939
|
const publishResult = await proxyHttp.api({
|
|
12910
12940
|
method: "post",
|
|
12911
12941
|
url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
|
|
@@ -12921,15 +12951,16 @@ const mock_mockAction = async (task, params)=>{
|
|
|
12921
12951
|
"Bd-ticket-guard-version": "2",
|
|
12922
12952
|
"Bd-ticket-guard-web-sign-type": "1",
|
|
12923
12953
|
"Bd-ticket-guard-web-version": "2",
|
|
12924
|
-
"X-secsdk-csrf-token": csrfToken
|
|
12925
|
-
"X-tt-session-dtrait": params.cookies.find((e)=>"x-tt-session-dtrait" === e.name)?.value || ""
|
|
12954
|
+
"X-secsdk-csrf-token": csrfToken
|
|
12926
12955
|
}
|
|
12927
12956
|
}, {
|
|
12928
12957
|
retries: 2,
|
|
12929
12958
|
retryDelay: 500,
|
|
12930
12959
|
timeout: 12000
|
|
12931
12960
|
});
|
|
12932
|
-
console.log("publishResult", publishResult);
|
|
12961
|
+
console.log("publishResult", JSON.stringify(publishResult));
|
|
12962
|
+
task.logger.warn("发布数据");
|
|
12963
|
+
task.logger.warn(JSON.stringify(publishData));
|
|
12933
12964
|
const isSuccess = 0 === publishResult.status_code;
|
|
12934
12965
|
const message = `图文发布${isSuccess ? "成功" : `失败,原因:${publishResult.status_msg}`}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
12935
12966
|
const data = isSuccess ? publishResult.item_id || "" : "";
|