Was this helpful?
How to Bypass GeeTest v3 Captcha
Introduction
This guide is for developers who work with websites protected by GeeTest version 3 captcha and need to automate passing it. We will break down the technical details of GeeTest V3, methods for extracting required parameters, and practical examples of integrating with 2Captcha.
Required tools:
- Python 3.8 or higher
- Libraries:
twocaptcha,requests,asyncio - API key from 2Captcha
- Working proxy (recommended for stability)
1. General Information About GeeTest V3 Captcha
1.1. Technology Overview
GeeTest V3 is a bot protection system that uses interactive tasks (most often a slider puzzle) combined with behavioral analysis. The captcha dynamically generates parameters for each session, which makes automation difficult without specialized solutions.
1.2. Key GeeTest V3 Parameters
| Parameter | Description | Status |
|---|---|---|
gt |
Public site key, static value | Required |
challenge |
Dynamic challenge string, changes for each captcha | Required |
1.3. Task Types in 2Captcha API
For solving GeeTest V3 captchas, the service supports two task types:
GeeTestTaskProxyless- uses 2Captcha internal proxies, no proxy setup required on your endGeeTestTask- requires specifying your own proxy in task parameters
2. Environment Setup
2.1. Installing Dependencies
Install required packages via pip:
bash
pip3 install twocaptcha requests
2.2. Getting Your API Key
- Register on 2captcha.com
- Go to account settings
- Copy your API key
We recommend storing the key in an environment variable for security:
bash
# Linux/macOS
export APIKEY_2CAPTCHA=your_key_here
# Windows
set APIKEY_2CAPTCHA=your_key_here
3. Page Analysis and Parameter Extraction
3.1. Detecting the Captcha
GeeTest V3 usually appears as an interactive widget with a slider. You can visually identify it by the GeeTest logo at the bottom.
3.2. Finding Parameters in Source Code
To extract gt and challenge:
- Open DevTools in your browser (F12 key)
- Go to the Elements tab
- Find the
initGeetestfunction call in the page code
Example JavaScript call:
javascript
initGeetest({
gt: "81388ea1fc187e0c335c0a8907ff2625",
challenge: "2e2f0f65240058b683cb6ea21c303eea6n",
// other parameters
});
You need to pass the gt and challenge values from this call in your API request.
3.3. Analyzing Network Requests
- In DevTools, go to the Network tab
- Refresh the page with the captcha
- Filter requests by
geetest
Key requests:
GET https://api.geetest.com/get.php- receives captcha parametersPOSTrequest with captcha solution to the target site
3.4. Server Response Structure
After solving the captcha, the service returns three parameters:
json
{
"geetest_challenge": "abc123...",
"geetest_validate": "def456...",
"geetest_seccode": "ghi789..."
}
You need to send these values to the target site for verification.
4. Python Implementation
4.1. Complete Code Example with asyncio
python
import asyncio
import os
import sys
import requests
from twocaptcha import AsyncTwoCaptcha
# API key from environment variable or directly
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
# Initialize solver with timeout settings
solver = AsyncTwoCaptcha(
api_key,
defaultTimeout=300, # General timeout 5 minutes
pollingInterval=10, # Result polling interval 10 seconds
extendedResponse=True # Return extended response
)
"""
Important: the 'challenge' parameter is dynamic. For each API request
you need to get a new value from the target site.
"""
async def solve_captcha():
# Get dynamic challenge (sync request for simplicity)
resp = requests.get("https://api.2captcha.com/api/v1/captcha-demo/gee-test/init-params")
challenge = resp.json()['challenge']
try:
# Send task for solving
return await solver.geetest(
gt='81388ea1fc187e0c335c0a8907ff2625', # Static site gt
apiServer='http://api.geetest.com', # API domain (optional)
challenge=challenge, # Dynamic challenge
url='https://example.com', # URL of page with captcha
# Proxy (uncomment if needed):
# proxy={
# 'type': 'HTTPS',
# 'uri': 'login:password@IP_address:PORT'
# }
)
except Exception as e:
print(f"Error solving captcha: {e}")
sys.exit(1)
if __name__ == '__main__':
result = asyncio.run(solve_captcha())
print('Solution received:', result)
4.2. Code Explanations
Solver configuration:
defaultTimeout=300- maximum wait time for solutionpollingInterval=10- interval between task status requestsextendedResponse=True- returns additional response metadata
Getting challenge:
- The
challengeparameter is dynamic, you need to fetch it from the target site before each request - The example uses a sync request for simplicity, in production you can implement it async
geetest() method:
- Accepts required parameters:
gt,challenge,url - Optional
apiServerparameter is needed for some sites - Using a proxy increases success probability
Error handling:
- The
try/exceptblock catches network or API errors - On error, the script prints a message and exits with code 1
5. Alternative Methods and Additional Settings
5.1. Synchronous Library Version
If you do not use asyncio, you can apply the synchronous client:
python
from twocaptcha import TwoCaptcha
solver = TwoCaptcha(api_key)
result = solver.geetest(
gt='81388ea1fc187e0c335c0a8907ff2625',
challenge='2e2f0f65240058b683cb6ea21c303eea6n',
url='https://example.com'
)
5.2. Proxy Configuration
Using a proxy improves resistance to blocks:
python
proxy_config = {
'type': 'HTTPS',
'uri': 'login:password@1.2.3.4:8080'
}
result = await solver.geetest(
gt='81388ea1fc187e0c335c0a8907ff2625',
challenge='2e2f0f65240058b683cb6ea21c303eea6n',
url='https://example.com',
proxy=proxy_config
)
Proxy usage tips:
- Use residential proxies from the relevant region
- Rotate proxies for multiple requests
- Check proxy functionality before running
5.3. Error Handling and Retries
python
import time
max_retries = 3
for attempt in range(max_retries):
try:
result = await solver.geetest(...)
break
except Exception as e:
print(f"Attempt {attempt + 1} failed: {e}")
time.sleep(5)
else:
print("All attempts exhausted")
5.4. Using the Obtained Solution
After receiving the captcha solution, you need to send it to the target site. Usually the site sends solved data in a request that you can intercept in developer tools.
You need to find the request that contains the solved captcha data and reproduce it, substituting the received parameters:
geetest_challengegeetest_validategeetest_seccode
6. Common Errors and How to Fix Them
| Error | Possible cause | Solution |
|---|---|---|
ERROR_WRONG_USER_KEY |
Invalid API key | Check the key in account settings |
ERROR_ZERO_BALANCE |
Insufficient funds | Top up balance on 2captcha.com |
ERROR_CAPTCHA_UNSOLVABLE |
Captcha not recognized | Check correctness of gt and challenge parameters |
ERROR_PROXY_CONNECT_REFUSED |
Proxy unavailable | Check proxy details and availability |
challenge expired |
Outdated dynamic parameter | Get a new challenge before each request |
invalid gt |
Wrong public key | Extract current gt from page source code |
timeout |
Wait time exceeded | Increase defaultTimeout or check service status |
6.1. Debugging Requests
To analyze issues, add output of intermediate data:
python
print(f"gt: {gt_value}")
print(f"challenge: {challenge_value}")
print(f"Response from api.2captcha.com: {result}")
7. Additional Resources
- Sandbox: enable mode - test API without writing code
- Python SDK: GeeTest V3 in 2captcha-python repo - code examples
- API documentation: general docs - endpoint specifications
- Support: create ticket - help with technical questions
Code examples in other languages:
8. Pre-Launch Checklist
- Installed
twocaptchaandrequestspackages - API key specified correctly and has positive balance
-
gtparameter extracted from target site source code -
challengeparameter obtained dynamically before sending task - Correct
websiteURLspecified - page where captcha appears - If using proxy, verified its details and availability
- Set reasonable timeouts (
defaultTimeout,pollingInterval) - Script tested in debug mode before production launch
- Implemented error handling and retry logic
Conclusion
Automating GeeTest V3 captcha passing requires understanding the dynamic nature of parameters and correct integration with the solving service. The approach presented in this guide, based on Python and the twocaptcha library, provides a reliable and scalable solution.
Key recommendations:
- Always get the current
challengeparameter before sending a task - Use proxies to improve solving success rates
- Set reasonable timeouts based on your load
- Implement a retry mechanism to handle temporary failures
Integration with 2Captcha lets you focus on your application logic while delegating captcha solving to a specialized service. By following the recommendations for environment setup, parameter extraction, and error handling, you can reliably automate interactions with protected sites.