@iflyrpa/actions 4.0.0-beta.15 → 4.0.0-beta.19
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 +80 -23
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +80 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -8736,7 +8736,7 @@ var __webpack_exports__ = {};
|
|
|
8736
8736
|
var package_namespaceObject = {
|
|
8737
8737
|
i8: "0.1.2"
|
|
8738
8738
|
};
|
|
8739
|
-
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.0-beta.
|
|
8739
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.0-beta.18"}');
|
|
8740
8740
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
8741
8741
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
8742
8742
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -23368,7 +23368,8 @@ var __webpack_exports__ = {};
|
|
|
23368
23368
|
url: error.config?.url,
|
|
23369
23369
|
isProxyRequest: !!(error.config && (error.config.httpAgent || error.config.httpsAgent)),
|
|
23370
23370
|
params: error.config?.params,
|
|
23371
|
-
data: error.config?.data
|
|
23371
|
+
data: error.config?.data,
|
|
23372
|
+
serverDate: error.response?.headers?.date
|
|
23372
23373
|
}
|
|
23373
23374
|
};
|
|
23374
23375
|
if (foundError) Object.assign(errorResponse, foundError);
|
|
@@ -23446,7 +23447,7 @@ var __webpack_exports__ = {};
|
|
|
23446
23447
|
try {
|
|
23447
23448
|
this.proxyInfo = agent ? `${agent.ip}:${agent.port}` : void 0;
|
|
23448
23449
|
const controller = new AbortController();
|
|
23449
|
-
const timeoutId = setTimeout(()=>controller.abort(), reqTimeout);
|
|
23450
|
+
const timeoutId = setTimeout(()=>controller.abort(), reqTimeout + 500);
|
|
23450
23451
|
const response = await this.apiClient({
|
|
23451
23452
|
...config,
|
|
23452
23453
|
timeout: reqTimeout,
|
|
@@ -30675,6 +30676,7 @@ var __webpack_exports__ = {};
|
|
|
30675
30676
|
return acc;
|
|
30676
30677
|
}, {});
|
|
30677
30678
|
const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
|
|
30679
|
+
const baseInfoStart = Date.now();
|
|
30678
30680
|
const _baseInfo = http.api({
|
|
30679
30681
|
method: "get",
|
|
30680
30682
|
baseURL: "https://creator.xiaohongshu.com",
|
|
@@ -30683,23 +30685,43 @@ var __webpack_exports__ = {};
|
|
|
30683
30685
|
}, {
|
|
30684
30686
|
retries: 3,
|
|
30685
30687
|
retryDelay: 20,
|
|
30686
|
-
timeout:
|
|
30687
|
-
}).catch((e)=>
|
|
30688
|
+
timeout: 5000
|
|
30689
|
+
}).catch((e)=>{
|
|
30690
|
+
const clientTimestamp = Date.now();
|
|
30691
|
+
const serverDate = e?.extra?.serverDate;
|
|
30692
|
+
const serverTimestamp = serverDate ? new Date(serverDate).getTime() : null;
|
|
30693
|
+
const timeDriftMs = serverTimestamp ? clientTimestamp - serverTimestamp : null;
|
|
30694
|
+
_task.logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
|
|
30695
|
+
accountId: params.accountId,
|
|
30696
|
+
duration: Date.now() - baseInfoStart,
|
|
30697
|
+
code: e?.code,
|
|
30698
|
+
message: e?.message,
|
|
30699
|
+
data: e?.data,
|
|
30700
|
+
extra: e?.extra,
|
|
30701
|
+
proxyInfo: http.proxyInfo,
|
|
30702
|
+
clientTimestamp,
|
|
30703
|
+
serverDate,
|
|
30704
|
+
serverTimestamp,
|
|
30705
|
+
timeDriftMs,
|
|
30706
|
+
isLikelyClockDrift: null !== timeDriftMs && Math.abs(timeDriftMs) > 300000
|
|
30707
|
+
});
|
|
30708
|
+
return e.data;
|
|
30709
|
+
});
|
|
30688
30710
|
const _web_session = http.api({
|
|
30689
30711
|
method: "get",
|
|
30690
30712
|
url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
|
|
30691
30713
|
}, {
|
|
30692
30714
|
retries: 3,
|
|
30693
30715
|
retryDelay: 20,
|
|
30694
|
-
timeout:
|
|
30716
|
+
timeout: 5000
|
|
30695
30717
|
});
|
|
30696
30718
|
const [baseInfo, web_session] = await Promise.all([
|
|
30697
30719
|
_baseInfo,
|
|
30698
30720
|
_web_session
|
|
30699
30721
|
]);
|
|
30700
30722
|
if (baseInfo?.code === 0) check.isValidSession = true;
|
|
30701
|
-
if (
|
|
30702
|
-
baseInfo?.code, web_session
|
|
30723
|
+
if (web_session?.code === 0) check.isValidWebSession = true;
|
|
30724
|
+
baseInfo?.code, web_session?.code;
|
|
30703
30725
|
const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
30704
30726
|
return success(check, message);
|
|
30705
30727
|
};
|
|
@@ -43466,6 +43488,33 @@ var __webpack_exports__ = {};
|
|
|
43466
43488
|
const encode_mnsv2 = __webpack_require__("./src/utils/xhs_ob/x_s.encoder.js");
|
|
43467
43489
|
const xiaohongshuLogin_rpa_server_scanRetryMaxCount = 60;
|
|
43468
43490
|
const xiaohongshuLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * xiaohongshuLogin_rpa_server_scanRetryMaxCount;
|
|
43491
|
+
async function collectCookiesWithA1(task) {
|
|
43492
|
+
const hasA1 = (cookies)=>cookies.some((c)=>"a1" === c.name && !!c.value);
|
|
43493
|
+
let cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
43494
|
+
if (hasA1(cookies)) return cookies;
|
|
43495
|
+
task.logger?.warn("[XhsLogin] 首次抓取缺失 a1,尝试补救……");
|
|
43496
|
+
try {
|
|
43497
|
+
const page = task.steelBrowserContext?.pages?.()[0];
|
|
43498
|
+
if (page) {
|
|
43499
|
+
await page.goto("https://www.xiaohongshu.com", {
|
|
43500
|
+
waitUntil: "domcontentloaded",
|
|
43501
|
+
timeout: 15000
|
|
43502
|
+
});
|
|
43503
|
+
for(let i = 0; i < 10; i++){
|
|
43504
|
+
cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
43505
|
+
if (hasA1(cookies)) {
|
|
43506
|
+
task.logger?.info(`[XhsLogin] a1 补救成功,第 ${i + 1} 次轮询命中`);
|
|
43507
|
+
return cookies;
|
|
43508
|
+
}
|
|
43509
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
43510
|
+
}
|
|
43511
|
+
}
|
|
43512
|
+
} catch (err) {
|
|
43513
|
+
task.logger?.warn("[XhsLogin] a1 补救访问主站失败", err);
|
|
43514
|
+
}
|
|
43515
|
+
cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
43516
|
+
return cookies;
|
|
43517
|
+
}
|
|
43469
43518
|
const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
43470
43519
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
43471
43520
|
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
@@ -43666,21 +43715,29 @@ var __webpack_exports__ = {};
|
|
|
43666
43715
|
};
|
|
43667
43716
|
}
|
|
43668
43717
|
case types_ExecutionState.SUCCESS:
|
|
43669
|
-
|
|
43670
|
-
|
|
43671
|
-
|
|
43672
|
-
|
|
43673
|
-
|
|
43674
|
-
}
|
|
43675
|
-
|
|
43676
|
-
|
|
43677
|
-
|
|
43678
|
-
|
|
43679
|
-
|
|
43680
|
-
|
|
43681
|
-
|
|
43682
|
-
}
|
|
43683
|
-
|
|
43718
|
+
{
|
|
43719
|
+
const cookies = await collectCookiesWithA1(task);
|
|
43720
|
+
const hasA1 = cookies.some((c)=>"a1" === c.name && !!c.value);
|
|
43721
|
+
if (!hasA1) task.logger?.warn("[XhsLogin] 登录成功但缺失关键 cookie a1,后续检测可能失败", {
|
|
43722
|
+
cookieNames: cookies.map((c)=>c.name)
|
|
43723
|
+
});
|
|
43724
|
+
const cookieStr = JSON.stringify(cookies);
|
|
43725
|
+
await updateTaskState?.({
|
|
43726
|
+
state: types_TaskState.SUCCESS,
|
|
43727
|
+
result: {
|
|
43728
|
+
cookie: cookieStr,
|
|
43729
|
+
userInfo: userInfo
|
|
43730
|
+
}
|
|
43731
|
+
});
|
|
43732
|
+
return {
|
|
43733
|
+
code: 0,
|
|
43734
|
+
message: "成功",
|
|
43735
|
+
data: {
|
|
43736
|
+
cookie: cookieStr,
|
|
43737
|
+
userInfo
|
|
43738
|
+
}
|
|
43739
|
+
};
|
|
43740
|
+
}
|
|
43684
43741
|
default:
|
|
43685
43742
|
return {
|
|
43686
43743
|
code: 500,
|