Explainers

GeeTest v4 CAPTCHA Changes and Solving Guide

GeeTest v4 brings significant changes in architecture, challenge types, and integration patterns compared to v3. This guide explains what changed, how to detect v4, and where CaptchaAI stands: GeeTest v4 support is coming soon and not yet available — CaptchaAI solves GeeTest v3 today.


GeeTest v3 vs v4 — Key Differences

Feature GeeTest v3 GeeTest v4
Initialization gt + challenge from server captcha_id only
Challenge parameter Required from API call Generated client-side
Challenge types Slide, click Slide, click, icon select, space reasoning
Validation Server returns challenge Uses lot_number + pass_token
API endpoint api.geetest.com gcaptcha4.geetest.com
Difficulty scaling Fixed Adaptive risk scoring

Extracting GeeTest v4 Parameters

# extract_geetest_v4.py
import re
from selenium import webdriver


def extract_geetest_v4_params(url):
    """Extract GeeTest v4 captcha_id from a page."""
    driver = webdriver.Chrome()
    driver.get(url)

    page_source = driver.page_source

    # GeeTest v4 uses captcha_id instead of gt
    match = re.search(r'captcha_id["\']?\s*[:=]\s*["\']([a-f0-9]+)', page_source)
    captcha_id = match.group(1) if match else None

    # Check for v4-specific script
    is_v4 = "gcaptcha4" in page_source or "gt4.js" in page_source

    driver.quit()

    return {
        "captcha_id": captcha_id,
        "is_v4": is_v4,
        "pageurl": url,
    }


# Usage
params = extract_geetest_v4_params("https://example.com/login")
print(f"Captcha ID: {params['captcha_id']}")
print(f"Is v4: {params['is_v4']}")

Solving GeeTest v4 (coming soon)

GeeTest v4 support is on the CaptchaAI roadmap and is not yet generally available — it can only be described as coming soon. Until it ships, use GeeTest v3, which CaptchaAI solves today with a high success rate. The integration below shows the planned v4 flow so you can prepare; check the CaptchaAI supported types page for the current status.

# solve_geetest_v4.py
import requests
import time
import os


def solve_geetest_v4(captcha_id, pageurl):
    """Submit GeeTest v4 to CaptchaAI and get solution."""
    api_key = os.environ["CAPTCHAAI_API_KEY"]

    # Submit task
    resp = requests.post("https://ocr.captchaai.com/in.php", data={
        "key": api_key,
        "method": "geetest",
        "gt": captcha_id,      # captcha_id maps to the gt parameter
        "pageurl": pageurl,
        "version": "4",        # Specify v4 explicitly
        "json": 1,
    }, timeout=30)

    result = resp.json()
    if result.get("status") != 1:
        raise RuntimeError(f"Submit failed: {result.get('request')}")

    task_id = result["request"]

    # Poll for result
    time.sleep(10)
    for _ in range(30):
        resp = requests.get("https://ocr.captchaai.com/res.php", params={
            "key": api_key,
            "action": "get",
            "id": task_id,
            "json": 1,
        }, timeout=15)
        data = resp.json()

        if data.get("status") == 1:
            return data["request"]  # Contains validation tokens
        if data["request"] != "CAPCHA_NOT_READY":
            raise RuntimeError(data["request"])
        time.sleep(5)

    raise TimeoutError("GeeTest v4 solve timeout")


# Usage
solution = solve_geetest_v4(
    captcha_id="abc123def456",
    pageurl="https://example.com/login",
)
print(f"Solution: {solution}")

Injecting GeeTest v4 Solution

# inject_geetest_v4.py
import json
from selenium import webdriver
from selenium.webdriver.common.by import By


def inject_geetest_v4_solution(driver, solution):
    """Inject GeeTest v4 solution tokens into the page."""
    # Parse solution — v4 returns different tokens than v3
    if isinstance(solution, str):
        try:
            solution = json.loads(solution)
        except json.JSONDecodeError:
            pass

    # GeeTest v4 validation uses lot_number, pass_token, gen_time, captcha_output
    driver.execute_script("""
        var solution = arguments[0];

        // Set hidden form fields
        var fields = {
            'lot_number': solution.lot_number,
            'pass_token': solution.pass_token,
            'gen_time': solution.gen_time,
            'captcha_output': solution.captcha_output,
        };

        for (var name in fields) {
            var input = document.querySelector('input[name="' + name + '"]');
            if (!input) {
                input = document.createElement('input');
                input.type = 'hidden';
                input.name = name;
                document.forms[0].appendChild(input);
            }
            input.value = fields[name];
        }

        // Trigger validation callback if available
        if (window.captchaObj && typeof window.captchaObj.appendTo === 'function') {
            window.captchaObj.appendTo('#captcha-container');
        }
    """, solution)

v4 Challenge Types

Slide Puzzle

The classic slide-to-match challenge. User drags a puzzle piece.

Click Selection

User clicks specific objects (e.g., "click all faces"). Uses icon recognition.

Space Reasoning

New in v4 — user arranges shapes in a spatial pattern. More complex than v3.

Icon Match

User matches icons shown in a sequence. Harder to automate manually.

Once v4 support ships, the CaptchaAI API will abstract away the challenge-specific logic. Today, CaptchaAI solves GeeTest v3; v4 support is coming soon.


Troubleshooting

Issue Cause Fix
ERROR_WRONG_CAPTCHA_ID Using v3 gt value instead of v4 captcha_id Check the page for gcaptcha4 script to confirm v4
Solution rejected Missing version=4 parameter Always specify version: "4" for v4
captcha_id not found JavaScript-rendered Use Selenium to extract from rendered page
Token format error Parsing string instead of JSON Parse solution as JSON to get individual tokens

FAQ

How do I know if a site uses GeeTest v3 or v4?

Look for gcaptcha4.geetest.com or gt4.js in the page source for v4. If you see api.geetest.com and a challenge parameter, it's v3.

Is GeeTest v4 harder to solve than v3?

CaptchaAI solves GeeTest v3 today; v4 support is coming soon. Once v4 is available, its adaptive difficulty will affect end-user friction but not API-based solving.

What's the success rate for GeeTest v4?

CaptchaAI solves GeeTest v3 with a high success rate. GeeTest v4 support is coming soon, so we do not publish a v4 success rate until it is generally available.



Solve GeeTest v3 today — start with CaptchaAI. GeeTest v4 support is coming soon.

Comments are disabled for this article.