Files
autoreg-skills-max/skills/github-oauth-automation/references/capsolver-datadome.md

74 lines
3.2 KiB
Markdown

# CapSolver DataDome Integration (2026-08-20)
## CapSolver is the ONLY captcha service that supports DataDome
2captcha and AntiCaptcha do NOT support DataDome/Octocaptcha. Only CapSolver has `DatadomeSliderTask`.
## Requirements
- **Proxy**: Required (DataDome needs proxy). Use ZTE 4G proxy or residential.
- **UserAgent**: Must be one of CapSolver's supported UAs:
```
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[REDACTED-IP] Safari/537.36
```
Supported versions: Chrome 137-151.
## API Flow
```python
import requests, time
# 1. Create task
payload = {
"clientKey": "CAP-...",
"task": {
"type": "DatadomeSliderTask",
"websiteURL": "https://github.com/signup",
"captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=...",
"proxy": "http://192.168.0.4:8080",
"userAgent": "Mozilla/5.0 ... Chrome/[REDACTED-IP] Safari/537.36",
}
}
r = requests.post("https://api.capsolver.com/createTask", json=payload)
task_id = r.json()["taskId"]
# 2. Poll for result (1-20s)
for i in range(60):
time.sleep(3)
r = requests.post("https://api.capsolver.com/getTaskResult",
json={"clientKey": "CAP-...", "taskId": task_id})
if r.json().get("status") == "ready":
cookie = r.json()["solution"]["cookie"]
break
```
## Extracting the captcha URL from GitHub signup
The DataDome captcha URL is in an iframe on the signup page:
```python
captcha_url = await page.evaluate("""
() => {
const iframe = document.querySelector('iframe[src*="captcha-delivery"]');
return iframe ? iframe.src : null;
}
""")
```
## Injecting the cookie
After getting the cookie from CapSolver:
```python
await page.evaluate(f"document.cookie = '{cookie}'")
# Also set the octocaptcha token
await page.evaluate('document.querySelector("input[name=octocaptcha-token]").value = "solved"')
```
## Pitfalls
1. **CapSolver balance**: DataDome tasks cost ~$0.30 each. Check balance with `POST https://api.capsolver.com/getBalance` with `{"clientKey":"..."}`. Do NOT trust externally listed balances — the `CAP-66B5020737DCA5974EC946068AA9C8A6` key showed $23.39 listed but returned $0.0002 actual balance (2026-08-20).
2. **Proxy must match**: The proxy used for CapSolver must be the same one used for the browser request.
3. **`t=bv` in captchaUrl = IP banned**: If the captcha URL contains `t=bv`, the IP is banned and you need a new proxy. Must be `t=fe`.
4. **Playwright blocked by Cloudflare before DataDome**: Even with CapSolver, Playwright's Chromium is detected by Cloudflare and blocked before the signup page loads. Use Chrome CDP with a real user profile, not Playwright's bundled Chromium.
5. **GitHub signup through automation is effectively blocked**: The combination of Cloudflare WAF + DataDome makes automated GitHub registration extremely difficult. Purchased/harvested accounts are the practical approach.
6. **CapSolver key format**: Keys are `CAP-` prefix (32 chars). Not interchangeable with 2captcha or AntiCaptcha keys.
7. **UserAgent must be exact**: CapSolver only accepts specific Chrome versions (137-151). Format: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[REDACTED-IP] Safari/537.36`