Die API von CaptchaAI folgt dem gleichen request/response-Format, das von 2Captcha verwendet wird. Wenn Ihr Code bereits in 2Captcha integriert ist, können Sie zu CaptchaAI wechseln, indem Sie die Basis-URL und den API-Schlüssel ändern – es sind keine weiteren Codeänderungen erforderlich.
2Captcha-Kompatibilität
CaptchaAI verwendet dieselbe Endpunktstruktur und dieselben Parameternamen wie 2Captcha:
| Endpunkt | 2Captcha | CaptchaAI |
|---|---|---|
| Senden | https://2captcha.com/in.php |
https://ocr.captchaai.com/in.php |
| Ergebnis | https://2captcha.com/res.php |
https://ocr.captchaai.com/res.php |
| API-Schlüsselparameter | key |
key |
| Antwortformat | status + request |
status + request |
Parameter wie method, googlekey, pageurl, json, proxy, proxytype, action sind identisch.
Wechsel von 2Captcha: Einzeiliger Wechsel
Python
# Before
BASE_URL = "https://2captcha.com"
# After
BASE_URL = "https://ocr.captchaai.com"
Ihr bestehender Absende- und Umfragecode funktioniert ohne weitere Änderungen:
import requests
import time
API_KEY = "YOUR_CAPTCHAAI_KEY"
BASE_URL = "https://ocr.captchaai.com" # changed from 2captcha.com
# Submit — identical parameters
resp = requests.post(f"{BASE_URL}/in.php", data={
"key": API_KEY,
"method": "userrecaptcha",
"googlekey": "6Le-SITEKEY",
"pageurl": "https://example.com",
"json": "1",
}).json()
task_id = resp["request"]
# Poll — identical parameters
for _ in range(24):
time.sleep(5)
result = requests.get(f"{BASE_URL}/res.php", params={
"key": API_KEY, "action": "get", "id": task_id, "json": "1"
}).json()
if result["status"] == 1:
print(f"Token: {result['request'][:50]}...")
break
JavaScript
// Before
const BASE_URL = 'https://2captcha.com';
// After
const BASE_URL = 'https://ocr.captchaai.com';
// Everything else stays the same
AntiCaptcha-Adapter
AntiCaptcha verwendet ein anderes API-Format (JSON-basiert). Erstellen Sie einen Adapter, der AntiCaptcha-Aufrufe in CaptchaAI übersetzt:
import requests
import time
API_KEY = "YOUR_CAPTCHAAI_KEY"
class AntiCaptchaAdapter:
"""Translates AntiCaptcha-style calls to CaptchaAI API."""
def __init__(self, api_key):
self.api_key = api_key
self.base = "https://ocr.captchaai.com"
def createTask(self, task):
"""AntiCaptcha-compatible createTask."""
task_type = task.get("type", "")
data = {"key": self.api_key, "json": "1"}
if "Recaptcha" in task_type:
data["method"] = "userrecaptcha"
data["googlekey"] = task.get("websiteKey", "")
data["pageurl"] = task.get("websiteURL", "")
if task.get("isInvisible"):
data["invisible"] = "1"
elif "Image" in task_type:
data["method"] = "base64"
data["body"] = task.get("body", "")
elif "Turnstile" in task_type:
data["method"] = "turnstile"
data["sitekey"] = task.get("websiteKey", "")
data["pageurl"] = task.get("websiteURL", "")
resp = requests.post(f"{self.base}/in.php", data=data).json()
if resp["status"] != 1:
return {"errorId": 1, "errorDescription": resp["request"]}
return {"errorId": 0, "taskId": resp["request"]}
def getTaskResult(self, task_id):
"""AntiCaptcha-compatible getTaskResult."""
resp = requests.get(f"{self.base}/res.php", params={
"key": self.api_key,
"action": "get",
"id": task_id,
"json": "1",
}).json()
if resp["request"] == "CAPCHA_NOT_READY":
return {"status": "processing"}
if resp["status"] == 1:
return {
"status": "ready",
"solution": {"gRecaptchaResponse": resp["request"]}
}
return {"errorId": 1, "errorDescription": resp["request"]}
def getBalance(self):
"""AntiCaptcha-compatible getBalance."""
resp = requests.get(f"{self.base}/res.php", params={
"key": self.api_key,
"action": "getbalance",
"json": "1",
}).json()
return {"balance": float(resp["request"])}
# Usage — same interface as AntiCaptcha
adapter = AntiCaptchaAdapter("YOUR_CAPTCHAAI_KEY")
result = adapter.createTask({
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://example.com",
"websiteKey": "6Le-SITEKEY",
})
task_id = result["taskId"]
while True:
time.sleep(5)
status = adapter.getTaskResult(task_id)
if status["status"] == "ready":
token = status["solution"]["gRecaptchaResponse"]
print(f"Token: {token[:50]}...")
break
Verwendung vorhandener 2Captcha SDK-Bibliotheken
In vielen 2Captcha SDK-Bibliotheken können Sie die Basis-URL konfigurieren:
Python (2captcha-python)
from twocaptcha import TwoCaptcha
solver = TwoCaptcha(
"YOUR_CAPTCHAAI_KEY",
server="ocr.captchaai.com" # redirect to CaptchaAI
)
result = solver.recaptcha(
sitekey="6Le-SITEKEY",
url="https://example.com"
)
print(result["code"][:50] + "...")
JavaScript (2captcha-javascript)
const Captcha = require('2captcha');
const solver = new Captcha.Solver('YOUR_CAPTCHAAI_KEY');
solver.apiBaseUrl = 'https://ocr.captchaai.com';
const result = await solver.recaptcha('6Le-SITEKEY', 'https://example.com');
console.log(result.data.substring(0, 50) + '...');
Kompatibilitätscheckliste
| Funktion | Kompatibel? |
|---|---|
| reCAPTCHA v2 | Ja |
| reCAPTCHA v3 | Ja |
| reCAPTCHA Enterprise | Ja |
| Cloudflare Turnstile | Ja |
| Bild/OCR | Ja |
| GeeTest v3 | Ja |
pingback (Webhook) |
Ja |
proxy / proxytype |
Ja |
reportbad / reportgood |
Ja |
getbalance |
Ja |
FAQ
Ist CaptchaAI buchstäblich dieselbe API wie 2Captcha?
CaptchaAI verwendet das gleiche in.php/res.php-Endpunktformat und die gleichen Parameternamen. Die Antwortstruktur ist identisch. Sie können wechseln, indem Sie die Basis-URL ändern.
Muss ich die Fehlerbehandlung ändern?
Nein. Fehlercodes wie ERROR_WRONG_USER_KEY, ERROR_ZERO_BALANCE und CAPCHA_NOT_READY verwenden dieselben Namen und dasselbe Format.
Kann ich bei Bedarf zurückwechseln?
Ja. Da die API kompatibel ist, ist das Zurückschalten auch eine einzeilige URL-Änderung.
Wechseln Sie zu CaptchaAI ohne Codeänderungen
Holen Sie sich Ihren API-Schlüssel unter captchaai.com.
Verwandte Leitfäden
- Von 2Captcha zu CaptchaAI wechseln
- API-Endpunktzuordnung: CaptchaAI im Vergleich zu Mitbewerbern
- Bester Vergleich der CAPTCHA-Lösungsdienste
Diskussionen (0)
Beteiligen Sie sich an der Unterhaltung
Melden Sie sich an, um Ihre Meinung zu teilen.
AnmeldenNoch keine Kommentare.