FriendlyCaptcha: solving Friendly Captcha
TIP
Create the task with the createTask method and get the result with the getTaskResult method.
The task type types
that we support:
FriendlyCaptchaTaskProxyless
Create Task
Create a recognition task with the createTask method.
Task Object Structure
Properties | Type | Required | Description |
---|---|---|---|
type | String | Required | FriendlyCaptchaTaskProxyless |
websiteURL | String | Required | The page address, where the Friendly Captcha is solved |
websiteKey | String | Required | website key |
Example Request
POST https://api.capsolver.com/createTask
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "FriendlyCaptchaTaskProxyless",
"websiteURL": "https://www.yourtarget.com/",
"websiteKey": "FBTMEAFCK477GTRU"
}
}
After you submit the task to us, you should receive in the response a ‘taskId’ if it’s successful. Please read errorCode: full list of errors if you didn’t receive the task id.
Example Response
{
"errorId": 0,
"errorDescription": "",
"status": "idle",
"taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83"
}
Getting Results
After you have the taskId, you need to submit the taskId to retrieve the solution. Response structure is explained in getTaskResult.
Example Request
POST https://api.capsolver.com/getTaskResult
Host: api.capsolver.com
Content-Type: application/json
{
"clientKey": "YOUR_API_KEY",
"taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83"
}
Example Response
{
"errorId": 0,
"taskId": "0a9b8fad-66e5-4271-96a3-bee8751cfb83",
"status": "ready",
"solution": {
"token": "72b43902cd1457f6880dd3735c50070d.Z0+9+Hcx7KGSmHd1AQwtjQ..."
}
}
Sample Code
# pip install requests
import requests
import time
# TODO: set your config
api_key = "YOUR_API_KEY" # your api key of capsolver
site_key = "FBTMEAFCK477GTRU" # site key of your target site
site_url = "https://www.yourtarget.com" # page url of your target site
def capsolver():
payload = {
"clientKey": api_key,
"task": {
"type": 'FriendlyCaptchaTaskProxyless',
"websiteKey": site_key,
"websiteURL": site_url
}
}
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)