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.
Use Python's Thread Pool Executor for concurrent CAPTCHA solving — run multiple Captcha AI requests in paralle...
Jan 15, 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...
One-page API reference for Captcha AI — every endpoint, parameter, response format, and error code in a single...
Mar 05, 2026
DevOps & Scaling
Use NATS messaging for lightweight, high-performance CAPTCHA task distribution — publish tasks, distribute to workers, and collect results with Captcha AI.
Discussions (0)
Join the conversation
Sign in to share your opinion.
Sign InNo comments yet.