@clawhub-capsolver-e723187cd8
Use capsolver to automatically resolve Geetest, reCAPTCHA v2, reCAPTCHA v3, MTCaptcha, DataDome, AWS WAF, Cloudflare Turnstile, and Cloudflare Challenge, etc.
---
name: capsolver
description: Use capsolver to automatically resolve Geetest, reCAPTCHA v2, reCAPTCHA v3, MTCaptcha, DataDome, AWS WAF, Cloudflare Turnstile, and Cloudflare Challenge, etc.
homepage: https://capsolver.com/
credentials:
- API_KEY
env:
required:
- API_KEY
---
# CapSolver Skill
Use this skill to automatically resolve various CAPTCHA challenges using the CapSolver API service. The skill supports Geetest, reCAPTCHA v2/v3, MTCaptcha, DataDome, AWS WAF, Cloudflare Turnstile, Cloudflare Challenge, and more.
**Authentication:** Set `API_KEY` in your environment or in a `.env` file in the repo root.
**Errors:** If it fails, the script will exit with code 1.
---
# Solver
## Task(Recognition)
### ImageToTextTask
Solve text-based captcha.
**Command:**
```bash
python3 ./scripts/solver.py ImageToTextTask --body "base64_image_data"
python3 ./scripts/solver.py ImageToTextTask --body "base64_image_data" --module "module_001"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--body`: Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--module`: Specify the module. All supported module references: https://docs.capsolver.com/en/guide/recognition/ImageToTextTask/#independent-module-support.
- `--images`: Only for `number` module, Support up to 9 base64 encoded images each time.
- `--max-retries`: Maximum number of retries (default: 60).
---
### ReCaptchaV2Classification
Classify reCAPTCHA v2 images.
**Command:**
```bash
python3 ./scripts/solver.py ReCaptchaV2Classification --question "question" --image "base64_image_data"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--websiteKey`: Website key to improve accuracy.
- `--question`: Please refer to: https://docs.capsolver.com/guide/recognition/ReCaptchaClassification/.
- `--image`: Base64 image string.
- `--max-retries`: Maximum number of retries (default: 60).
---
### AwsWafClassification
Classify AWS WAF images.
**Command:**
```bash
python3 ./scripts/solver.py AwsWafClassification --question "question" --images "base64_image_data1" "base64_image_data2" "base64_image_data3"
```
Too many images may exceed the command line length limit. You can try writing the base64 values of the images line by line to a file (such as aws_images.txt) and then using the xargs command to pass them to the --images parameter:
```bash
cat aws_images.txt | xargs python3 ./scripts/solver.py AwsWafClassification --question "question" --images
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--question`: Please refer to: https://docs.capsolver.com/guide/recognition/AwsWafClassification/.
- `--images`: Base64 image string, `aws:grid` supports 9 images each time, other types support 1 image each time.
- `--max-retries`: Maximum number of retries (default: 60).
---
### VisionEngine
Advanced AI vision-based captcha solving.
**Command:**
```bash
python3 ./scripts/solver.py VisionEngine --module "module" --image "base64_image_data" --imageBackground "base64_image_background_data"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--module`: Please refer to: https://docs.capsolver.com/guide/recognition/VisionEngine/.
- `--question`: Only the `shein` model requires, please refer to: https://docs.capsolver.com/en/guide/recognition/VisionEngine/.
- `--image`: Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--imageBackground`: Base64 encoded content of the background image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--max-retries`: Maximum number of retries (default: 60).
---
## Task(Token)
### GeeTest
Solve GeeTest captcha (v3/v4).
**Command:**
```bash
python3 ./scripts/solver.py GeeTestTaskProxyLess --websiteURL "https://example.com/" --captchaId "captcha_id"
```
Optional:
- `--websiteURL`: Web address of the website using geetest (Ex: https://geetest.com).
- `--gt`: Only Geetest V3 is required.
- `--challenge`: Only Geetest V3 is required.
- `--captchaId`: Only Geetest V4 is required.
- `--geetestApiServerSubdomain`: Special api subdomain, example: api.geetest.com.
- `--max-retries`: Maximum number of retries (default: 60).
---
### reCAPTCHA v2
Solve Google reCAPTCHA v2 (checkbox/invisible).
**Command:**
```bash
python3 ./scripts/solver.py ReCaptchaV2TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 ./scripts/solver.py ReCaptchaV2Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host.
- `--websiteKey`: Recaptcha website key.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--pageAction`: For ReCaptcha v2, if there is an sa parameter in the payload of the /anchor endpoint, please submit its value.
- `--enterprisePayload`: For ReCaptchaV2 enterprise version, if there is an s parameter in the payload of the /anchor endpoint, please submit its value.
- `--isInvisible`: Pass true if there is no “I’m not a robot” checkbox but the challenge will still appear, usually required in v2 invisible mode.
- `--isSession`: Session mode, when enabled, will return a recaptcha-ca-t value, which is used as a cookie. It usually appears in v3. Note: Some websites require a recaptcha-ca-e value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings.
- `--max-retries`: Maximum number of retries (default: 60).
---
### reCAPTCHA v3
Solve Google reCAPTCHA v3.
**Command:**
```bash
python3 ./scripts/solver.py ReCaptchaV3TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 ./scripts/solver.py ReCaptchaV3Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host.
- `--websiteKey`: Recaptcha website key.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--pageAction`: For ReCaptcha v3, You can find the value of the action parameter by searching for grecaptcha.execute.
- `--enterprisePayload`: For the enterprise version, search for grecaptcha.enterprise.render and pass the s parameter.
- `--isSession`: Session mode, when enabled, will return a `recaptcha-ca-t` value, which is used as a cookie. It usually appears in v3. Note: Some websites require a `recaptcha-ca-e` value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings.
- `--max-retries`: Maximum number of retries (default: 60).
---
### MTCaptcha
Solve MTCaptcha.
**Command:**
```bash
python3 ./scripts/solver.py MtCaptchaTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 ./scripts/solver.py MtCaptchaTask --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: Web address of the website using generally it’s fixed value. (Ex: https://google.com).
- `--websiteKey`: The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key).
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--max-retries`: Maximum number of retries (default: 60).
---
### DataDome
Solve DataDome.
**Command:**
```bash
python3 ./scripts/solver.py DatadomeSliderTask --captchaUrl "https://geo.captcha-delivery.com/xxxxxxxxx" --userAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36" --proxy "host:port:username:password"
```
Optional:
- `--captchaUrl`: If the url contains t=bv that means that your ip must be banned, t should be t=fe.
- `--userAgent`: It needs to be the same as the userAgent you use to request the website. Currently we only support the following userAgent.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--max-retries`: Maximum number of retries (default: 60).
---
### AWS WAF
Solve AWS WAF.
**Command:**
```bash
python3 ./scripts/solver.py AntiAwsWafTask --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js" --proxy "host:port:username:password"
python3 ./scripts/solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js"
python3 ./scripts/solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com"
```
Optional:
- `--websiteURL`: If the url contains t=bv that means that your ip must be banned, t should be t=fe.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--awsKey`: The key value returned by the captcha page.
- `--awsIv`: The iv value returned by the captcha page.
- `--awsContext`: The context value returned by the captcha page.
- `--awsChallengeJS`: The challenge.js link returned by the captcha page.
- `--awsApiJs`: The jsapi.js link returned by the captcha page.
- `--awsProblemUrl`: The problem endpoint url containing keywords like problem, num_solutions_required, etc..
- `--awsApiKey`: The api_key value of the problem endpoint.
- `--awsExistingToken`: The aws-waf-token used for the last verification.
- `--max-retries`: Maximum number of retries (default: 60).
---
### Cloudflare Turnstile
Solve Cloudflare Turnstile.
**Command:**
```bash
python3 ./scripts/solver.py AntiTurnstileTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
```
Optional:
- `--websiteURL`: The address of the target page.
- `--websiteKey`: Turnstile website key.
- `--action`: The value of the data-action attribute of the Turnstile element if it exists.
- `--cdata`: The value of the data-cdata attribute of the Turnstile element if it exists.
- `--max-retries`: Maximum number of retries (default: 60).
---
### Cloudflare Challenge
Solve Cloudflare Challenge (5-second shield).
**Command:**
```bash
python3 ./scripts/solver.py AntiCloudflareTask --websiteURL "https://example.com" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The address of the target page.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--userAgent`: The user-agent you used to request the target website. Only Chrome’s userAgent is supported.
- `--html`: The response of requesting the target website, it usually contains "Just a moment…" and status code is 403. we need this html for some websites, please be sure to use your sticky proxy to dynamically scrape the HTML every time.
- `--max-retries`: Maximum number of retries (default: 60).
---
## Response example
**Output:** All commands return JSON objects with task-specific solution fields.
### ImageToTextTask
```json
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"status": "ready",
"solution": {
"text": "44795sds",
// number module:
"answers": ["100", "1330", "147", "248", "303", "439", "752", "752", "752"],
},
"taskId": "..."
}
```
### ReCaptchaV2Classification
multi objects:
```json
{
"errorId": 0,
"status": "ready",
"solution": {
"type": "multi",
"objects": [
0,
1,
2,
3
],
"size": 4,
// 3 or 4
},
"taskId": "cbb1c730-e569-4ba6-b5fc-e06377694aa7"
}
```
single object:
```json
{
"errorId": 0,
"status": "ready",
"solution": {
"type": "single",
"hasObject": true,
"size": 1,
},
"taskId": "cbb1c730-e569-4ba6-b5fc-e06377694aa7"
}
```
### AwsWafClassification
```json
{
"errorId": 0,
"status": "ready",
"solution": {
//carcity point
"box": [
116.7,
164.1
],
// grid type, objects means the image index that matches the question
"objects": [0, 1, 3, 4, 6],
//if question include `bifurcatedzoo`
"distance": 500
},
"taskId": "cbb1c730-e569-4ba6-b5fc-e06377694aa7"
}
```
### VisionEngine
```json
{
"errorId": 0,
"errorCode": "",
"errorDescription": "",
"status": "ready",
"solution": {
"distance": 213,
},
"taskId": "cbb1c730-e569-4ba6-b5fc-e06377694aa7"
}
```
### GeeTest
Geetest v3:
```json
{
"errorId": 0,
"taskId": "e0ecaaa8-06f6-41fd-a02e-a0c79b957b15",
"status": "ready",
"solution": {
"challenge": "...",
"validate": "...",
"seccode": "...",
"userAgent": "..."
},
}
```
Geetest v4:
```json
{
"errorId": 0,
"taskId": "e0ecaaa8-06f6-41fd-a02e-a0c79b957b15",
"status": "ready",
"solution": {
"captcha_id": "",
"captcha_output": "",
"gen_time": "",
"lot_number": "",
"pass_token": "",
"risk_type": "slide"
}
}
```
### reCAPTCHA
reCAPTCHA v2/v3:
```json
{
"errorId": 0,
"errorCode": null,
"errorDescription": null,
"solution": {
"userAgent": "xxx", // User-Agent
"secChUa": "xxx", // Sec-Ch-Ua
"createTime": 1671615324290, // The creation time of the token
"gRecaptchaResponse": "3AHJ......", // token
"recaptcha-ca-t": "AbEM......", // Some v3 websites have session mode. After enabling isSession, this parameter will be returned and used as a cookie.
"recaptcha-ca-e": "Abp_......" // Some v2 websites have this parameter, which is used as a cookie. If there is such a value, it will be automatically returned.
},
"status": "ready"
}
```
### MTCaptcha
```json
{
"errorId": 0,
"taskId": "646825ef-9547-4a29-9a05-50a6265f9d8a",
"status": "ready",
"solution": {
"token": ""
}
}
```
### DataDome
```json
{
"errorId": 0,
"errorCode": null,
"errorDescription": null,
"solution": {
"cookie": "datadome=yzj_BK...S0; Max-Age=31536000; Domain=; Path=/; Secure; SameSite=Lax"
},
"status": "ready"
}
```
### AWS WAF
```json
{
"errorId": 0,
"taskId": "646825ef-9547-4a29-9a05-50a6265f9d8a",
"status": "ready",
"solution": {
"cookie": "223d1f60-0e9f-4238-ac0a-e766b15a778e:EQoAf0APpGIKAAAA:AJam3OWpff1VgKIJxH4lGMMHxPVQ0q0R3CNtgcMbR4VvnIBSpgt1Otbax4kuqrgkEp0nFKanO5oPtwt9+Butf7lt0JNe4rZQwZ5IrEnkXvyeZQPaCFshHOISAFLTX7AWHldEXFlZEg7DjIc="
}
}
```
### Cloudflare Turnstile
```json
{
"errorId": 0,
"taskId": "61138bb6-19fb-11ec-a9c8-0242ac110006",
"status": "ready",
"errorCode": null,
"errorDescription": null,
"solution": {
"token": "0.mF74FV8wEufAWOdvOak_xFaVy3lqIDel7SwNhw3GgpICSWwTjYfrQB8mRT1dAJJBEoP7N1sESdp6WH9cTS1T0catWLecG3ayNcjwxVtr3hWfS-dmcBGRTx4xYwI64sAVboYGpIyuDBeMIRC3W8dK35v1nDism9xa595Da5VlXKM7hk7pIXg69lodfiftasIkyD_KUGkxBwxvrmz7dBo10-Y5zvro9hD4QKRjOx7DYj9sumnkyYCDx0m4ImDIIkNswfVTWI2V22wlnpHdvMgdtKYgOIIAU28y9gtdrdDkpkH0GHcDyd15sxQGd9VjwhGZA_mpusUKMsEoGgst2rJ3zA.UWfZupqLlGvlATkPo3wdaw.38d55cd0163610d8ce8c42fcff7b62d8981495cc1afacbb2f14e5a23682a4e13",
"type": "turnstile",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
}
}
```
### Cloudflare Challenge
```json
{
"errorId": 0,
"taskId": "df944101-64ac-468d-bc9f-41baecc3b8ca",
"status": "ready",
"errorCode": "",
"errorDescription": "",
"solution": {
"cookies": {
"cf_clearance": "Bcg6jNLzTVaa3IsFhtDI.e4_LX8p7q7zFYHF7wiHPo...uya1bbdfwBEi3tNNQpc"
},
"token": "Bcg6jNLzTVaa3IsFhtDI.e4_LX8p7q7zFYHF7wiHPo...uya1bbdfwBEi3tNNQpc",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
}
}
```
FILE:requirements.txt
requests>=2.32.4
python-dotenv>=0.9.9
FILE:README.md
# CapSolver Skills
A collection of skills for the CapSolver, unleashing your RPA potential.
## Table of Contents
- [Supported captcha types](#supported-captcha-types)
- [Directory Structure](#directory-structure)
- [Installation](#installation)
- [Environment Configuration](#environment-configuration)
- [Usage Examples](#usage-examples)
- [Task(Recognition)](#taskrecognition)
- [ImageToTextTask](#imagetotexttask)
- [ReCaptchaV2Classification](#ReCaptchaV2Classification)
- [AwsWafClassification](#AwsWafClassification)
- [VisionEngine](#VisionEngine)
- [Task(Token)](#tasktoken)
- [GeeTest](#geetest)
- [reCAPTCHA v2](#recaptcha-v2)
- [reCAPTCHA v3](#recaptcha-v3)
- [MTCaptcha](#mtcaptcha)
- [DataDome](#datadome)
- [AWS WAF](#aws-waf)
- [Cloudflare Turnstile](#cloudflare-turnstile)
- [Cloudflare Challenge](#cloudflare-challenge)
- [Resources](#resources)
## Supported captcha types
Task(Recognition)
1. ImageToText
2. reCAPTCHA v2
3. AWS WAF
4. VisionEngine
Task(Token)
1. Geetest V3
2. Geetest V4
3. reCAPTCHA v2
4. reCAPTCHA v3
5. Cloudflare Turnstile
6. Cloudflare Challenge
7. DataDome
8. AWS WAF
9. MTCaptcha
## Directory Structure
```
capsolver/
├── scripts/ # The capsolver script for this skill
├── SKILL.md # Skill metadata
├── README.md # README.md
├── requirements.txt # Python dependencies
└── .env.example # Example environment file
```
## Installation
1. Clone the repository:
```bash
git clone https://github.com/capsolver/capsolver-skills.git
cd capsolver-skills
```
2. Install python dependencies:
```bash
pip install -r requirements.txt
```
## Environment Configuration
1. Create a `.env` file in the root directory based on the `.env.example` file:
```bash
cp .env.example .env
```
2. Add your CapSolver API key to the `.env` file:
```
API_KEY=CAP-XXXXX-your-api-key-here
```
You can get an API key from the [CapSolver Dashboard](https://dashboard.capsolver.com/).
## Usage Examples
### Task(Recognition)
#### ImageToTextTask
Solve text-based captcha.
**Command:**
```bash
python3 solver.py ImageToTextTask --body "base64_image_data"
python3 solver.py ImageToTextTask --body "base64_image_data" --module "module_001"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--body`: Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--module`: Specify the module. All supported module references: https://docs.capsolver.com/en/guide/recognition/ImageToTextTask/#independent-module-support.
- `--images`: Only for `number` module, Support up to 9 base64 encoded images each time.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### ReCaptchaV2Classification
Classify reCAPTCHA v2 images.
**Command:**
```bash
python3 solver.py ReCaptchaV2Classification --question "question" --image "base64_image_data"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--websiteKey`: Website key to improve accuracy.
- `--question`: Please refer to: https://docs.capsolver.com/guide/recognition/ReCaptchaClassification/.
- `--image`: Base64 image string.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### AwsWafClassification
Classify AWS WAF images.
**Command:**
```bash
python3 solver.py AwsWafClassification --question "question" --images "base64_image_data1" "base64_image_data2" "base64_image_data3"
```
Too many images may exceed the command line length limit. You can try writing the base64 values of the images line by line to a file (such as aws_images.txt) and then using the xargs command to pass them to the --images parameter:
```bash
cat aws_images.txt | xargs python3 solver.py AwsWafClassification --question "question" --images
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--question`: Please refer to: https://docs.capsolver.com/guide/recognition/AwsWafClassification/.
- `--images`: Base64 image string, `aws:grid` supports 9 images each time, other types support 1 image each time.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### VisionEngine
Advanced AI vision-based captcha solving.
**Command:**
```bash
python3 solver.py VisionEngine --module "module" --image "base64_image_data" --imageBackground "base64_image_background_data"
```
Optional:
- `--websiteURL`: Page source url to improve accuracy.
- `--module`: Please refer to: https://docs.capsolver.com/guide/recognition/VisionEngine/.
- `--question`: Only the `shein` model requires, please refer to: https://docs.capsolver.com/en/guide/recognition/VisionEngine/.
- `--image`: Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--imageBackground`: Base64 encoded content of the background image (no newlines, no data:image/***;charset=utf-8;base64,).
- `--max-retries`: Maximum number of retries (default: 60).
---
### Task(Token)
#### GeeTest
Solve GeeTest captcha (v3/v4).
**Command:**
```bash
python3 solver.py GeeTestTaskProxyLess --websiteURL "https://example.com/" --captchaId "captcha_id"
```
Optional:
- `--websiteURL`: Web address of the website using geetest (Ex: https://geetest.com).
- `--gt`: Only Geetest V3 is required.
- `--challenge`: Only Geetest V3 is required.
- `--captchaId`: Only Geetest V4 is required.
- `--geetestApiServerSubdomain`: Special api subdomain, example: api.geetest.com.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### reCAPTCHA v2
Solve Google reCAPTCHA v2 (checkbox/invisible).
**Command:**
```bash
python3 solver.py ReCaptchaV2TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py ReCaptchaV2Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host.
- `--websiteKey`: Recaptcha website key.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--pageAction`: For ReCaptcha v2, if there is an sa parameter in the payload of the /anchor endpoint, please submit its value.
- `--enterprisePayload`: For ReCaptchaV2 enterprise version, if there is an s parameter in the payload of the /anchor endpoint, please submit its value.
- `--isInvisible`: Pass true if there is no “I’m not a robot” checkbox but the challenge will still appear, usually required in v2 invisible mode.
- `--isSession`: Session mode, when enabled, will return a recaptcha-ca-t value, which is used as a cookie. It usually appears in v3. Note: Some websites require a recaptcha-ca-e value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### reCAPTCHA v3
Solve Google reCAPTCHA v3.
**Command:**
```bash
python3 solver.py ReCaptchaV3TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py ReCaptchaV3Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host.
- `--websiteKey`: Recaptcha website key.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--pageAction`: For ReCaptcha v3, You can find the value of the action parameter by searching for grecaptcha.execute.
- `--enterprisePayload`: For the enterprise version, search for grecaptcha.enterprise.render and pass the s parameter.
- `--isSession`: Session mode, when enabled, will return a `recaptcha-ca-t` value, which is used as a cookie. It usually appears in v3. Note: Some websites require a `recaptcha-ca-e` value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### MTCaptcha
Solve MTCaptcha.
**Command:**
```bash
python3 solver.py MtCaptchaTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py MtCaptchaTask --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: Web address of the website using generally it’s fixed value. (Ex: https://google.com).
- `--websiteKey`: The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key).
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### DataDome
Solve DataDome.
**Command:**
```bash
python3 solver.py DatadomeSliderTask --captchaUrl "https://geo.captcha-delivery.com/xxxxxxxxx" --userAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36" --proxy "host:port:username:password"
```
Optional:
- `--captchaUrl`: If the url contains t=bv that means that your ip must be banned, t should be t=fe.
- `--userAgent`: It needs to be the same as the userAgent you use to request the website. Currently we only support the following userAgent.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### AWS WAF
Solve AWS WAF.
**Command:**
```bash
python3 solver.py AntiAwsWafTask --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js" --proxy "host:port:username:password"
python3 solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js"
python3 solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com"
```
Optional:
- `--websiteURL`: If the url contains t=bv that means that your ip must be banned, t should be t=fe.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--awsKey`: The key value returned by the captcha page.
- `--awsIv`: The iv value returned by the captcha page.
- `--awsContext`: The context value returned by the captcha page.
- `--awsChallengeJS`: The challenge.js link returned by the captcha page.
- `--awsApiJs`: The jsapi.js link returned by the captcha page.
- `--awsProblemUrl`: The problem endpoint url containing keywords like problem, num_solutions_required, etc..
- `--awsApiKey`: The api_key value of the problem endpoint.
- `--awsExistingToken`: The aws-waf-token used for the last verification.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### Cloudflare Turnstile
Solve Cloudflare Turnstile.
**Command:**
```bash
python3 solver.py AntiTurnstileTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
```
Optional:
- `--websiteURL`: The address of the target page.
- `--websiteKey`: Turnstile website key.
- `--action`: The value of the data-action attribute of the Turnstile element if it exists.
- `--cdata`: The value of the data-cdata attribute of the Turnstile element if it exists.
- `--max-retries`: Maximum number of retries (default: 60).
---
#### Cloudflare Challenge
Solve Cloudflare Challenge (5-second shield).
**Command:**
```bash
python3 solver.py AntiCloudflareTask --websiteURL "https://example.com" --proxy "host:port:username:password"
```
Optional:
- `--websiteURL`: The address of the target page.
- `--proxy`: Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/.
- `--userAgent`: The user-agent you used to request the target website. Only Chrome’s userAgent is supported.
- `--html`: The response of requesting the target website, it usually contains "Just a moment…" and status code is 403. we need this html for some websites, please be sure to use your sticky proxy to dynamically scrape the HTML every time.
- `--max-retries`: Maximum number of retries (default: 60).
## Resources
- [CapSolver Docs](https://docs.capsolver.com/) - The official capsolver documentation allows you to find answers to any questions you are unsure of here
FILE:scripts/solver.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Discover seamless automatic captcha solving with capsolver AI-powered Auto Web Unblock technology!
Supports automatic resolution of Geetest, reCAPTCHA v2, reCAPTCHA v3, MTCaptcha, DataDome, AWS WAF, Cloudflare Turnstile, and Cloudflare Challenge, etc.
"""
import os
import sys
import json
import time
import argparse
from typing import Optional, Dict, Any
import requests
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class CapSolver:
SUPPORTED_TYPES = [
# Task(Recognition)
'ImageToTextTask',
'ReCaptchaV2Classification',
'AwsWafClassification',
'VisionEngine',
# Task(Token)
'GeeTestTaskProxyLess',
'ReCaptchaV2TaskProxyLess',
'ReCaptchaV2EnterpriseTask',
'ReCaptchaV2EnterpriseTaskProxyLess',
'ReCaptchaV3Task',
'ReCaptchaV3TaskProxyLess',
'ReCaptchaV3EnterpriseTask',
'ReCaptchaV3EnterpriseTaskProxyLess',
'MtCaptchaTask',
'MtCaptchaTaskProxyLess',
'DatadomeSliderTask',
'AntiAwsWafTask',
'AntiAwsWafTaskProxyLess',
'AntiTurnstileTaskProxyLess',
'AntiCloudflareTask',
]
def __init__(self, api_key: Optional[str] = None):
self.api_key = api_key or os.getenv('API_KEY')
if not self.api_key:
raise ValueError(
'API key not found. Please set API_KEY in .env file or environment variable.'
)
self.api_base = 'https://api.capsolver.com'
self.create_task_endpoint = '/createTask'
self.get_task_result_endpoint = '/getTaskResult'
self.get_balance_endpoint = '/getBalance'
self.timeout = 60
self.interval = 1
self.create_task_payload = {
'source': 'capsolver-skill',
'clientKey': self.api_key,
'task': {}
}
self.get_task_result_payload = {
'source': 'capsolver-skill',
'clientKey': self.api_key,
'taskId': ''
}
self.headers = {
'Content-Type': 'application/json',
}
def check_type(self, _type: str) -> bool:
return _type in self.SUPPORTED_TYPES
def solve(self, args: argparse.Namespace) -> Dict[str, Any]:
if not self.check_type(args.command):
raise ValueError(f"Unsupported type: {args.command}. Supported: {', '.join(self.SUPPORTED_TYPES)}")
self.build_task_payload(args)
task_id, solution = self.create_task()
if solution is not None:
return solution
return self.get_result(
task_id=task_id,
max_retries=args.max_retries
)
def build_task_payload(self, args: argparse.Namespace):
if args.command == 'ImageToTextTask':
if args.module == 'common' and args.body is None:
raise ValueError('Body cannot be empty')
if args.module == 'number' and args.images is None:
raise ValueError('Images cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'body': args.body,
'images': args.images,
'module': args.module
}
elif args.command == 'ReCaptchaV2Classification':
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'image': args.image,
'question': args.question
}
elif args.command == 'AwsWafClassification':
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'images': args.images,
'question': args.question
}
elif args.command == 'VisionEngine':
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'module': args.module,
'image': args.image,
'imageBackground': args.imageBackground,
'question': args.question
}
elif args.command == 'GeeTestTaskProxyLess':
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'gt': args.gt,
'challenge': args.challenge,
'captchaId': args.captchaId,
'geetestApiServerSubdomain': args.geetestApiServerSubdomain
}
elif 'ReCaptchaV2' in args.command:
if args.command == 'ReCaptchaV2EnterpriseTask' and args.proxy is None:
raise ValueError('Proxy cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'websiteKey': args.websiteKey,
'proxy': args.proxy,
'pageAction': args.pageAction,
'enterprisePayload': args.enterprisePayload,
'isInvisible': args.isInvisible,
'isSession': args.isSession
}
elif 'ReCaptchaV3' in args.command:
if (args.command == 'ReCaptchaV3Task' or args.command == 'ReCaptchaV3EnterpriseTask') and args.proxy is None:
raise ValueError('Proxy cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'websiteKey': args.websiteKey,
'proxy': args.proxy,
'pageAction': args.pageAction,
'enterprisePayload': args.enterprisePayload,
'isSession': args.isSession
}
elif 'MtCaptchaTask' in args.command:
if args.command == 'MtCaptchaTask' and args.proxy is None:
raise ValueError('Proxy cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'websiteKey': args.websiteKey,
'proxy': args.proxy
}
elif args.command == 'DatadomeSliderTask':
self.create_task_payload['task'] = {
'type': args.command,
'captchaUrl': args.captchaUrl,
'userAgent': args.userAgent,
'proxy': args.proxy
}
elif 'AntiAwsWafTask' in args.command:
if args.command == 'AntiAwsWafTask' and args.proxy is None:
raise ValueError('Proxy cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'proxy': args.proxy,
'awsKey': args.awsKey,
'awsIv': args.awsIv,
'awsContext': args.awsContext,
'awsChallengeJS': args.awsChallengeJS,
'awsApiJs': args.awsApiJs,
'awsProblemUrl': args.awsProblemUrl,
'awsApiKey': args.awsApiKey,
'awsExistingToken': args.awsExistingToken
}
elif args.command == 'AntiTurnstileTaskProxyLess':
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'websiteKey': args.websiteKey,
'metadata': {
'action': args.action,
'cdata': args.cdata,
}
}
elif args.command == 'AntiCloudflareTask':
if args.proxy is None:
raise ValueError('Proxy cannot be empty')
self.create_task_payload['task'] = {
'type': args.command,
'websiteURL': args.websiteURL,
'userAgent': args.userAgent,
'html': args.html,
'proxy': args.proxy
}
else:
raise TypeError(f"Unsupported type: {args.command}")
def create_task(self) -> tuple[str, Any]:
response = requests.post(
f"{self.api_base}{self.create_task_endpoint}",
headers=self.headers,
json=self.create_task_payload,
timeout=self.timeout
)
if response.status_code == 200:
result = response.json()
task_id = result.get("taskId")
status = result.get('status')
if not task_id:
raise RuntimeError(f"Failed to create task, get taskId failed: {response.text}")
if status == 'ready':
return task_id, result.get('solution')
return task_id, None
if response.status_code == 400:
result = response.json()
error_description = result.get("errorDescription")
raise ValueError(f"Failed to create task, invalid task: {error_description}")
if response.status_code == 401:
result = response.json()
error_description = result.get("errorDescription")
raise RuntimeError(f"Failed to create task, authentication failed: {error_description}")
else:
raise RuntimeError(f"Failed to create task, unexpected error {response.status_code}: {response.text}")
def get_result(self, task_id: str, max_retries: int = 30) -> Dict[str, Any]:
for attempt in range(1, max_retries + 1):
result = self.get_task_result(task_id)
if result is not None:
return result
if attempt < max_retries:
print(f"Task {task_id} still pending, waiting {self.interval} seconds")
time.sleep(self.interval)
raise TimeoutError(f"Get task result failed after {max_retries} attempts.")
def get_task_result(self, task_id: str) -> Optional[Dict[str, Any]]:
self.get_task_result_payload['taskId'] = task_id
response = requests.post(
f"{self.api_base}{self.get_task_result_endpoint}",
headers=self.headers,
json=self.get_task_result_payload,
timeout=self.timeout
)
if response.status_code == 200:
result = response.json()
status = result.get('status')
if status == 'ready':
return result.get('solution')
elif status in ['idle', 'processing']:
return None
elif status == 'failed':
raise RuntimeError(f"Get task result failed: {result}")
elif response.status_code == 400:
result = response.json()
error_description = result.get("errorDescription")
raise ValueError(f"Failed to get task result, invalid task: {error_description}")
else:
raise RuntimeError(f"Unexpected status code {response.status_code}")
return None
def main():
parser = argparse.ArgumentParser(
description='Discover seamless automatic captcha solving with capsolver AI-powered Auto Web Unblock technology!',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Environment Variables:
API_KEY: Your CapSolver API key (required)
Examples:
# ImageToTextTask
python3 solver.py ImageToTextTask --body "base64_image_data"
python3 solver.py ImageToTextTask --body "base64_image_data" --module "module_001"
# ReCaptchaV2Classification
python3 solver.py ReCaptchaV2Classification --question "question" --image "base64_image_data"
# AwsWafClassification
python3 solver.py AwsWafClassification --question "question" --images "base64_image_data1" "base64_image_data2" "base64_image_data3"
# VisionEngine
python3 solver.py VisionEngine --module "module" --image "base64_image_data" --imageBackground "base64_image_background_data"
# GeeTest
python3 solver.py GeeTestTaskProxyLess --websiteURL "https://example.com/" --captchaId "captcha_id"
# reCAPTCHA v2
python3 solver.py ReCaptchaV2TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py ReCaptchaV2Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
# reCAPTCHA v3
python3 solver.py ReCaptchaV3TaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py ReCaptchaV3Task --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
# MTCaptcha
python3 solver.py MtCaptchaTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
python3 solver.py MtCaptchaTask --websiteURL "https://example.com" --websiteKey "site_key" --proxy "host:port:username:password"
# DataDome
python3 solver.py DatadomeSliderTask --captchaUrl "https://geo.captcha-delivery.com/xxxxxxxxx" --userAgent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36" --proxy "host:port:username:password"
# AwsWaf
python3 solver.py AntiAwsWafTask --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js" --proxy "host:port:username:password"
python3 solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com" --awsChallengeJS "https://path/to/challenge.js"
python3 solver.py AntiAwsWafTaskProxyLess --websiteURL "https://example.com"
# Cloudflare Turnstile
python3 solver.py AntiTurnstileTaskProxyLess --websiteURL "https://example.com" --websiteKey "site_key"
# Cloudflare Challenge
python3 solver.py AntiCloudflareTask --websiteURL "https://example.com" --proxy "host:port:username:password"
For detailed documentation, visit: https://docs.capsolver.com/
""")
subparsers = parser.add_subparsers(dest='command', help='Available commands')
# ========== Task(Recognition)
# ImageToTextTask
parser_image_to_text_task = subparsers.add_parser('ImageToTextTask', help='Solve text-based captcha')
parser_image_to_text_task.add_argument('-u', '--websiteURL', required=False, help='Page source url to improve accuracy')
parser_image_to_text_task.add_argument('-b', '--body', required=False, help='Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,)')
parser_image_to_text_task.add_argument('-i', '--images', nargs='+', required=False, help='Only for number module, Support up to 9 base64 encoded images each time')
parser_image_to_text_task.add_argument('-m', '--module', default='common', required=False, help='Specify the module. All supported module references: https://docs.capsolver.com/en/guide/recognition/ImageToTextTask/#independent-module-support')
parser_image_to_text_task.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# ReCaptchaV2Classification
parser_recaptcha_v2_classification = subparsers.add_parser('ReCaptchaV2Classification', help='Classify reCAPTCHA v2 images')
parser_recaptcha_v2_classification.add_argument('-u', '--websiteURL', required=False, help='Page source url to improve accuracy')
parser_recaptcha_v2_classification.add_argument('-k', '--websiteKey', required=False, help='Website key to improve accuracy')
parser_recaptcha_v2_classification.add_argument('-q', '--question', required=True, help='Please refer to: https://docs.capsolver.com/guide/recognition/ReCaptchaClassification/')
parser_recaptcha_v2_classification.add_argument('-i', '--image', required=True, help='Base64 image string')
parser_recaptcha_v2_classification.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# AwsWafClassification
parser_aws_waf_classification = subparsers.add_parser('AwsWafClassification', help='Classify aws waf images')
parser_aws_waf_classification.add_argument('-u', '--websiteURL', required=False, help='Page source url to improve accuracy')
parser_aws_waf_classification.add_argument('-q', '--question', required=True, help='Please refer to: https://docs.capsolver.com/guide/recognition/AwsWafClassification/')
parser_aws_waf_classification.add_argument('-i', '--images', nargs='+', required=True, help='Base64 image string, aws:grid supports 9 images each time, other types support 1 image each time')
parser_aws_waf_classification.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# VisionEngine
parser_vision_engine = subparsers.add_parser('VisionEngine', help='Advanced AI vision-based captcha solving')
parser_vision_engine.add_argument('-u', '--websiteURL', required=False, help='Page source url to improve accuracy')
parser_vision_engine.add_argument('-m', '--module', required=True, help='Please refer to: https://docs.capsolver.com/guide/recognition/VisionEngine/')
parser_vision_engine.add_argument('-q', '--question', required=False, help='Only the shein model requires, please refer to: https://docs.capsolver.com/en/guide/recognition/VisionEngine/')
parser_vision_engine.add_argument('-i', '--image', required=True, help='Base64 encoded content of the image (no newlines, no data:image/***;charset=utf-8;base64,)')
parser_vision_engine.add_argument('-b', '--imageBackground', required=False, help='Base64 encoded content of the background image (no newlines, no data:image/***;charset=utf-8;base64,)')
parser_vision_engine.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# ========== Task(Token)
# GeeTestTaskProxyLess
parser_geetest_task_proxyless = subparsers.add_parser('GeeTestTaskProxyLess', help='Solve GeeTest captcha (v3/v4)')
parser_geetest_task_proxyless.add_argument('-u', '--websiteURL', required=True, help='Web address of the website using geetest (Ex: https://geetest.com)')
parser_geetest_task_proxyless.add_argument('-g', '--gt', required=False, help='Only Geetest V3 is required')
parser_geetest_task_proxyless.add_argument('-c', '--challenge', required=False, help='Only Geetest V3 is required')
parser_geetest_task_proxyless.add_argument('-i', '--captchaId', required=False, help='Only Geetest V4 is required')
parser_geetest_task_proxyless.add_argument('-d', '--geetestApiServerSubdomain', required=False, help='Special api subdomain, example: api.geetest.com')
parser_geetest_task_proxyless.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# ReCaptchaV2TaskProxyLess
# ReCaptchaV2EnterpriseTask
# ReCaptchaV2EnterpriseTaskProxyLess
parser_recaptcha_v2_name_list = ['ReCaptchaV2TaskProxyLess', 'ReCaptchaV2EnterpriseTask', 'ReCaptchaV2EnterpriseTaskProxyLess']
for parser_recaptcha_v2_name in parser_recaptcha_v2_name_list:
parser_recaptcha_v2 = subparsers.add_parser(parser_recaptcha_v2_name, help='Solve Google reCAPTCHA v2 (checkbox/invisible)')
parser_recaptcha_v2.add_argument('-u', '--websiteURL', required=True, help='The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host')
parser_recaptcha_v2.add_argument('-k', '--websiteKey', required=True, help='Recaptcha website key')
parser_recaptcha_v2.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_recaptcha_v2.add_argument('-a', '--pageAction', required=False, help='For ReCaptcha v2, if there is an sa parameter in the payload of the /anchor endpoint, please submit its value')
parser_recaptcha_v2.add_argument('-e', '--enterprisePayload', required=False, help='For ReCaptchaV2 enterprise version, if there is an s parameter in the payload of the /anchor endpoint, please submit its value')
parser_recaptcha_v2.add_argument('-i', '--isInvisible', type=bool, default=False, required=False, help='Pass true if there is no “I’m not a robot” checkbox but the challenge will still appear, usually required in v2 invisible mode')
parser_recaptcha_v2.add_argument('-s', '--isSession', type=bool, default=False, required=False, help='Session mode, when enabled, will return a recaptcha-ca-t value, which is used as a cookie. It usually appears in v3. Note: Some websites require a recaptcha-ca-e value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings')
parser_recaptcha_v2.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# ReCaptchaV3Task
# ReCaptchaV3TaskProxyLess
# ReCaptchaV3EnterpriseTask
# ReCaptchaV3EnterpriseTaskProxyLess
parser_recaptcha_v3_name_list = ['ReCaptchaV3Task', 'ReCaptchaV3TaskProxyLess', 'ReCaptchaV3EnterpriseTask', 'ReCaptchaV3EnterpriseTaskProxyLess']
for parser_recaptcha_v3_name in parser_recaptcha_v3_name_list:
parser_recaptcha_v3 = subparsers.add_parser(parser_recaptcha_v3_name, help='Solve Google reCAPTCHA v3')
parser_recaptcha_v3.add_argument('-u', '--websiteURL', required=True, help='The URL of the target webpage that loads the captcha, It’s best to submit the full URL instead of just the host.')
parser_recaptcha_v3.add_argument('-k', '--websiteKey', required=True, help='Recaptcha website key.')
parser_recaptcha_v3.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_recaptcha_v3.add_argument('-a', '--pageAction', required=False, help='For ReCaptcha v3, You can find the value of the action parameter by searching for grecaptcha.execute')
parser_recaptcha_v3.add_argument('-e', '--enterprisePayload', required=False, help='For the enterprise version, search for grecaptcha.enterprise.render and pass the s parameter')
parser_recaptcha_v3.add_argument('-s', '--isSession', type=bool, default=False, required=False, help='Session mode, when enabled, will return a recaptcha-ca-t value, which is used as a cookie. It usually appears in v3. Note: Some websites require a recaptcha-ca-e value, which usually appears in v2. If this value is present, it will be automatically returned without any additional parameter settings')
parser_recaptcha_v3.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# MtCaptchaTask
# MtCaptchaTaskProxyLess
parser_mtcaptcha_name_list = ['MtCaptchaTask', 'MtCaptchaTaskProxyLess']
for parser_mtcaptcha_name in parser_mtcaptcha_name_list:
parser_mtcaptcha = subparsers.add_parser(parser_mtcaptcha_name, help='Solve MTCaptcha')
parser_mtcaptcha.add_argument('-u', '--websiteURL', required=True, help='Web address of the website using generally it’s fixed value. (Ex: https://google.com)')
parser_mtcaptcha.add_argument('-k', '--websiteKey', required=True, help='The domain public key, rarely updated. (Ex: sk=MTPublic-xxx public key)')
parser_mtcaptcha.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_mtcaptcha.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# DatadomeSliderTask
parser_datadome_slider = subparsers.add_parser('DatadomeSliderTask', help='Solve DataDome')
parser_datadome_slider.add_argument('-u', '--captchaUrl', required=True, help='If the url contains t=bv that means that your ip must be banned, t should be t=fe')
parser_datadome_slider.add_argument('-a', '--userAgent', required=False, help='It needs to be the same as the userAgent you use to request the website. Currently we only support the following userAgent')
parser_datadome_slider.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_datadome_slider.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# AntiAwsWafTask
# AntiAwsWafTaskProxyLess
parser_aws_waf_name_list = ['AntiAwsWafTask', 'AntiAwsWafTaskProxyLess']
for parser_aws_waf_name in parser_aws_waf_name_list:
parser_aws_waf = subparsers.add_parser(parser_aws_waf_name, help='Solve AWS WAF')
parser_aws_waf.add_argument('-u', '--websiteURL', required=True, help='Web address of the website using generally it’s fixed value. (Ex: https://google.com)')
parser_aws_waf.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_aws_waf.add_argument('-k', '--awsKey', required=False, help='The key value returned by the captcha page')
parser_aws_waf.add_argument('-i', '--awsIv', required=False, help='The iv value returned by the captcha page')
parser_aws_waf.add_argument('-c', '--awsContext', required=False, help='The context value returned by the captcha page')
parser_aws_waf.add_argument('-cj', '--awsChallengeJS', required=False, help='The challenge.js link returned by the captcha page')
parser_aws_waf.add_argument('-aj', '--awsApiJs', required=False, help='The jsapi.js link returned by the captcha page')
parser_aws_waf.add_argument('-pu', '--awsProblemUrl', required=False, help='The problem endpoint url containing keywords like problem, num_solutions_required, etc.')
parser_aws_waf.add_argument('-ak', '--awsApiKey', required=False, help='The api_key value of the problem endpoint')
parser_aws_waf.add_argument('-et', '--awsExistingToken', required=False, help='The aws-waf-token used for the last verification')
parser_aws_waf.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# AntiTurnstileTaskProxyLess
parser_anti_turnstile_task_proxyless = subparsers.add_parser('AntiTurnstileTaskProxyLess', help='Solve Cloudflare Turnstile')
parser_anti_turnstile_task_proxyless.add_argument('-u', '--websiteURL', required=True, help='The address of the target page')
parser_anti_turnstile_task_proxyless.add_argument('-k', '--websiteKey', required=True, help='Turnstile website key')
parser_anti_turnstile_task_proxyless.add_argument('-a', '--action', required=False, help='The value of the data-action attribute of the Turnstile element if it exists')
parser_anti_turnstile_task_proxyless.add_argument('-c', '--cdata', required=False, help='The value of the data-cdata attribute of the Turnstile element if it exists')
parser_anti_turnstile_task_proxyless.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
# AntiCloudflareTask
parser_anti_cloudflare_task = subparsers.add_parser('AntiCloudflareTask', help='Solve Cloudflare Challenge (5-second shield)')
parser_anti_cloudflare_task.add_argument('-u', '--websiteURL', required=True, help='The address of the target page')
parser_anti_cloudflare_task.add_argument('-p', '--proxy', required=False, help='Learn Using proxies: https://docs.capsolver.com/guide/api-how-to-use-proxy/')
parser_anti_cloudflare_task.add_argument('-a', '--userAgent', required=False, help='The user-agent you used to request the target website. Only Chrome’s userAgent is supported')
parser_anti_cloudflare_task.add_argument('-t', '--html', required=False, help='The response of requesting the target website, it usually contains "Just a moment…" and status code is 403. we need this html for some websites, please be sure to use your sticky proxy to dynamically scrape the HTML every time')
parser_anti_cloudflare_task.add_argument('-r', '--max-retries', type=int, default=60, help='Maximum number of retries')
args = parser.parse_args()
if not args.command:
parser.print_help()
sys.exit(1)
try:
solver = CapSolver()
solution = solver.solve(args)
print(json.dumps(solution, indent=2))
except Exception as e:
print('Solve failed:', e)
sys.exit(1)
if __name__ == "__main__":
main()