TakionAPI
Start a TrialJoin our DiscordBuy a PlanDashboard
  • Takion API
  • Interacting with our APIs
  • Datadome
    • Bypass Solution
    • Example Implementations
    • Common Errors & Troubleshooting
  • Incapsula / Imperva
    • reese84 Bypass Solution
    • ___utmvc Bypass Solution
    • Example Implementations
    • Common Errors & Troubleshooting
  • Perimeter X Mobile
    • Bypass Solution
    • Example Implementations
  • GeeTest
    • v3 Bypass Solution
    • v4 Bypass Solution
    • Example Implementations
  • AWS Cognito
    • Bypass Solution
    • Example Implementations
  • Castle
    • Bypass Solution
    • Example Implementations
  • NuData
    • Bypass Solution
    • Example Implementations
  • Image-to-Text Captchas / OCR
    • Bypass Solution
    • Example Implementations
  • Frameworks & Modules
    • Adyen and riskData
    • Queue-IT Module
Powered by GitBook
On this page

Was this helpful?

  1. Datadome

Example Implementations

When interacting with Datadome a good TLS Client is required

Note that the interstitial challenge will return a json, with other than the cookie, an url to follow. In case of hard-protection mode on datadome, you may get redirected to a captcha challenge that needs to be solved as well

from tls_client import Session
from requests import post
from time import sleep

API_KEY = "TAKION_API_XXX"

if __name__ == "__main__":
    session = Session(
        client_identifier="chrome_136",
        random_tls_extension_order=True
    )

    while 1:
        print("(1) Loading page...")
        response = session.get(
            'https://datadome.co/', 
            headers={
                'Host': 'datadome.co',
                'sec-ch-ua': '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"macOS"',
                'upgrade-insecure-requests': '1',
                'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
                'sec-purpose': 'prefetch;prerender',
                'purpose': 'prefetch',
                'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
                'sec-fetch-site': 'none',
                'sec-fetch-mode': 'navigate',
                'sec-fetch-user': '?1',
                'sec-fetch-dest': 'document',
                'accept-language': 'en-GB,en;q=0.9',
                'priority': 'u=0, i',
            }
        )
        print(response.text[:200])
        if response.status_code == 200:
            print("\033[1;32m" + f"Page loaded successfully: {response.status_code=}" + "\033[0m")
            break
        print("\033[1;33m" + f"Datadome detected! {response.status_code=}" + "\033[0m")

        build_response = post(
            "https://datadome.takionapi.tech/build",
            json={
                "html": response.text,
                "referer": "https://datadome.co/",
                "datadome": session.cookies.get("datadome")
            },
            headers={
                "x-api-key": API_KEY
            }
        ).json()
        if (error := build_response.get("error")):
            print(error)
            sleep(3)
            continue
        
        challenge_url, ctype = build_response["url"], build_response["challenge_type"]
        print(f"(2) Detected \033[1;35m{ctype}\033[0m challenge, loading...")

        challenge_page = session.get(
            challenge_url, 
            headers={
            'Host': 'geo.captcha-delivery.com',
            'sec-ch-ua': '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
            'sec-ch-ua-mobile': '?0',
            'sec-ch-ua-platform': '"macOS"',
            'Upgrade-Insecure-Requests': '1',
            'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
            'Sec-Fetch-Site': 'cross-site',
            'Sec-Fetch-Mode': 'navigate',
            'Sec-Fetch-Dest': 'iframe',
            'Sec-Fetch-Storage-Access': 'active',
            'Referer': 'https://datadome.co/',
            'Accept-Language': 'en-GB,en;q=0.9',
        })

        print("(3) Solving challenge...")
        solved_response = post(
            "https://datadome.takionapi.tech/solve",
            json={
                "html": challenge_page.text,
            },
            headers={
                'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
                "accept-language": "en-GB,en;q=0.9",
                "x-api-key": API_KEY
            }
        ).json()

        if (error := solved_response.get("error")):
            print(error)
            sleep(3)
            continue

        print("(4) Posting challenge...")
        if solved_response["method"] == "POST": # Interstitial
            response = session.post(
                solved_response["url"],
                headers={
                    'Host': 'geo.captcha-delivery.com',
                    'sec-ch-ua-platform': '"macOS"',
                    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
                    'sec-ch-ua': '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                    'sec-ch-ua-mobile': '?0',
                    'Accept': '*/*',
                    'Origin': 'https://geo.captcha-delivery.com',
                    'Sec-Fetch-Site': 'same-origin',
                    'Sec-Fetch-Mode': 'cors',
                    'Sec-Fetch-Dest': 'empty',
                    'Sec-Fetch-Storage-Access': 'active',
                    'Referer': 'https://geo.captcha-delivery.com/interstitial/',
                    'Accept-Language': 'en-GB,en;q=0.9',
                }, 
                data=solved_response["payload"]
            )
        else:
            response = session.get(
                solved_response["url"],
                headers={
                    'Host': 'geo.captcha-delivery.com',
                    'sec-ch-ua-platform': '"macOS"',
                    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
                    'sec-ch-ua': '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                    'sec-ch-ua-mobile': '?0',
                    'Accept': '*/*',
                    'Sec-Fetch-Site': 'same-origin',
                    'Sec-Fetch-Mode': 'cors',
                    'Sec-Fetch-Dest': 'empty',
                    'Sec-Fetch-Storage-Access': 'active',
                    'Referer': 'https://geo.captcha-delivery.com/captcha/',
                    'Accept-Language': 'en-GB,en;q=0.9',
                }, 
                params=solved_response["payload"]
            )
        cookie = response.json()["cookie"].split("datadome=")[1].split(";")[0]
        print(f"\033[1;34m(5)Generated cookie: {cookie[:17]}...{cookie[-17:]}\033[0m")
        session.cookies.set("datadome", cookie)
        continue

PreviousBypass SolutionNextCommon Errors & Troubleshooting

Last updated 11 days ago

Was this helpful?