DataDome
This type of captcha basically requires the user to solve a puzzle by moving a slider to confirm.
This task will be performed using our proxy servers. Use the received cookies in your project to automatically pass the captcha.
Request parameters
type
<string>requiredCustomTask
class
<string>requiredDataDome
websiteURL
<string>requiredThe address of the main page where the captcha is solved.
metadata.htmlPageBase64
<string>required (if metadata.captchaUrl is not filled)Object that contains additional data about the captcha: "htmlPageBase64": "..."
- a base64 encoded html page that comes with a 403 code and a Set-Cookie: datadome="..." header in response to a get request to the target site.
metadata.captchaUrl
<string>required (if metadata.htmlPageBase64 is not filled)"captchaUrl"
- link to the captcha. Usually it looks like this: "https://geo.captcha-delivery.com/captcha/?initialCid=..."
.
metadata.datadomeCookie
<string>requiredYour cookies from datadome. You can get it on the page using "document.cookie" or in the Set-Cookie request header: "datadome=..." (see example request /createTask)
userAgent
<string>optionalBrowser User-Agent.
Pass only the actual UA. Now this is: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5.1 Mobile/21F90 Safari/604.1
Create task method
https://api.capmonster.cloud/createTask
Request
{
"clientKey": "API_KEY",
"task": {
"type": "CustomTask",
"class": "DataDome",
"websiteURL": "https://www.leboncoin.fr/",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5.1 Mobile/21F90 Safari/604.1",
"metadata": {
"htmlPageBase64": "PGh0bWw+PGhlYWQ+PHRpdGxlPmJs...PC9odG1sPg==",
"datadomeCookie": "datadome=VYUWrgJ9ap4zmXq8Mgbp...64emvUPeON45z"
}
}
}
Response
{
"errorId":0,
"taskId":407533072
}
Get task result method
Use the getTaskResult method to get the DataDome solution.
https://api.capmonster.cloud/getTaskResult
Request
{
"clientKey":"API_KEY",
"taskId": 407533072
}
Response
{
"errorId":0,
"status":"ready",
"solution": {
"domains": {
"site.com": {
"cookies": {
"datadome": "t355hfeuUFbsWpoMzXyIWL_ewfwgre25345323rwgregeFEkG5iju9esKVfWMzuLAjcfCIJUIHU7332At1l~HY78g782hidwfeO4K2ZP_CFHYUFEgygfiYGfGYEUfgyefWrXG6_3sy; Max-Age=31536000; Domain=.site.com; Path=/; Secure; SameSite=Lax"
}
}
}
}
}
Use SDK Library
- JavaScript
- Python
// https://github.com/ZennoLab/capmonstercloud-client-js
import { CapMonsterCloudClientFactory, ClientOptions, DataDomeRequest } from '@zennolab_com/capmonstercloud-client';
document.addEventListener('DOMContentLoaded', async () => {
const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
console.log(await cmcClient.getBalance());
const dataDomeRequest = new DataDomeRequest({
websiteURL: 'site.com',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5.1 Mobile/21F90 Safari/604.1',
metadata: {
captchaUrl: 'https://geo.captcha-delivery.com/captcha/?initialCid=12434324',
datadomeCookie: '',
},
});
console.log(await cmcClient.Solve(dataDomeRequest));
});
# https://github.com/ZennoLab/capmonstercloud-client-python
import asyncio
from capmonstercloudclient import CapMonsterClient, ClientOptions
from capmonstercloudclient.requests import DataDomeCustomTaskProxylessRequest
client_options = ClientOptions(api_key="your_api_key") # Replace with your CapMonster Cloud API key
cap_monster_client = CapMonsterClient(options=client_options)
data_dome_request = DataDomeCustomTaskProxylessRequest(
websiteUrl="https://example.com", # URL with the captcha
userAgent="Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5.1 Mobile/21F90 Safari/604.1", # Use the current userAgent
metadata={
"htmlPageBase64": "PGh0bWw+PGhlYWQ+PHRpdGxlPn...+48L2h0bWw+", # Replace with your HTML base64 or use captchaUrl
"datadomeCookie": "datadome=oZJnhpo...1PuyGg" # Replace with your DataDome cookie
}
)
async def solve_captcha():
return await cap_monster_client.solve_captcha(data_dome_request)
responses = asyncio.run(solve_captcha())
print(responses)