import re
def detect_captcha_type(page_source, page_url=""):
"""Detect CAPTCHA type from page HTML and return recommended method."""
checks = [
(r'data-sitekey.*cf-turnstile|class=["\']cf-turnstile', "turnstile"),
(r'challenge-platform.*managed|cf-chl-widget', "cloudflare_challenge"),
(r'data-sitekey.*h-captcha|class=["\']h-captcha', "hcaptcha"),
(r'initGeetest4|captcha_id', "geetest_v4"),
(r'initGeetest|gt=\w{32}', "geetest_v3"),
(r'data-sitekey.*recaptcha|grecaptcha|recaptcha/api', "recaptcha"),
(r'bls.*captcha|captcha.*bls', "bls"),
(r'captcha.*img|img.*captcha|captchaImage', "image_ocr"),
]
for pattern, captcha_type in checks:
if re.search(pattern, page_source, re.IGNORECASE):
return captcha_type
return "unknown"
# Usage
captcha_type = detect_captcha_type(page_html)
print(f"Detected: {captcha_type}")
FAQ
Does CaptchaAI support all reCAPTCHA versions?
Yes — v2 checkbox, v2 invisible, v3 score-based, and Enterprise are all supported with the same userrecaptcha method.
What's the fastest CAPTCHA type to solve?
Image/OCR CAPTCHAs typically solve in 5-15 seconds. Turnstile and GeeTest are the fastest among token-based types.
Can I solve multiple CAPTCHA types in one project?
Yes. Use the type detection helper above to identify the CAPTCHA, then submit with the appropriate method parameter. CaptchaAI handles routing internally.
Compare AI-powered Captcha AI with human CAPTCHA solving services on speed, accuracy, cost, scalability, and r...
Jan 17, 2026
Reference
End-to-end guide covering CAPTCHA fundamentals, solving approaches, API integration, error handling, scaling, and production deployment with Captcha AI.
One-page API reference for Captcha AI — every endpoint, parameter, response format, and error code in a single...
Mar 05, 2026
Troubleshooting
A practical debugging system for sitekey, page URL, polling, token injection, callback, timeout, and browser-state failures when Captcha AI returns a valid-look...