Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type ClientProxyOption
- type CustomTimeoutOption
- type DatadomeCookieResponse
- type DatadomeSDK
- type ErrorEnv
- type GenHoldCaptchaResponse
- type HtmlScriptObject
- type InsecureSkipVerifyOption
- type JsonDatadomeBlockBody
- type Option
- type PXErrorDetails
- type PayloadGenDatadomeCookie
- type PayloadGenHoldCaptcha
- type PayloadGenPXCookie
- type PayloadGenUserAgent
- type PerimeterxSDK
- type PxCookieResponse
- type SDK
- func (s *SDK) CheckUsage(site string) (UsageResponse, error)
- func (s *SDK) GenerateDatadomeCookie(task TaskDatadomeCookie) (*DatadomeCookieResponse, error)
- func (s *SDK) GenerateDatadomeTagsCookie(task TaskDatadomeTagsCookie) (*DatadomeCookieResponse, error)
- func (s *SDK) GenerateUserAgent(task TaskGenUserAgent) (*UserAgentResponse, error)
- type TaskDatadomeCookie
- type TaskDatadomeCookieData
- func DetectChallengeAndParse(body, prevCookie string) (bool, *TaskDatadomeCookieData, string, error)
- func ParseChallengeHTML(htmlBody, prevCookie string) (*TaskDatadomeCookieData, string, error)
- func ParseChallengeJSON(jsonBody, prevCookie string) (*TaskDatadomeCookieData, string, error)
- func ParseChallengeURL(challengeURL, prevCookie string) (*TaskDatadomeCookieData, string, error)
- type TaskDatadomeTagsCookie
- type TaskGenUserAgent
- type TaskGenerateHoldCaptcha
- type TaskGeneratePXCookies
- type UsageResponse
- type UserAgentResponse
Constants ¶
const ( PD_Captcha = "captcha" PD_Interstitial = "interstitial" PD_Init = "init" )
TODO add separate type for ProductTypes
const ( // Perma block T_BV = "bv" // Captcha T_FE = "fe" // Intersitial T_IT = "it" )
const DefaultDDHost = "https://dd.parallaxsystems.io"
const DefaultPXHost = "https://api.parallaxsystems.io"
Variables ¶
var ErrInvalidChallengeURL = fmt.Errorf("invalid challenge URL")
ErrInvalidChallengeURL means the URL failed to parse.
var ErrNoDatadomeValuesInHtml = fmt.Errorf("no DataDome values in HTML body")
ErrNoDatadomeValuesInHtml means no Datadome values were found in the HTML body
var ErrPermanentlyBlocked = fmt.Errorf("permanently blocked by DataDome (t=bv)")
ErrPermanentlyBlocked means the challenge indicates a permanent block (t=bv)
var ErrUnknownChallengeType = fmt.Errorf("unknown challenge type in URL")
ErrUnknownChallengeType means we couldn’t identify captcha/interstitial/init.
var ErrUnparsableDatadomeJSONBody = fmt.Errorf("unparsable DataDome JSON body")
ErrUnparsableDatadomeBody means the JSON body could not be parsed or did not contain a URL
Functions ¶
This section is empty.
Types ¶
type ClientProxyOption ¶
type ClientProxyOption string
func WithClientProxy ¶
func WithClientProxy(proxy string) ClientProxyOption
type CustomTimeoutOption ¶
func WithCustomTimeout ¶
func WithCustomTimeout(d time.Duration) CustomTimeoutOption
type DatadomeCookieResponse ¶
type DatadomeCookieResponse struct {
Message string `json:"message"`
UserAgent string `json:"UserAgent"`
}
DatadomeCookieResponse is the response type for DataDome cookie generation.
type DatadomeSDK ¶
type DatadomeSDK struct {
*SDK
}
func NewDatadomeSDK ¶
func NewDatadomeSDK(key, host string, options ...Option) *DatadomeSDK
type GenHoldCaptchaResponse ¶
type GenHoldCaptchaResponse struct {
PxCookieResponse
FlaggedPow bool `json:"flaggedPOW"` // Indicates if pow is flagged.
}
GenHoldCaptchaResponse is the response type for holdingcaptcha challenge.
type HtmlScriptObject ¶
type InsecureSkipVerifyOption ¶
type InsecureSkipVerifyOption bool
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify() InsecureSkipVerifyOption
type JsonDatadomeBlockBody ¶
type JsonDatadomeBlockBody struct {
URL string `json:"url"`
}
type PXErrorDetails ¶ added in v1.1.2
type PayloadGenDatadomeCookie ¶
type PayloadGenDatadomeCookie struct {
Auth string `json:"auth"` // The API key used for authenticating SDK requests.
Site string `json:"site"` // Site for which to generate the cookie.
Region string `json:"region"` // Site region.
Proxyregion string `json:"proxyregion"` // The region of your proxy (either "eu" or "us").
Proxy string `json:"proxy"` // Proxy address.
Pd string `json:"pd"` // Product type.
Data TaskDatadomeCookieData `json:"data"` // Data required for cookie generation.
}
PayloadGenDatadomeCookie is the payload for generating a DataDome cookie.
type PayloadGenHoldCaptcha ¶
type PayloadGenHoldCaptcha struct {
Auth string `json:"auth"` // The API key used for authenticating SDK requests.
TaskGenerateHoldCaptcha
}
PayloadGenHoldCaptcha is the payload for the holdcaptcha challenge.
type PayloadGenPXCookie ¶
type PayloadGenPXCookie struct {
Auth string `json:"auth"` // The API key used for authenticating SDK requests.
TaskGeneratePXCookies
}
PayloadGenPXCookie is the payload for generating PX cookies.
type PayloadGenUserAgent ¶
type PayloadGenUserAgent struct {
Auth string `json:"auth"` // The API key used for authenticating SDK requests.
Site string `json:"site"`
Region string `json:"region"`
Pd string `json:"pd"`
}
PayloadGenUserAgent is the payload for generating a user agent.
type PerimeterxSDK ¶
type PerimeterxSDK struct {
*SDK
}
func NewPerimeterxSDK ¶
func NewPerimeterxSDK(key, host string, options ...Option) *PerimeterxSDK
func (*PerimeterxSDK) GenerateCookies ¶
func (sdk *PerimeterxSDK) GenerateCookies(task TaskGeneratePXCookies) (*PxCookieResponse, error)
func (*PerimeterxSDK) GenerateHoldCaptcha ¶
func (sdk *PerimeterxSDK) GenerateHoldCaptcha(task TaskGenerateHoldCaptcha) (*GenHoldCaptchaResponse, error)
type PxCookieResponse ¶
type PxCookieResponse struct {
Cookie string `json:"cookie"`
Vid string `json:"vid"` // Used to set the _pxvid cookie.
Cts string `json:"cts"` // Used to set the pxcts cookie.
Uuid string `json:"uuid"`
Model string `json:"model"` // The device model used for generation.
DeviceFp string `json:"device_fp"` // The device fingerprint used for generation.
IsFlagged bool `json:"isFlagged"` // Indicate if the generation might have been flagged during generation.
IsMaybeFlagged bool `json:"isMaybeFlagged"` // Indicate if the generation might have been flagged during generation.
UserAgent string `json:"UserAgent"` // The device used for generation.
Data string `json:"data"` // A string used to generate the next step.
}
PxCookieResponse is the response type for PX cookies generation.
type SDK ¶
func CreateClient ¶
func (*SDK) GenerateDatadomeCookie ¶
func (s *SDK) GenerateDatadomeCookie(task TaskDatadomeCookie) (*DatadomeCookieResponse, error)
GenerateDatadomeCookie generates a DataDome cookie using the provided task parameters.
func (*SDK) GenerateDatadomeTagsCookie ¶
func (s *SDK) GenerateDatadomeTagsCookie(task TaskDatadomeTagsCookie) (*DatadomeCookieResponse, error)
GenerateDatadomeTagsCookie generates a DataDome tags cookie using the provided task parameters.
func (*SDK) GenerateUserAgent ¶
func (s *SDK) GenerateUserAgent(task TaskGenUserAgent) (*UserAgentResponse, error)
GenerateUserAgent generates a user agent data.
type TaskDatadomeCookie ¶
type TaskDatadomeCookie struct {
Site string `json:"site"` // Site for which to generate the cookie.
Region string `json:"region"` // Site region.
Proxyregion string `json:"proxyregion"` // The region of your proxy (either "eu" or "us").
Proxy string `json:"proxy"` // Proxy address.
Pd string `json:"pd"` // Product type.
Data TaskDatadomeCookieData `json:"data"` // Data required for cookie generation.
}
TaskDatadomeCookie represents a task for generating a DataDome cookie.
type TaskDatadomeCookieData ¶
type TaskDatadomeCookieData struct {
Cid string `json:"cid"`
E string `json:"e"`
S string `json:"s"`
B string `json:"b"`
InitialCid string `json:"initialCid"`
}
TaskDatadomeCookieData contains data required for generating a Datadome cookie.
func DetectChallengeAndParse ¶
func DetectChallengeAndParse(body, prevCookie string) (bool, *TaskDatadomeCookieData, string, error)
DetectChallengeAndParse detects the challenge type and parses accordingly.
func ParseChallengeHTML ¶
func ParseChallengeHTML(htmlBody, prevCookie string) (*TaskDatadomeCookieData, string, error)
ParseChallengeHTML parses HTML and extracts DataDome challenge data from a JS object.
func ParseChallengeJSON ¶
func ParseChallengeJSON(jsonBody, prevCookie string) (*TaskDatadomeCookieData, string, error)
ParseChallengeJSON parses a JSON body containing a DataDome challenge URL.
func ParseChallengeURL ¶
func ParseChallengeURL(challengeURL, prevCookie string) (*TaskDatadomeCookieData, string, error)
ParseChallengeURL parses a DataDome challenge URL and extracts the challenge data and product type.
type TaskDatadomeTagsCookie ¶
type TaskDatadomeTagsCookie struct {
Site string `json:"site"` // Site for which to generate the cookie.
Region string `json:"region"` // Site region.
Proxyregion string `json:"proxyregion"` // The region of your proxy (either "eu" or "us").
Proxy string `json:"proxy"` // Proxy address.
Cid string `json:"cid"` // Data required for cookie generation.
}
TaskDatadomeTagsCookie represents a task for generating a DataDome tags cookie.
type TaskGenUserAgent ¶
TaskGenUserAgent represents a task for generating useragent data.
type TaskGenerateHoldCaptcha ¶
type TaskGenerateHoldCaptcha struct {
Site string `json:"site"`
Region string `json:"region"`
Proxyregion string `json:"proxyregion"` // The region of your proxy (either "eu" or "us").
Proxy string `json:"proxy"`
Data string `json:"data"` // Data required for cookie generation.
PowPro string `json:"POW_PRO"` // (Optional) Insert your Cuda POW solver key here.
}
TaskGenerateHoldCaptcha represents a task for hold captcha challenge.
type TaskGeneratePXCookies ¶
type TaskGeneratePXCookies struct {
Site string `json:"site"` // Site for which to generate cookies.
Region string `json:"region"` // Site region.
Proxyregion string `json:"proxyregion"` // Proxy region.
Proxy string `json:"proxy"` // Proxy address.
}
TaskGeneratePXCookies represents a task for generating PX cookies.
type UsageResponse ¶
type UserAgentResponse ¶
type UserAgentResponse struct {
Message string `json:"message"`
UserAgent string `json:"UserAgent"`
SecHeader string `json:"secHeader"`
SecFullVersionList string `json:"secFullVersionList"`
SecPlatform string `json:"secPlatform"`
SecArch string `json:"secArch"`
}
UserAgentResponse is the response type for user agent generation.
