A2C工单修复

This commit is contained in:
root
2026-07-03 20:12:20 +08:00
parent c3223f026e
commit 0f3eb53afe
21 changed files with 1561 additions and 172 deletions
@@ -20,7 +20,8 @@ function classifyPuppeteerError(err) {
if (err?.name === 'TimeoutError' || msg.includes('timeout')) return 'timeout';
if (msg.includes('net::') || msg.includes('network') || msg.includes('err_connection')
|| msg.includes('err_address_unreachable') || msg.includes('err_name_not_resolved')) return 'network';
if (msg.includes('navigation') || msg.includes('frame was detached')) return 'navigation';
if (msg.includes('navigation') || msg.includes('frame was detached')
|| msg.includes('detached frame') || msg.includes('attempted to use detached')) return 'navigation';
if (msg.includes('target closed') || msg.includes('session closed')) return 'target_closed';
return 'unknown';
}
@@ -85,7 +86,9 @@ async function runUiPagination(page, options) {
{ timeout: 1000, polling: 100 }
).catch(() => new Promise((r) => setTimeout(r, 500)));
while (attempts < maxAttempts && !pageData) {
let paginationComplete = false;
while (attempts < maxAttempts && !pageData && !paginationComplete) {
attempts++;
log(`[抓取] 准备抓取第 ${targetPageNum} 页 (尝试 ${attempts}/${maxAttempts})...`);
@@ -139,6 +142,7 @@ async function runUiPagination(page, options) {
if (clickStatus === 'disabled') {
log(`[提示] 第 ${targetPageNum} 页按钮已被禁用,说明到底了,抓取提前结束。`);
paginationComplete = true;
break;
}
log('[动作] 双引擎原生点击已执行!');
@@ -153,6 +157,11 @@ async function runUiPagination(page, options) {
}
}
if (paginationComplete) {
log('[完成] 翻页已到底,正常结束。');
break;
}
if (pageData) {
capturedData.push(pageData);
log(`[成功] 斩获第 ${targetPageNum} 页数据!`);