BotDeflector: solving BotDeflector
TIP
Create the task with the createTask method and get the result with the getTaskResult method.
The task type type is as follows
AntiBotdeflectorTaskProxyLess
Create Task
Create the task with the createTask.
Task Object Structure
| Properties | Type | Required | Description |
|---|---|---|---|
| type | String | Required | AntiBotdeflectorTaskProxyLess |
| websiteURL | String | Required | The URL of the current website homepage |
| domain | String | Required | The domain name used by the pow/get or icon/get endpoints, for example: botdeflector.eu |
| flowToken | String | Required | On the website, it may be called botReflectorJwtToken, for example: eyJhbGciOiJ... |
Attention
The domain parameter and the websiteURL parameter may not necessarily be the same domain name, please distinguish them.
Example Request
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "AntiBotdeflectorTaskProxyLess", // Required
"websiteURL": "https://exaple.com/", // Required
"domain":"exaple.com", // Required
"flowToken":"eyJhbGciOiJI1...", // Required
}
}Example Response
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}Getting Result
Use the getTaskResult method to get the recognition results
Depending on the website and proxy, you will get the results within the interval of 2s to 20s
Example Request
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006"
}Example Response
{
"errorId": 0,
"taskId": "646825ef-9547-4a29-9a05-50a6265f9d8a",
"status": "ready",
"solution": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOiI1ZmMyOGEwMi04Z..."
}
}Use SDK Request
# pip install --upgrade capsolver
# export CAPSOLVER_API_KEY='...'
import capsolver
# capsolver.api_key = "..."
solution = capsolver.solve({
"type": "AntiBotdeflectorTaskProxyLess",
"websiteURL": "https://exaple.com/",
"domain":"exaple.com",
"flowToken":"eyJhbGciOiJI1...",
})Sample Code
# pip install requests
import requests
import time
api_key = "YOUR_API_KEY" # your api key of capsolver
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": "AntiBotdeflectorTaskProxyLess",
"websiteURL": "https://exaple.com/",
"domain":"exaple.com",
"flowToken":"eyJhbGciOiJI1...",
}
}
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", {}).get("token")
if status == "failed" or resp.get("errorId"):
print("Solve failed! response:", res.text)
return
token = capsolver()
print(token)