Python Module
Uses Playwright to automatically solve captchas.
Supports image clicking, slider dragging, and other captcha types.
Installation
bash
pip install playwright httpx
playwright install chromiumLatest Version
| Module Version | Download | Changes |
|---|---|---|
| 0.1 | 0.1 | Initial release |
Copy the captcha_solver folder into your project.
Usage
Import CaptchaSolver from the package.
Pass the page containing the captcha and your API key.
Call the appropriate captcha solving method.
Allow a few seconds for the captcha interaction to complete.
python
import asyncio
from playwright.async_api import async_playwright
from captcha_solver import CaptchaSolver
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
await page.goto('https://example.com/with-captcha')
solver = CaptchaSolver(
page=page,
api_key='YOUR_CAPGURU_API_KEY',
debug=True,
attempts=5,
)
await solver.solve_recaptcha2()
await browser.close()
asyncio.run(main())Call the appropriate method:
await solver.solve_recaptcha2()
await solver.solve_hcaptcha()
await solver.solve_other()
await solver.solve_geetest()
await solver.solve_funcaptcha()
await solver.solve_tiktok()Supported Captchas
| reCaptcha2 | FunCaptcha | TikTok | GeeTest | hCaptcha | Other |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | Page | — | Page containing the captcha |
api_key | str | — | Cap.Guru API key |
attempts | int | 5 | Max number of attempts |
debug | bool | False | Enable debug logging |
selector | str | '' | CSS selector of the captcha container |
Error Handling
All solvers raise RuntimeError on failure:
python
try:
await solver.solve_recaptcha2()
except RuntimeError as e:
if 'ERROR_CAPTCHA_UNSOLVABLE' in str(e):
print('Captcha was not solved after all attempts')