Skip to main content

hCaptcha

Beta Feature

hCaptcha solving is currently in beta and works best with checkbox variations. Enterprise hCaptcha solving support will be added soon.

Overview

Surfskyprovides automated hCaptcha solving capabilities through the CDP API. This feature uses AI-powered visual recognition to solve hCaptcha challenges automatically.

Prerequisites

Gemini API Key

To use the hCaptcha solver, you'll need a Google Gemini API key:

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy your API key for use in the solver
caution

Keep your API key secure and never commit it to version control. Use environment variables or secure configuration management.

Basic Usage

The hCaptcha solver is accessed through the CDP API using the Captcha.solve method. Here's how to implement it:

import asyncio
from playwright.async_api import async_playwright

async def solve_hcaptcha_example():
async with async_playwright() as p:
# ...
page = browser.contexts[0].pages[0]

# Create CDP session
client = await page.context.new_cdp_session(page)

# Navigate to page with hCaptcha
await page.goto("https://example.com/hcaptcha-page", wait_until="load")

# Set up event listeners
def on_solve_finished(params):
print(f"hCaptcha solved successfully: {params}")

def on_solve_failed(params):
print(f"hCaptcha solving failed: {params}")

client.on("Captcha.solveFinished", on_solve_finished)
client.on("Captcha.solveFailed", on_solve_failed)

# Trigger hCaptcha solving
print("Sending Captcha.solve command...")
await client.send("Captcha.solve", {
"type": "hcaptcha",
"options": {
"gemini_api_key": "YOUR_GEMINI_API_KEY_HERE"
}
})

# ...
await browser.close()

# Run the example
asyncio.run(solve_hcaptcha_example())