Skip to content

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 chromium

Latest Version

Module VersionDownloadChanges
0.10.1Initial 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


reCaptcha2FunCaptchaTikTokGeeTesthCaptchaOther
YesYesYesYesYesYes

Parameters


ParameterTypeDefaultDescription
pagePagePage containing the captcha
api_keystrCap.Guru API key
attemptsint5Max number of attempts
debugboolFalseEnable debug logging
selectorstr''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')