From 9150642015589eac4b4ef4ea709bd38ef9278791 Mon Sep 17 00:00:00 2001 From: zy6p Date: Tue, 14 Apr 2026 10:23:18 +0800 Subject: [PATCH 1/2] Fix personal nodriver evaluate normalization --- src/services/browser_captcha_personal.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/services/browser_captcha_personal.py b/src/services/browser_captcha_personal.py index 80e6751..a887308 100644 --- a/src/services/browser_captcha_personal.py +++ b/src/services/browser_captcha_personal.py @@ -883,9 +883,7 @@ async def _tab_evaluate( timeout_seconds or self._command_timeout_seconds, label, ) - if return_by_value: - return self._normalize_nodriver_evaluate_result(result) - return result + return self._normalize_nodriver_evaluate_result(result) async def _tab_get(self, tab, url: str, label: str, timeout_seconds: Optional[float] = None): return await self._run_with_timeout( @@ -2304,7 +2302,7 @@ async def _extract_tab_fingerprint(self, tab) -> Optional[Dict[str, Any]]: """从 nodriver 标签页提取浏览器指纹信息。""" try: fingerprint = await self._tab_evaluate(tab, """ - () => { + (() => { const ua = navigator.userAgent || ""; const lang = navigator.language || ""; const uaData = navigator.userAgentData || null; @@ -2331,7 +2329,7 @@ async def _extract_tab_fingerprint(self, tab) -> Optional[Dict[str, Any]]: sec_ch_ua_mobile: secChUaMobile, sec_ch_ua_platform: secChUaPlatform, }; - } + })() """, label="extract_tab_fingerprint", timeout_seconds=8.0) if not isinstance(fingerprint, dict): return None From 8a8f5c4fc4ec4c04368a8d6acc1224f59f455917 Mon Sep 17 00:00:00 2001 From: zy6p Date: Tue, 14 Apr 2026 13:43:18 +0800 Subject: [PATCH 2/2] Address review on nodriver return_by_value handling --- src/services/browser_captcha_personal.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/browser_captcha_personal.py b/src/services/browser_captcha_personal.py index a887308..3ed5ebf 100644 --- a/src/services/browser_captcha_personal.py +++ b/src/services/browser_captcha_personal.py @@ -872,7 +872,7 @@ async def _tab_evaluate( timeout_seconds: Optional[float] = None, *, await_promise: bool = False, - return_by_value: bool = False, + return_by_value: bool = True, ): result = await self._run_with_timeout( tab.evaluate( @@ -883,7 +883,9 @@ async def _tab_evaluate( timeout_seconds or self._command_timeout_seconds, label, ) - return self._normalize_nodriver_evaluate_result(result) + if return_by_value: + return self._normalize_nodriver_evaluate_result(result) + return result async def _tab_get(self, tab, url: str, label: str, timeout_seconds: Optional[float] = None): return await self._run_with_timeout(