Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseChallengeScriptURL ¶
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 ¶
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 ¶
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.