datadome

package
v2.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseChallengeScriptURL added in v2.11.0

func ParseChallengeScriptURL(html string) (string, bool)

ParseChallengeScriptURL reports the challenge bundle a device check or captcha page loads with a <script defer src="..."> tag, and whether the page uses one at all.

DataDome serves some challenge pages with the bundle inlined in the HTML and others with it in its own file, switching between the two per request, so this has to be checked on every challenge rather than configured once.

When it reports true, GET the returned URL with the same client, proxy and headers you used for the challenge page, and pass the response body as the Script field of DataDomeInterstitialInput or DataDomeSliderInput. When it reports false the bundle is already in the HTML and Script stays empty.

deviceLink, err := datadome.ParseInterstitialDeviceCheckLink(body, cookie, referer)
// ... GET deviceLink, read the body into html ...

var script string
if scriptURL, ok := datadome.ParseChallengeScriptURL(html); ok {
    // fetch scriptURL with your own client, read the body into script
}

payload, headers, err := session.GenerateDataDomeInterstitial(ctx, &hyper.DataDomeInterstitialInput{
    UserAgent:      userAgent,
    DeviceLink:     deviceLink,
    Html:           html,
    Script:         script,
    AcceptLanguage: acceptLanguage,
    IP:             ip,
})
func ParseInterstitialDeviceCheckLink(body io.Reader, datadomeCookie, referer string) (string, error)

ParseInterstitialDeviceCheckLink parses the device check url (/interstitial/?initialCid...) from a blocked response body

the datadome cookie is the current value of the 'datadome' cookie

func ParseSliderDeviceCheckLink(body io.Reader, datadomeCookie, referer string) (string, error)

ParseSliderDeviceCheckLink parses the device check url (/captcha/?initialCid...) from a blocked response body

the datadome cookie is the current value of the 'datadome' cookie

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL