[Python] 2captcha API not solving grid(reCaptcha v2) captcha properly [closed]

Discussão em 'Python' iniciado por Stack, Abril 4, 2025.

  1. Stack

    Stack Membro Participativo

    Below is the static code snipped i'm using for reCAPTCHA solve, the question is that I'm not getting even 80% accuracy with the grid captch

    def solve_grid_captcha(api_key, image_path, instructions):
    """
    Solve a grid-based reCAPTCHA using 2Captcha service

    Args:
    api_key (str): 2Captcha API key
    image_path (str): Path to the CAPTCHA image file
    instructions (str): Text instructions from the CAPTCHA

    Returns:
    dict: Result containing the solution, or None if failed
    """
    # try:
    solver = TwoCaptcha(api_key, pollingInterval=10)
    grid = 4

    # Prepare parameters with the exact instructions from the CAPTCHA
    params = {
    'hintText': instructions,
    'rows': grid,
    'cols': grid,
    'canSkip': 1,
    'lang': 'en' # Specify language to improve accuracy
    }

    print(f"Sending image: {image_path}")
    print(f"With instructions: {instructions}")

    result = solver.grid(file=image_path, **params)
    print(f"2Captcha response: {result}")
    return result



    # Example usage
    api_key = "KEY_HERE" # my API key
    image_path = "captcha_1.jpg"
    instructions = "Select all squares with motorcycles with bicycles"
    print(solve_grid_captcha(api_key, image_path, instructions))




    Response received for 2Captcha: {'captchaId': 'captch id', 'code': 'click:5/6/9/10/13/14'}

    And then I'm doing automation to click on this grid with selenium and then clicking on verify but not getting acurracy, Captch image for this response

    [​IMG]

    Am I missing any settings here? What else can I consider for accuracy?

    Continue reading...

Compartilhe esta Página