perf: 浏览器反检测模块全面优化 - 动态平台适配与指纹一致性强化
核心改进: 1. stealth.py 架构升级: - UA 自动检测平台(macOS/Windows/Linux)替代硬编码 - 新增 Client Hints (userAgentMetadata) 覆盖,防止 navigator.userAgentData 泄露 - navigator.webdriver 改用 Proxy 包装原生 getter,通过 toString() 检测仍返回 [native code] - 移除 plugins 覆盖(真实 Chrome 已有正确 PluginArray) - 新增 chrome.app 对象和 navigator.vendor="Google Inc." - WebGL 同时覆盖 WebGL1 和 WebGL2,vendor/renderer 与平台一致 - 移除 outerWidth/outerHeight 覆盖(headed 模式下设为相等反而暴露自动化) - build_ua_override() 函数支持动态 Chrome 版本注入 2. cdp.py 集成: - connect() 从 /json/version 提取真实 Chrome 版本号 - _setup_page() 使用动态版本构建 UA 和 Client Hints 技术要点: - 所有信号(UA/platform/Client Hints/WebGL)跨模块一致性保证 - 兼容 macOS (M1/Intel)、Windows、Linux 三平台 - 动态版本匹配确保与实际 Chrome 实例同步 Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: zy <xpzouying@gmail.com>
Showing
2 changed files
with
255 additions
and
65 deletions
-
Please register or login to post a comment