@iflyrpa/actions 4.0.0-beta.15 → 4.0.0-beta.17
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/index.mjs
CHANGED
|
@@ -5434,7 +5434,7 @@ function __webpack_require__(moduleId) {
|
|
|
5434
5434
|
return module;
|
|
5435
5435
|
};
|
|
5436
5436
|
})();
|
|
5437
|
-
var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.
|
|
5437
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.16"}');
|
|
5438
5438
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5439
5439
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5440
5440
|
const http = new Http({
|
|
@@ -5520,7 +5520,8 @@ class Http {
|
|
|
5520
5520
|
url: error.config?.url,
|
|
5521
5521
|
isProxyRequest: !!(error.config && (error.config.httpAgent || error.config.httpsAgent)),
|
|
5522
5522
|
params: error.config?.params,
|
|
5523
|
-
data: error.config?.data
|
|
5523
|
+
data: error.config?.data,
|
|
5524
|
+
serverDate: error.response?.headers?.date
|
|
5524
5525
|
}
|
|
5525
5526
|
};
|
|
5526
5527
|
if (foundError) Object.assign(errorResponse, foundError);
|
|
@@ -5598,7 +5599,7 @@ class Http {
|
|
|
5598
5599
|
try {
|
|
5599
5600
|
this.proxyInfo = agent ? `${agent.ip}:${agent.port}` : void 0;
|
|
5600
5601
|
const controller = new AbortController();
|
|
5601
|
-
const timeoutId = setTimeout(()=>controller.abort(), reqTimeout);
|
|
5602
|
+
const timeoutId = setTimeout(()=>controller.abort(), reqTimeout + 500);
|
|
5602
5603
|
const response = await this.apiClient({
|
|
5603
5604
|
...config,
|
|
5604
5605
|
timeout: reqTimeout,
|
|
@@ -11857,6 +11858,7 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11857
11858
|
return acc;
|
|
11858
11859
|
}, {});
|
|
11859
11860
|
const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
|
|
11861
|
+
const baseInfoStart = Date.now();
|
|
11860
11862
|
const _baseInfo = http.api({
|
|
11861
11863
|
method: "get",
|
|
11862
11864
|
baseURL: "https://creator.xiaohongshu.com",
|
|
@@ -11865,23 +11867,43 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11865
11867
|
}, {
|
|
11866
11868
|
retries: 3,
|
|
11867
11869
|
retryDelay: 20,
|
|
11868
|
-
timeout:
|
|
11869
|
-
}).catch((e)=>
|
|
11870
|
+
timeout: 5000
|
|
11871
|
+
}).catch((e)=>{
|
|
11872
|
+
const clientTimestamp = Date.now();
|
|
11873
|
+
const serverDate = e?.extra?.serverDate;
|
|
11874
|
+
const serverTimestamp = serverDate ? new Date(serverDate).getTime() : null;
|
|
11875
|
+
const timeDriftMs = serverTimestamp ? clientTimestamp - serverTimestamp : null;
|
|
11876
|
+
_task.logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
|
|
11877
|
+
accountId: params.accountId,
|
|
11878
|
+
duration: Date.now() - baseInfoStart,
|
|
11879
|
+
code: e?.code,
|
|
11880
|
+
message: e?.message,
|
|
11881
|
+
data: e?.data,
|
|
11882
|
+
extra: e?.extra,
|
|
11883
|
+
proxyInfo: http.proxyInfo,
|
|
11884
|
+
clientTimestamp,
|
|
11885
|
+
serverDate,
|
|
11886
|
+
serverTimestamp,
|
|
11887
|
+
timeDriftMs,
|
|
11888
|
+
isLikelyClockDrift: null !== timeDriftMs && Math.abs(timeDriftMs) > 300000
|
|
11889
|
+
});
|
|
11890
|
+
return e.data;
|
|
11891
|
+
});
|
|
11870
11892
|
const _web_session = http.api({
|
|
11871
11893
|
method: "get",
|
|
11872
11894
|
url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
|
|
11873
11895
|
}, {
|
|
11874
11896
|
retries: 3,
|
|
11875
11897
|
retryDelay: 20,
|
|
11876
|
-
timeout:
|
|
11898
|
+
timeout: 5000
|
|
11877
11899
|
});
|
|
11878
11900
|
const [baseInfo, web_session] = await Promise.all([
|
|
11879
11901
|
_baseInfo,
|
|
11880
11902
|
_web_session
|
|
11881
11903
|
]);
|
|
11882
11904
|
if (baseInfo?.code === 0) check.isValidSession = true;
|
|
11883
|
-
if (
|
|
11884
|
-
baseInfo?.code, web_session
|
|
11905
|
+
if (web_session?.code === 0) check.isValidWebSession = true;
|
|
11906
|
+
baseInfo?.code, web_session?.code;
|
|
11885
11907
|
const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11886
11908
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(check, message);
|
|
11887
11909
|
};
|
|
@@ -23153,6 +23175,33 @@ const xiaohongshuLogin_rpa_rpaAction = async (task, _params)=>{
|
|
|
23153
23175
|
const encode_mnsv2 = __webpack_require__("./src/utils/xhs_ob/x_s.encoder.js");
|
|
23154
23176
|
const xiaohongshuLogin_rpa_server_scanRetryMaxCount = 60;
|
|
23155
23177
|
const xiaohongshuLogin_rpa_server_waitQrcodeResultMaxTime = 2000 * xiaohongshuLogin_rpa_server_scanRetryMaxCount;
|
|
23178
|
+
async function collectCookiesWithA1(task) {
|
|
23179
|
+
const hasA1 = (cookies)=>cookies.some((c)=>"a1" === c.name && !!c.value);
|
|
23180
|
+
let cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
23181
|
+
if (hasA1(cookies)) return cookies;
|
|
23182
|
+
task.logger?.warn("[XhsLogin] 首次抓取缺失 a1,尝试补救……");
|
|
23183
|
+
try {
|
|
23184
|
+
const page = task.steelBrowserContext?.pages?.()[0];
|
|
23185
|
+
if (page) {
|
|
23186
|
+
await page.goto("https://www.xiaohongshu.com", {
|
|
23187
|
+
waitUntil: "domcontentloaded",
|
|
23188
|
+
timeout: 15000
|
|
23189
|
+
});
|
|
23190
|
+
for(let i = 0; i < 10; i++){
|
|
23191
|
+
cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
23192
|
+
if (hasA1(cookies)) {
|
|
23193
|
+
task.logger?.info(`[XhsLogin] a1 补救成功,第 ${i + 1} 次轮询命中`);
|
|
23194
|
+
return cookies;
|
|
23195
|
+
}
|
|
23196
|
+
await new Promise((resolve)=>setTimeout(resolve, 500));
|
|
23197
|
+
}
|
|
23198
|
+
}
|
|
23199
|
+
} catch (err) {
|
|
23200
|
+
task.logger?.warn("[XhsLogin] a1 补救访问主站失败", err);
|
|
23201
|
+
}
|
|
23202
|
+
cookies = await task.steelBrowserContext?.cookies() ?? [];
|
|
23203
|
+
return cookies;
|
|
23204
|
+
}
|
|
23156
23205
|
const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
23157
23206
|
const updateTaskState = task.taskStageStore?.update?.bind(task.taskStageStore, task.taskId || "");
|
|
23158
23207
|
const reporter = task.reportService?.reportLoginStatus ?? (()=>Promise.resolve());
|
|
@@ -23353,21 +23402,29 @@ const xiaohongshuLogin_rpa_server_rpaServer = async (task, params)=>{
|
|
|
23353
23402
|
};
|
|
23354
23403
|
}
|
|
23355
23404
|
case types_ExecutionState.SUCCESS:
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
}
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
}
|
|
23370
|
-
|
|
23405
|
+
{
|
|
23406
|
+
const cookies = await collectCookiesWithA1(task);
|
|
23407
|
+
const hasA1 = cookies.some((c)=>"a1" === c.name && !!c.value);
|
|
23408
|
+
if (!hasA1) task.logger?.warn("[XhsLogin] 登录成功但缺失关键 cookie a1,后续检测可能失败", {
|
|
23409
|
+
cookieNames: cookies.map((c)=>c.name)
|
|
23410
|
+
});
|
|
23411
|
+
const cookieStr = JSON.stringify(cookies);
|
|
23412
|
+
await updateTaskState?.({
|
|
23413
|
+
state: __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.TaskState.SUCCESS,
|
|
23414
|
+
result: {
|
|
23415
|
+
cookie: cookieStr,
|
|
23416
|
+
userInfo: userInfo
|
|
23417
|
+
}
|
|
23418
|
+
});
|
|
23419
|
+
return {
|
|
23420
|
+
code: 0,
|
|
23421
|
+
message: "成功",
|
|
23422
|
+
data: {
|
|
23423
|
+
cookie: cookieStr,
|
|
23424
|
+
userInfo
|
|
23425
|
+
}
|
|
23426
|
+
};
|
|
23427
|
+
}
|
|
23371
23428
|
default:
|
|
23372
23429
|
return {
|
|
23373
23430
|
code: 500,
|