Skip to content

fix: improve CAPTCHA auto-solver reliability - #65

Open
amorr42 wants to merge 1 commit into
opulentfox-29:masterfrom
amorr42:fix/captcha-auto-solver
Open

fix: improve CAPTCHA auto-solver reliability#65
amorr42 wants to merge 1 commit into
opulentfox-29:masterfrom
amorr42:fix/captcha-auto-solver

Conversation

@amorr42

@amorr42 amorr42 commented Mar 10, 2026

Copy link
Copy Markdown

Problem

The existing _auto_solve_captcha implementation had several issues causing login failures:

  1. Used internal _get() for captcha API calls — this routed requests through the main session without the required captcha-specific headers, causing request rejections.
  2. nLeadingZerosRequired was hardcoded to 13 instead of being read from the API response, breaking challenge solving when the server changes this value.
  3. Missing /finalize step after validation — the captcha flow was incomplete.
  4. No error handling on failed auth responses after captcha.

Fix

  • Dedicated Session with explicit headers (accept, content-type, user-agent) for all captcha API calls
  • nLeadingZerosRequired now read dynamically from init_data response
  • Added /finalize API call to properly complete the captcha flow
  • Added error check on auth response Code field

Testing

Tested against a live ProtonMail account where login was previously failing due to CAPTCHA. Login succeeds consistently after this fix.

- Use dedicated Session with proper headers (user-agent, accept, content-type)
  instead of internal _get() for captcha API calls
- Read nLeadingZerosRequired dynamically from API response instead of
  hardcoded default of 13
- Add finalize step after CAPTCHA validation
- Add error handling for failed auth responses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant