Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,30 @@ This project is licensed under the MIT License.

If you'd like to contribute to this project, feel free to fork the repository and send a pull request, or open an issue to discuss what you'd like to change. All contributions are welcome!

## Known Issues

### hCaptcha Protection (Issue #7)

As of April 2024, Udio has implemented hCaptcha protection on their API endpoints, particularly `/generate-proxy`. This causes automated requests to return `500 Server Error`.

**Current Status:**
- Automated API requests are blocked by hCaptcha
- Browser-based workarounds (Selenium + undetected-chromedriver) have been attempted but are unreliable
- Even after manually solving captcha, subsequent requests may still fail

**Possible Workarounds:**
1. **Browser Automation**: Use Selenium with undetected-chromedriver to handle captcha challenges (requires additional setup, may violate ToS)
2. **Wait for Official API**: Udio may release an official API with proper authentication
3. **Manual Session**: Maintain an active browser session and extract updated cookies/tokens

**Note**: Contributing to the bypass of anti-bot systems may violate terms of service and could have legal/employment implications.

## TODO

### Pending Tasks and Features

- Improve error handling and response validation.
- Implement optional browser-based authentication to handle hCaptcha challenges.
- Implement a user-friendly web interface for easier interaction with the API.

-----
18 changes: 16 additions & 2 deletions udio_wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,25 @@ def __init__(self, auth_token):
def make_request(self, url, method, data=None, headers=None):
try:
if method == 'POST':
response = requests.post(url, headers=headers, json=data)
response = requests.post(url, headers=headers, json=data, timeout=30)
else:
response = requests.get(url, headers=headers)
response = requests.get(url, headers=headers, timeout=30)

# Check for hCaptcha challenge (500 errors on generate-proxy endpoint)
if response.status_code == 500 and 'generate-proxy' in url:
print(f"ERROR: Received 500 Server Error from {url}")
print("CAUSE: Udio has implemented hCaptcha protection on this endpoint.")
print("SOLUTION: Automated requests are currently blocked. Consider:")
print(" 1. Using a browser-based approach (Selenium + undetected-chromedriver)")
print(" 2. Waiting for an official Udio API with proper authentication")
print(" 3. Manual interaction may be required per session")
return None

response.raise_for_status()
return response
except requests.exceptions.Timeout:
print(f"Timeout error making {method} request to {url}")
return None
except requests.exceptions.RequestException as e:
print(f"Error making {method} request to {url}: {e}")
return None
Expand Down