A Python library to solve reCAPTCHA v3 for Google Labs Flow projects
Project description
Flow Captcha Solver
A Python library to solve reCAPTCHA v3 for Google Labs Flow projects.
Features
- Multi-browser pool - Run multiple browsers in parallel
- Auto-switching - Automatically switch to another browser on failure
- Auto-reset - Reset browser with new fingerprint after consecutive failures
- Random fingerprint - User-Agent, Viewport, Timezone randomization
- API feedback - Report success/failure to adjust browser selection
- Both sync and async APIs
Installation
pip install flow-captcha-solver
playwright install chromium
Quick Start
Simple Usage (Sync)
from flow_captcha_solver import get_token_sync
token = get_token_sync("your-project-id")
if token:
print(f"Token: {token[:50]}...")
With Manager (Recommended)
from flow_captcha_solver import FlowCaptchaManager
# Get singleton instance
manager = FlowCaptchaManager.get_instance()
# Start with 2 browsers
manager.start(num_browsers=2)
# Get token
token = manager.get_token_sync("your-project-id")
if token:
# Use token with your API...
api_response = call_your_api(token)
if api_response.success:
manager.report_success() # Reset failure counter
else:
manager.report_failure("Token rejected") # Increment counter
else:
manager.report_failure("No token")
# Check status
print(manager.get_status())
# {'browsers': [{'id': 0, 'failures': 0, 'resets': 1}, {'id': 1, 'failures': 2, 'resets': 0}]}
# Stop when done
manager.stop()
Async Usage
import asyncio
from flow_captcha_solver import FlowCaptchaPool
async def main():
async with FlowCaptchaPool(num_browsers=2) as pool:
token = await pool.get_token("your-project-id")
if token:
print(f"Token: {token[:50]}...")
pool.report_success()
else:
pool.report_failure("Failed")
asyncio.run(main())
Single Browser (Async)
from flow_captcha_solver import BrowserInstance
async def main():
async with BrowserInstance(headless=True) as browser:
token, error = await browser.get_token("your-project-id")
if token:
print(f"Token: {token}")
else:
print(f"Error: {error}")
Configuration
Default configuration can be imported and modified:
from flow_captcha_solver import MAX_CONSECUTIVE_FAILURES
# Default: 3 failures before auto-reset
print(MAX_CONSECUTIVE_FAILURES)
How It Works
- Browser Pool: Creates multiple Chromium browser instances using Playwright
- Stealth Mode: Injects scripts to avoid bot detection (hide webdriver, fake plugins, etc.)
- Load Page: Navigates to Google Labs Flow project page
- Inject reCAPTCHA: Loads reCAPTCHA v3 script if not present
- Execute: Calls
grecaptcha.execute()to get token - Auto-Reset: If browser fails 3 times consecutively, it resets with new fingerprint
API Reference
FlowCaptchaManager
| Method | Description |
|---|---|
get_instance(headless=True) |
Get singleton instance |
start(num_browsers=2) |
Start service with N browsers |
get_token_sync(project_id) |
Get token (blocking) |
report_success() |
Report API success |
report_failure(reason) |
Report API failure |
get_status() |
Get pool status |
stop() |
Stop service |
FlowCaptchaPool
| Method | Description |
|---|---|
initialize() |
Initialize all browsers |
get_token(project_id) |
Get token (async) |
report_success() |
Report API success |
report_failure(reason) |
Report API failure |
get_status() |
Get pool status |
close() |
Close all browsers |
BrowserInstance
| Method | Description |
|---|---|
initialize() |
Initialize browser |
get_token(project_id) |
Get token (returns tuple) |
mark_api_success() |
Mark API success |
mark_api_failure(reason) |
Mark API failure |
reset() |
Reset with new fingerprint |
close() |
Close browser |
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flow_captcha_solver-1.0.1.tar.gz
(14.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flow_captcha_solver-1.0.1.tar.gz.
File metadata
- Download URL: flow_captcha_solver-1.0.1.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c894937ce4e49881600357908b0e639972c0efb0fb6936dc84e9d9e704c1d9
|
|
| MD5 |
0dfe98bb36920c12eb8fd9ee4ea622c8
|
|
| BLAKE2b-256 |
7339630edad15bb1535842b7b996daabc62f6f3db43697a0ebde94ef5e6fd5b7
|
File details
Details for the file flow_captcha_solver-1.0.1-py3-none-any.whl.
File metadata
- Download URL: flow_captcha_solver-1.0.1-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
532cd367d0358f5183be14d27e54f6956081a66446fdd8cb7fd892c26fcca332
|
|
| MD5 |
0ba64b86a37b42d95d798147e99e1b7e
|
|
| BLAKE2b-256 |
4c0dca6dc8c34915ce434293c9f5399e32f476f9028662dd9544298eef42b09c
|