Skip to content

Fix #7: Auto-solve hCaptcha with integrated solver & retry logic - #42

Open
chfr19820610-cell wants to merge 1 commit into
flowese:mainfrom
chfr19820610-cell:fix/hcaptcha-issue-7
Open

Fix #7: Auto-solve hCaptcha with integrated solver & retry logic#42
chfr19820610-cell wants to merge 1 commit into
flowese:mainfrom
chfr19820610-cell:fix/hcaptcha-issue-7

Conversation

@chfr19820610-cell

Copy link
Copy Markdown

Summary

Fixes #7 - 500 Server Error caused by hCaptcha challenges on Udio API.

This PR adds a fully integrated hCaptcha auto-solving system that actually works end-to-end, unlike the existing open PRs (#36-40) which either don't integrate the solver or have incomplete implementations.

Changes

New: udio_wrapper/hcaptcha_solver.py

  • HCaptchaSolver class with full hCaptcha solving pipeline
  • Capsolver support (CAPSOLVER_API_KEY env var) - most reliable for hCaptcha
  • 2captcha support (CAPTCHA_API_KEY env var) - budget-friendly alternative
  • Manual token input fallback when no API key is configured
  • Dynamic sitekey extraction from Udio homepage (with fallback)
  • Token caching (110s TTL) to minimize API calls

Modified: udio_wrapper/__init__.py

  • make_request(): Automatic h-captcha-response header injection for POST requests
  • Retry logic: Detects 403/500/503 errors, clears cached token, retries with fresh solve
  • Exponential backoff on network/HTTP failures
  • New constructor params: captcha_api_key and captcha_service for simple setup
  • Backward compatible: Works without captcha key (falls back to manual input)

Usage

# With Capsolver (recommended)
from udio_wrapper import UdioWrapper
wrapper = UdioWrapper(auth_token="your_token", captcha_api_key="caps-...")

# With 2captcha
wrapper = UdioWrapper(auth_token="your_token", captcha_api_key="2cap-...", captcha_service="2captcha")

# With env var
export CAPSOLVER_API_KEY=caps-...
wrapper = UdioWrapper(auth_token="your_token")

# Without API key (manual input)
wrapper = UdioWrapper(auth_token="your_token")  # will prompt for token
result = wrapper.create_song("a happy jazz song")

Why this PR should be merged

  1. Actually integrated - Unlike Fix #7: 500 Server Error - Auto Solve hcapcha #40 which adds a standalone solver file that's never imported
  2. Functioning retry - Detects failures, refreshes token, retries automatically
  3. Multi-service - Supports both Capsolver and 2captcha
  4. Fallback chain - Capsolver → 2captcha → manual input
  5. Clean code - Single class, clear responsibilities, no global state
  6. Documented - Clear error messages guide users through setup

/claim #7


Closes #7

Adds HCaptchaSolver module with support for:
- Capsolver API (CAPSOLVER_API_KEY env var)
- 2captcha API (CAPTCHA_API_KEY env var)
- Manual token input as fallback
- Dynamic sitekey extraction from Udio homepage
- Token caching and automatic retry logic

Integrates solver into UdioWrapper.make_request() with:
- Automatic h-captcha-response header injection for POST requests
- Retry with fresh captcha token on 403/500/503 errors
- Exponential backoff on failures
- Optional captcha_api_key and captcha_service constructor params

/claim flowese#7
@opirebot

opirebot Bot commented Jul 11, 2026

Copy link
Copy Markdown

👀 We've notified the reward creators here.
Make sure your payment account is ready to receive the payment for your hard work 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

500 Server Error - Auto Solve hcapcha

1 participant