diff --git a/README.md b/README.md
index 17258e7..22a691b 100644
--- a/README.md
+++ b/README.md
@@ -1,108 +1,111 @@
-# Google Recaptcha Solver
+# reCAPTCHA Bypass
-**We love bots ❤️, but Google doesn't.** So, here is the solution to bypass Google reCAPTCHA.
+This project provides a solution to automatically solve Google's reCAPTCHA using SeleniumBase. The solver handles both the initial checkbox challenge and the audio CAPTCHA challenge.
-Solve Google reCAPTCHA less than 5 seconds! 🚀
-This is a Python script to solve Google reCAPTCHA using the DrissionPage library. *~~Selenium implementation will be added soon.~~*
+## Table of Contents
-## Recent Updates
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+- [Code Structure](#code-structure)
+- [Credits](#credits)
-Good news! Selenium implementation is added. Thanks to [@obaskly](https://github.com/obaskly) for the contribution. Check out the [selenium branch](https://github.com/sarperavci/GoogleRecaptchaBypass/tree/selenium) for more details.
-## Sponsors
+## Features
-### Nstproxy
+- Automatically solves Google's reCAPTCHA challenges.
+- Uses asynchronous downloading to speed up audio CAPTCHA processing.
+- Converts audio files to text using Google Speech Recognition.
+- Checks if the reCAPTCHA is solved with just a click before proceeding to the bypass technique.
-[](https://www.nstproxy.com/?type=flow&utm_source=sarperavci)
-If you're looking for a reliable proxy to **bypass anti-bot systems, scrape at scale, and access geo-restricted data without blocks**, Nstproxy is built for you. Perfect for large-scale web scraping, SEO monitoring, e-commerce data collection, price intelligence, and automation — even under the strictest anti-scraping protections.
-
-Nstproxy offers a global pool of residential, datacenter, and IPv6 proxies with rotating or sticky sessions, advanced anti-block tech, and pricing from $0.1/GB for maximum uptime and ROI.
-
-**Key Features:**
-
-* 🌍 **Global IP Coverage** – 110M+ residential IPs, 195+ countries, IPv4/IPv6
-* 🔄 **Rotation Control** – Per request or sticky sessions for consistent sessions
-* 🛡 **Anti-ban & CAPTCHA Bypass** – Designed for high scraping success rates
-* 💰 **Affordable** – From $0.1/GB, far below market average
-* ⚡ **Multi-purpose** – Scraping, SEO, automation, e-commerce, analytics
-* 🔌 **Easy Integration** – Python, Puppeteer, Playwright, Node.js
-* 📈 **Unlimited Scaling** – Handle any volume with stable performance
-
-An all-in-one proxy solution for developers and traders who need reliability, scalability, and cost efficiency.
- 👉 Learn more: [Nstproxy.com](https://www.nstproxy.com/?type=flow&utm_source=sarperavci): [https://www.nstproxy.com/?type=flow\&utm\_source=sarperavci](https://www.nstproxy.com/?type=flow&utm_source=sarperavci) | [Dashboard](https://app.nstproxy.com/?utm_source=sarperavci)
-
-Telegram:[https://t.me/nstproxy](https://t.me/nstproxy)
-
-Discord: [https://discord.gg/5jjWCAmvng](https://discord.gg/5jjWCAmvng)
-
-Use code: **RECAPTCHA get 10% OFF**
-
-### Scrapeless
-
-[](https://www.scrapeless.com/en/product/scraping-browser?utm_source=github&utm_campaign=sarperavci)
-
-[**Scrapeless Browser**](https://www.scrapeless.com/en/product/scraping-browser?utm_source=github&utm_campaign=sarperavci) is a cloud-based, Chromium-powered headless browser cluster. It allows developers to run large-scale, low-cost concurrent browser instances and reliably handle complex interactions on protected pages. Ideal for AI infrastructure, web automation, data scraping, page rendering, automated testing, and other tasks that require a real browser environment.
-**Key Advantages of Scrapeless Browser:**
+## Installation
-* **Built-in CAPTCHA solving:** Automatically bypasses Cloudflare Turnstile, reCAPTCHA, AWS WAF, DataDome, and other challenge systems.
-* **Undetectable browser environment:** Not based on the traditional WebDriver — avoids automation detection.
-* **Massive concurrency support:** Run 50–10,000+ browser instances simultaneously with no server constraints.
-* **Real-time debugging:** Live View and session recording for efficient troubleshooting.
-* **Native integration:** Compatible with Puppeteer, Playwright, Python, and Node.js — easy to integrate into your current workflows.
-* **70M+ residential IPs:** Global proxy network with automatic rotation and smart geolocation routing.
+1. **Clone the Repository**
-In terms of cost, Scrapeless browser usage is only 1/8 of Browserbase, significantly cutting overall expenses.
-It also offers a [**Scraping API**](https://www.scrapeless.com/en/product/scraping-api?utm_source=github&utm_campaign=sarperavci)**、[Deep SerpApi](https://www.scrapeless.com/en/product/deep-serp-api?utm_source=github&utm_campaign=sarperavci) and [Proxies](https://www.scrapeless.com/en/product/proxies?utm_source=github&utm_campaign=sarperavci) services**.
-👉 Learn more: [Scrapeless Browser](https://www.scrapeless.com/en/product/scraping-browser?utm_source=github&utm_campaign=sarperavci) | [Documentation](https://docs.scrapeless.com/en/scraping-browser/quickstart/introduction/?utm_source=github&utm_campaign=sarperavci)
+```
+git clone https://github.com/desis123/GoogleRecaptchaBypass
+cd RecaptchaBypass
+```
+2. **Install Dependencies**
-## Installation
-Three dependencies are required to run this script. You can install them using the following command:
-```bash
+```
pip install -r requirements.txt
```
-Also, you need to install ffmpeg. You can download it from [here](https://ffmpeg.org/download.html).
+3. **Install FFmpeg**
-```bash
-sudo apt-get install ffmpeg
-```
+- Linux:
+
+ ```
+ sudo apt-get update
+ sudo apt-get install ffmpeg
+ ```
+
+- Windows:
+
+ Follow this tutorial: https://www.wikihow.com/Install-FFmpeg-on-Windows
## Usage
To implement this script in your project, you can follow a similar approach as shown below:
```python
-from DrissionPage import ChromiumPage
+from seleniumbase import SB
from RecaptchaSolver import RecaptchaSolver
-driver = ChromiumPage()
-recaptchaSolver = RecaptchaSolver(driver)
-driver.get("https://www.google.com/recaptcha/api2/demo")
-recaptchaSolver.solveCaptcha()
+import time
+
+# Configure SeleniumBase with equivalent options
+with SB(
+ uc=True, # Undetected mode (helps with automation detection)
+ incognito=True, # Equivalent to --incognito
+ xvfb=True, # Set to False if you dont want xvfb or headed to True to turn off headless
+ disable_csp=True, # Additional protection against detection
+ disable_ws=True, # Disable web security
+ chromium_arg="--disable-dev-shm-usage,--no-sandbox,--log-level=3,--no-proxy-server"
+) as sb:
+
+ # Navigate to the reCAPTCHA demo page
+ sb.open("https://www.google.com/recaptcha/api2/demo")
+
+ # Initialize the RecaptchaSolver
+ recaptchaSolver = RecaptchaSolver(sb)
+
+ try:
+ # Perform CAPTCHA solving with timing
+ t0 = time.time()
+ recaptchaSolver.solveCaptcha()
+ elapsed_time = time.time() - t0
+ print(f"Time to solve the captcha: {elapsed_time:.2f} seconds")
+
+ # Optional: Submit the form to verify it worked
+ sb.click('#recaptcha-demo-submit')
+ sb.sleep(2)
+
+ # Check for success message
+ if sb.is_text_visible("Verification Success"):
+ print("✓ CAPTCHA verification successful!")
+
+ except Exception as e:
+ print(f"An error occurred: {e}")
```
I have created `test.py` to demonstrate the usage of this script. You can run the `test.py` file to see the script in action.
+
+ python test.py
+
-## Demo
+## Code Structure
-
+- `RecaptchaSolver.py`: Contains the `RecaptchaSolver` class with methods to solve the reCAPTCHA.
+- `test.py`: Example usage of the `RecaptchaSolver` class.
-
-## How does it work?
-We automate the browser to solve the reCAPTCHA. Instead of image captcha, we are solving the audio captcha. The audio captcha is easier to solve programmatically.
-**One warning:** Google may block your IP if you solve too many captchas in a short period of time. So, use this script wisely or change your IP frequently.
-## Star History
+## Credits
-
-
-
-
-
-
-
+This project was inspired by and uses techniques from [sarperavci/GoogleRecaptchaBypass](https://github.com/sarperavci/GoogleRecaptchaBypass).
diff --git a/RecaptchaSolver.py b/RecaptchaSolver.py
index 4faa7b2..605af0d 100644
--- a/RecaptchaSolver.py
+++ b/RecaptchaSolver.py
@@ -1,138 +1,117 @@
import os
-import urllib.request
import random
-import pydub
-import speech_recognition
+import asyncio
+import aiohttp
import time
-from typing import Optional
-from DrissionPage import ChromiumPage
-
+from pydub import AudioSegment
+import speech_recognition as sr
class RecaptchaSolver:
- """A class to solve reCAPTCHA challenges using audio recognition."""
-
- # Constants
- TEMP_DIR = os.getenv("TEMP") if os.name == "nt" else "/tmp"
- TIMEOUT_STANDARD = 7
- TIMEOUT_SHORT = 1
- TIMEOUT_DETECTION = 0.05
-
- def __init__(self, driver: ChromiumPage) -> None:
- """Initialize the solver with a ChromiumPage driver.
-
- Args:
- driver: ChromiumPage instance for browser interaction
- """
- self.driver = driver
-
- def solveCaptcha(self) -> None:
- """Attempt to solve the reCAPTCHA challenge.
-
- Raises:
- Exception: If captcha solving fails or bot is detected
- """
-
- # Handle main reCAPTCHA iframe
- self.driver.wait.ele_displayed(
- "@title=reCAPTCHA", timeout=self.TIMEOUT_STANDARD
- )
- time.sleep(0.1)
- iframe_inner = self.driver("@title=reCAPTCHA")
-
- # Click the checkbox
- iframe_inner.wait.ele_displayed(
- ".rc-anchor-content", timeout=self.TIMEOUT_STANDARD
- )
- iframe_inner(".rc-anchor-content", timeout=self.TIMEOUT_SHORT).click()
-
- # Check if solved by just clicking
- if self.is_solved():
- return
-
- # Handle audio challenge
- iframe = self.driver("xpath://iframe[contains(@title, 'recaptcha')]")
- iframe.wait.ele_displayed(
- "#recaptcha-audio-button", timeout=self.TIMEOUT_STANDARD
- )
- iframe("#recaptcha-audio-button", timeout=self.TIMEOUT_SHORT).click()
- time.sleep(0.3)
-
- if self.is_detected():
- raise Exception("Captcha detected bot behavior")
-
- # Download and process audio
- iframe.wait.ele_displayed("#audio-source", timeout=self.TIMEOUT_STANDARD)
- src = iframe("#audio-source").attrs["src"]
+ def __init__(self, sb):
+ self.sb = sb
- try:
- text_response = self._process_audio_challenge(src)
- iframe("#audio-response").input(text_response.lower())
- iframe("#recaptcha-verify-button").click()
- time.sleep(0.4)
+ async def download_audio(self, url, path):
+ async with aiohttp.ClientSession() as session:
+ async with session.get(url) as response:
+ with open(path, 'wb') as f:
+ f.write(await response.read())
+ print("Downloaded audio asynchronously.")
- if not self.is_solved():
- raise Exception("Failed to solve the captcha")
+ def solveCaptcha(self):
+ try:
+ # Switch to the CAPTCHA iframe
+ self.sb.switch_to_frame('iframe[title*="reCAPTCHA"]')
+
+ # Click on the CAPTCHA box
+ self.sb.click('#recaptcha-anchor')
+
+ # Check if the CAPTCHA is solved
+ time.sleep(1) # Allow some time for the state to update
+ if self.isSolved():
+ print("CAPTCHA solved by clicking.")
+ self.sb.switch_to_default_content()
+ return
+
+ # If not solved, attempt audio CAPTCHA solving
+ self.solveAudioCaptcha()
except Exception as e:
- raise Exception(f"Audio challenge failed: {str(e)}")
+ print(f"An error occurred while solving CAPTCHA: {e}")
+ self.sb.switch_to_default_content()
+ raise
- def _process_audio_challenge(self, audio_url: str) -> str:
- """Process the audio challenge and return the recognized text.
-
- Args:
- audio_url: URL of the audio file to process
+ def solveAudioCaptcha(self):
+ try:
+ self.sb.switch_to_default_content()
+
+ # Switch to the audio CAPTCHA iframe
+ self.sb.switch_to_frame('iframe[title*="recaptcha challenge expires in two minutes"]')
+
+ # Click on the audio button
+ self.sb.click('#recaptcha-audio-button')
+
+ # Get the audio source URL
+ audio_source = self.sb.get_attribute('#audio-source', 'src')
+ print(f"Audio source URL: {audio_source}")
+
+ # Download the audio to the temp folder asynchronously
+ temp_dir = os.getenv("TEMP") if os.name == "nt" else "/tmp/"
+ path_to_mp3 = os.path.normpath(os.path.join(temp_dir, f"{random.randrange(1, 1000)}.mp3"))
+ path_to_wav = os.path.normpath(os.path.join(temp_dir, f"{random.randrange(1, 1000)}.wav"))
+
+ asyncio.run(self.download_audio(audio_source, path_to_mp3))
+
+ # Convert mp3 to wav
+ sound = AudioSegment.from_mp3(path_to_mp3)
+ sound.export(path_to_wav, format="wav")
+ print("Converted MP3 to WAV.")
+
+ # Recognize the audio
+ recognizer = sr.Recognizer()
+ with sr.AudioFile(path_to_wav) as source:
+ audio = recognizer.record(source)
+ captcha_text = recognizer.recognize_google(audio).lower()
+ print(f"Recognized CAPTCHA text: {captcha_text}")
- Returns:
- str: Recognized text from the audio file
- """
- mp3_path = os.path.join(self.TEMP_DIR, f"{random.randrange(1,1000)}.mp3")
- wav_path = os.path.join(self.TEMP_DIR, f"{random.randrange(1,1000)}.wav")
+ # Enter the CAPTCHA text
+ self.sb.type('#audio-response', captcha_text)
+ self.sb.press_keys('#audio-response', '\n')
+ print("Entered and submitted CAPTCHA text.")
- try:
- urllib.request.urlretrieve(audio_url, mp3_path)
- sound = pydub.AudioSegment.from_mp3(mp3_path)
- sound.export(wav_path, format="wav")
+ # Wait for CAPTCHA to be processed
+ time.sleep(0.8)
- recognizer = speech_recognition.Recognizer()
- with speech_recognition.AudioFile(wav_path) as source:
- audio = recognizer.record(source)
+ # Verify CAPTCHA is solved
+ if self.isSolved():
+ print("Audio CAPTCHA solved.")
+ else:
+ print("Failed to solve audio CAPTCHA.")
+ raise Exception("Failed to solve CAPTCHA")
- return recognizer.recognize_google(audio)
+ except Exception as e:
+ print(f"An error occurred while solving audio CAPTCHA: {e}")
+ self.sb.switch_to_default_content()
+ raise
finally:
- for path in (mp3_path, wav_path):
- if os.path.exists(path):
- try:
- os.remove(path)
- except OSError:
- pass
-
- def is_solved(self) -> bool:
- """Check if the captcha has been solved successfully."""
- try:
- return (
- "style"
- in self.driver.ele(
- ".recaptcha-checkbox-checkmark", timeout=self.TIMEOUT_SHORT
- ).attrs
- )
- except Exception:
- return False
-
- def is_detected(self) -> bool:
- """Check if the bot has been detected."""
- try:
- return (
- self.driver.ele("Try again later", timeout=self.TIMEOUT_DETECTION)
- .states()
- .is_displayed
- )
- except Exception:
- return False
-
- def get_token(self) -> Optional[str]:
- """Get the reCAPTCHA token if available."""
+ # Always switch back to the main content
+ self.sb.switch_to_default_content()
+
+ def isSolved(self):
try:
- return self.driver.ele("#recaptcha-token").attrs["value"]
- except Exception:
- return None
\ No newline at end of file
+ # Switch back to the default content
+ self.sb.switch_to_default_content()
+
+ # Switch to the reCAPTCHA iframe
+ self.sb.switch_to_frame('iframe[title*="reCAPTCHA"]')
+
+ # Check if the checkbox is checked
+ aria_checked = self.sb.get_attribute('#recaptcha-anchor', 'aria-checked')
+ checkbox_class = self.sb.get_attribute('#recaptcha-anchor', 'class')
+
+ # Return True if the aria-checked attribute is "true" or the checkbox has the 'recaptcha-checkbox-checked' class
+ return aria_checked == "true" or 'recaptcha-checkbox-checked' in checkbox_class
+
+ except Exception as e:
+ print(f"An error occurred while checking if CAPTCHA is solved: {e}")
+ return False
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 2817fb0..29db464 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,4 @@
-DrissionPage
+seleniumbase
pydub
-SpeechRecognition
\ No newline at end of file
+SpeechRecognition
+aiohttp
\ No newline at end of file
diff --git a/test.py b/test.py
index 988e8c6..66583d0 100644
--- a/test.py
+++ b/test.py
@@ -1,39 +1,65 @@
-from DrissionPage import ChromiumPage, ChromiumOptions
+from seleniumbase import SB
from RecaptchaSolver import RecaptchaSolver
import time
-CHROME_ARGUMENTS = [
- "-no-first-run",
- "-force-color-profile=srgb",
- "-metrics-recording-only",
- "-password-store=basic",
- "-use-mock-keychain",
- "-export-tagged-pdf",
- "-no-default-browser-check",
- "-disable-background-mode",
- "-enable-features=NetworkService,NetworkServiceInProcess",
- "-disable-features=FlashDeprecationWarning",
- "-deny-permission-prompts",
- "-disable-gpu",
- "-accept-lang=en-US",
- "--disable-usage-stats",
- "--disable-crash-reporter",
- "--no-sandbox"
-]
-
-options = ChromiumOptions()
-for argument in CHROME_ARGUMENTS:
- options.set_argument(argument)
+# Configure SeleniumBase with equivalent options
+with SB(
+ uc=True, # Undetected mode (helps with automation detection)
+ incognito=True, # Equivalent to --incognito
+ xvfb=True, # Set to False if you dont want xvfb or headed to True to turn off headless
+ disable_csp=True, # Additional protection against detection
+ disable_ws=True, # Disable web security
+ chromium_arg="--disable-dev-shm-usage,--no-sandbox,--log-level=3,--no-proxy-server"
+) as sb:
-driver = ChromiumPage(addr_or_opts=options)
-recaptchaSolver = RecaptchaSolver(driver)
-
-driver.get("https://www.google.com/recaptcha/api2/demo")
+ # Navigate to the reCAPTCHA demo page
+ sb.open("https://www.google.com/recaptcha/api2/demo")
+
+ # Initialize the RecaptchaSolver
+ recaptchaSolver = RecaptchaSolver(sb)
+
+ try:
+ # Perform CAPTCHA solving with timing
+ t0 = time.time()
+ recaptchaSolver.solveCaptcha()
+ elapsed_time = time.time() - t0
+ print(f"Time to solve the captcha: {elapsed_time:.2f} seconds")
+
+ # Optional: Submit the form to verify it worked
+ sb.click('#recaptcha-demo-submit')
+ sb.sleep(2)
+
+ # Check for success message
+ if sb.is_text_visible("Verification Success"):
+ print("✓ CAPTCHA verification successful!")
+
+ except Exception as e:
+ print(f"An error occurred: {e}")
-t0 = time.time()
-recaptchaSolver.solveCaptcha()
-print(f"Time to solve the captcha: {time.time()-t0:.2f} seconds")
+# Alternative: Using BaseCase class structure (for pytest integration)
+from seleniumbase import BaseCase
-driver.ele("#recaptcha-demo-submit").click()
+class RecaptchaTest(BaseCase):
+ def test_solve_captcha(self):
+ # Set Chrome options
+ self.open("https://www.google.com/recaptcha/api2/demo")
+
+ # Initialize solver
+ recaptchaSolver = RecaptchaSolver(self)
+
+ try:
+ t0 = time.time()
+ recaptchaSolver.solveCaptcha()
+ elapsed_time = time.time() - t0
+ print(f"Time to solve the captcha: {elapsed_time:.2f} seconds")
+
+ # Verify solution
+ self.click('#recaptcha-demo-submit')
+ self.sleep(2)
+ self.assert_text("Verification Success")
+
+ except Exception as e:
+ print(f"An error occurred: {e}")
+ raise
-driver.close()
+# Run with: pytest test_recaptcha.py --uc --incognito -s
\ No newline at end of file