GeeTestTask: solving Geetest
Create the task with the createTask method and get the result with the getTaskResult method.
The task type types
that we support:
GeeTestTaskProxyLess
SUPPORT IMG TYPES
Type | Note | State |
---|---|---|
slide | stable | |
icon click | stable | |
icon crush | stable | |
nine | stable | |
gobang | stable |
Create Task
Create a task with the createTask to create a task.
Task Object Structure
Properties | Type | Required | Description |
---|---|---|---|
type | String | Required | GeeTestTaskProxyLess |
websiteURL | String | Required | Web address of the website using geetest (Ex: https://geetest.com) |
gt | String | Required | Only Geetest V3 is required |
challenge | String | Required | Only Geetest V3 is required |
captchaId | String | Optional | only Geetest V4 is required |
geetestApiServerSubdomain | String | Optional | Special api subdomain, example: api.geetest.com |
Example Request
Example request using Geetest V3
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type":"GeetestTaskProxyless",
"websiteURL":"https://mywebsite.com/geetest/test.php",
"gt":"",
"challenge":"",
"geetestApiServerSubdomain":"api.geetest.com" // Optional
}
}
Example Request Using Geetest V4
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type":"GeetestTaskProxyless",
"websiteURL":"https://mywebsite.com/geetest/test.php",
"captchaId": "..."
}
}
Example Response
{
"errorId": 0,
"status": "idle",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
Getting Result
Use the getTaskResult to get the result, depending on the system load, you will get
the result in the interval of 3s
to 10s
Example Request
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey":"YOU_API_KEY",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}
Example Response
Example response using GeetestV3
{
"errorId": 0,
"solution": {
"challenge": "",
"validate": ""
},
"status": "ready"
}
Example Response Using GeetestV4
{
"errorId": 0,
"taskId": "e0ecaaa8-06f6-41fd-a02e-a0c79b957b15",
"status": "ready",
"solution": {
"captcha_id": "",
"captcha_output": "",
"gen_time": "",
"lot_number": "",
"pass_token": "",
"risk_type": "slide"
}
}
Use SDK Request
# pip install --upgrade capsolver
# export CAPSOLVER_API_KEY='...'
import capsolver
capsolver.api_key = "..."
# v3
solution = capsolver.solve({
"type": "GeeTestTaskProxyLess",
"websiteURL": "http://mywebsite.com/geetest/test.php",
"gt": "...",
"challenge": "..."
})
# v4
solution = capsolver.solve({
"type": "GeeTestTaskProxyLess",
"websiteURL": "http://mywebsite.com/geetest/test.php",
"captchaId": "..."
})
Sample Code
# pip install requests
import requests
import time
api_key = "YOUR_API_KEY" # TODO: your api key of capsolver
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": 'GeeTestTaskProxyLess',
"websiteURL": "https://mywebsite.com/geetest/test.php", # page url of your site
"gt": "...", # v3 is required
"challenge": "...", # v3 is required
"captchaId": "...", # v4 is required
}
}
res = requests.post("https://api.capsolver.com/createTask", json=payload)
resp = res.json()
task_id = resp.get("taskId")
if not task_id:
print("Failed to create task:", res.text)
return
print(f"Got taskId: {task_id} / Getting result...")
while True:
time.sleep(1) # delay
payload = {"clientKey": api_key, "taskId": task_id}
res = requests.post("https://api.capsolver.com/getTaskResult", json=payload)
resp = res.json()
status = resp.get("status")
if status == "ready":
return resp.get("solution")
if status == "failed" or resp.get("errorId"):
print("Solve failed! response:", res.text)
return
solution = capsolver()
print(solution)
Points to note
-
Please do not copy directly from the browser developer Tool, GET GT and challenge on request.
-
A small number of errors to re-obtain the verification code parameters can be retried.
-
Verification code parameters can only be submitted to identify once, do not repeat the same parameters submitted to identify, need to re-initialize the acquisition.
-
Note: If you can not pass the site may be coding problems, then the CAPTCHA
=
symbol with% 3D replacement, other no coding, please note this.
5Parameters such as the test server can be queried here in the Geetest document.