import requests
import time
API_KEY = "YOUR_API_KEY"
API_URL = "https://captcha.vast.sh/api/solver"
# Create a new task
task_data = {
"clientKey": API_KEY,
"task": {
"type": "RecaptchaV2Task",
"websiteURL": "https://example.com/recaptcha",
"websiteKey": "6LcR_TAUAAAAAMtflUgIXnBu1ldPGo8YlHXKA0fy"
}
}
response = requests.post(f"{API_URL}/createTask", json=task_data)
task_id = response.json()["taskId"]
# Wait for the result
while True:
result_data = {
"clientKey": API_KEY,
"taskId": task_id
}
response = requests.post(f"{API_URL}/getTaskResult", json=result_data)
result = response.json()
if result.get("status") == "ready":
print(f"Captcha solved: {result.get('solution', {}).get('gRecaptchaResponse')}")
break
print("Waiting for solution...")
time.sleep(3)