fix: 提高 reCAPTCHA 验证码正确率#1
Merged
Merged
Conversation
- 修复 API 打码轮询中 time.sleep(3) 阻塞事件循环的问题,改为 await asyncio.sleep(3) - 丰富 Playwright 模式的虚假页面 HTML,模拟 Google Flow Labs 真实页面结构和样式 - 添加人类行为模拟(鼠标移动、滚动、点击),提升 reCAPTCHA v3 行为评分 - 重构 TokenBrowser 为持久化浏览器模式,复用浏览器进程和上下文以保持 cookie 连续性 - 修复 Personal 模式 fallback 注入脚本 URL 从 api.js 改为 enterprise.js https://claude.ai/code/session_01KJ6XfnyxCTzri55HRna5oZ
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
**修复内容**: 1. **【Critical】修复双重锁定问题** - 移除 TokenBrowser._semaphore,避免与 BrowserCaptchaService._token_semaphore 形成嵌套锁 - 并发控制统一由服务层管理 2. **【Critical】修复所有裸 except 块** - 将所有裸 except 改为具体异常类型 + 日志记录 - 涉及文件:browser_captcha.py (7处), browser_captcha_personal.py (7处) - 避免静默失败,便于调试生产环境问题 3. **【High】修复单例模式竞态条件** - 移除锁外的第一次检查,直接获取锁 - 在锁内完成所有初始化(包括异步操作) 4. **【High】更新过时的文档字符串** - 修正 _close_browser_only 的文档(实际会关闭 context) - 更新 report_error 的文档(反映持久化架构) - 为 remove_browser 和 close 添加文档字符串 - 为 TokenBrowser 类添加详细的持久化架构说明 - 为 get_token 方法添加完整的参数说明和重试机制说明 **改进**: - 所有异常现在都有明确的类型和日志记录 - 文档字符串准确反映代码实现 - 消除了潜在的死锁和竞态条件风险 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://claude.ai/code/session_01KJ6XfnyxCTzri55HRna5oZ