-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmodels.go
151 lines (136 loc) · 4.3 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package hawkgo
import (
"net/http"
"time"
fhttp "github.com/useflyent/fhttp"
)
/*
Cloudflare
*/
type Scraper struct {
Client fhttp.Client
CaptchaFunction func(originalURL, siteKey string) (string, error)
FingerprintChallenge bool
Script string
InitScript *fhttp.Response
ChallengePayload *fhttp.Response
MainPayloadResponse *fhttp.Response
InitURL string
RequestURL string
CaptchaScript string
ApiDomain string
TimeOut int
ErrorDelay int
InitHeaders fhttp.Header
ChallengeHeaders fhttp.Header
SubmitHeaders fhttp.Header
OriginalRequest *fhttp.Response
Domain string
Debug bool
Key string
AuthParams map[string]string
Md string
Captcha bool
StartTime time.Time
SolveRetries int
SolveMaxRetries int
Result string
Name string
BaseObj string
RequestPass string
RequestR string
TS int
TargetURL string
InitPayloadRetries int
InitPayloadMaxRetries int
KeyStrUriSafe string
InitChallengeRetries int
InitChallengeMaxRetries int
FetchingChallengeRetries int
FetchingChallengeMaxRetries int
SubmitChallengeRetries int
SubmitChallengeMaxRetries int
ChallengeResultRetries int
ChallengeResultMaxRetries int
FinalApi apiResponse
SubmitFinalChallengeRetries int
SubmitFinalChallengeMaxRetries int
RerunRetries int
RerunMaxRetries int
CaptchaRetries int
CaptchaMaxRetries int
FirstCaptchaResult apiResponse
CaptchaResponseAPI apiResponse
SubmitCaptchaRetries int
SubmitCaptchaMaxRetries int
}
type apiResponse struct {
URL string `json:"url"`
ResultURL string `json:"result_url"`
Result string `json:"result"`
Name string `json:"name"`
BaseObj string `json:"baseobj"`
Pass string `json:"pass"`
R string `json:"r"`
TS int `json:"ts"`
Md string `json:"md"`
Status string `json:"status"`
Captcha bool `json:"captcha"`
JschlVc string `json:"jschl_vc"`
JschlAnswer string `json:"jschl_answer"`
CfChCpReturn string `json:"cf_ch_cp_return"`
SiteKey string `json:"sitekey"`
Click bool `json:"click"`
Valid bool `json:"valid"`
}
/*
PerimeterX
*/
type PX struct {
Domain string
PXID string
Client http.Client
Captcha bool
Gcap bool
CurrentPayload string
Delay int64
PXResponse PXResponse
CaptchaSuccess bool
PXEp string
URL string
PxHeaders http.Header
USER_AGENT string
Params map[string]string
MetaPayload map[string]interface{}
URLBase string
GetCaptcha func(domain string) (string, error)
}
var SITE_IDS = map[string]string{
"www.hibbett.com": "PXAJDckzHD",
"www.solebox.com": "PXuR63h57Z",
"www.snipes.com": "PX6XNN2xkk",
"www.onygo.com": "PXJ1N025xg",
"www.revolve.com": "PX78VMO82C",
"www.walmart.com": "PXu6b0qd2S",
"www.ssense.com": "PX58Asv359",
}
const px_ua_ep = "https://px.hwkapi.com/px/ua"
const px_1_ep = "https://px.hwkapi.com/px/1"
const px_2_ep = "https://px.hwkapi.com/px/2"
const px_cap_15_ep = "https://px.hwkapi.com/px/captcha/15"
const px_cap_hold_ep = "https://px.hwkapi.com/px/captcha/hold"
const px_cap_google_ep = "https://px.hwkapi.com/px/captcha/google"
var EP_MAPPING = map[int]string{
1: px_1_ep,
2: px_2_ep,
3: px_cap_15_ep,
4: px_cap_hold_ep,
5: px_cap_google_ep,
}
type PXResponse struct {
Do []string `json:"do"`
}
type SolveResponse struct {
Result map[string]string `json:"result"`
CaptchaSuccess interface{} `json:"captchaSuccess"`
}