ARCHITECTURE & MODES
Understand how DoesCap switches seamlessly between zero-overhead Direct In-Browser solving, optional Headless CDP Screencast mirroring, and Android Termux intent handlers.
1. DIRECT IN-BROWSER MODE (DEFAULT)
Active whenever browser_path is None (default) or when running on Android/Termux:
- Zero background RAM / CPU: No hidden headless Chromium process running in Python.
- Hardware-Accelerated Touch: Renders
js.hcaptcha.com/1/api.jsdirectly in the user's browser at 60Hz–144Hz. - Enterprise
rqdata&captcha_hostSupport: Passesrqdataand originhostacross theapi.js?host=loader,hcaptcha.render(...)options, andhcaptcha.setData(...)for origin-locked challenges such as Discord flows. - Live Post-Solve UI Updates: Calling
mark_claimed()ormark_completed()updates the open success screen (task name, promo code, message) dynamically aftersolve()returns. - Instant Callback: Once solved, the browser fires
POST /solveandsolve()returns within milliseconds.
2. HEADLESS CDP SCREENCAST MODE
Activates when browser_path is supplied, websocket-client is installed, and find_browser() locates a desktop Chromium binary (Chrome, Brave, Chromium, Edge, Opera, or Vivaldi):
- Spawns headless Chromium (
--headless=new,--remote-debugging-port) with a temporary profile directory. - Captures JPEG screenshots (quality
82) of the puzzle iframe bounding box every0.20sand serves them viaGET /frame.jpg. - Forwards mouse/touch
move,press, andreleaseevents fromPOST /inputinto CDPInput.dispatchMouseEvent. - Polls page runtime every
0.4sfor the response token and automatically falls back to Direct Mode if the headless browser fails or CDP times out.
3. ANDROID & TERMUX SETUP
DoesCap detects Termux/Android automatically via ANDROID_ROOT, TERMUX_VERSION, or PREFIX containing com.termux:
# 1. Update Termux and install Python
pkg update && pkg install python
# 2. Install doescap
pip install doescap
# 3. Run solver
python -c 'from doescap import solve_captcha; print(solve_captcha("4c672d35-0701-42b2-88c3-78380b0db560"))'
When auto_open_browser=True, open_browser() cascades through termux-open-url, termux-open,
Android Activity Manager Chrome/VIEW intents (am start and /system/bin/am), xdg-open, and Python's webbrowser.