@2captcha/captcha-solver 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/package.json +1 -1
- package/README.ru.md +0 -385
- package/README.zh.md +0 -361
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/structs/2captcha.d.ts +0 -821
- package/dist/structs/2captcha.d.ts.map +0 -1
- package/dist/structs/2captcha.js +0 -1148
- package/dist/structs/2captchaError.d.ts +0 -6
- package/dist/structs/2captchaError.d.ts.map +0 -1
- package/dist/structs/2captchaError.js +0 -275
- package/dist/structs/2captchaServer.d.ts +0 -35
- package/dist/structs/2captchaServer.d.ts.map +0 -1
- package/dist/structs/2captchaServer.js +0 -91
- package/dist/structs/constants/constants.d.ts +0 -15
- package/dist/structs/constants/constants.d.ts.map +0 -1
- package/dist/structs/constants/constants.js +0 -25
- package/dist/structs/providers/providers.d.ts +0 -6
- package/dist/structs/providers/providers.d.ts.map +0 -1
- package/dist/structs/providers/providers.js +0 -20
- package/dist/utils/checkCaptchaParams.d.ts +0 -8
- package/dist/utils/checkCaptchaParams.d.ts.map +0 -1
- package/dist/utils/checkCaptchaParams.js +0 -119
- package/dist/utils/fetch.d.ts +0 -3
- package/dist/utils/fetch.d.ts.map +0 -1
- package/dist/utils/fetch.js +0 -6
- package/dist/utils/generic.d.ts +0 -21
- package/dist/utils/generic.d.ts.map +0 -1
- package/dist/utils/generic.js +0 -47
package/README.zh.md
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
[English](README.md) | <b>[中国语文科](README.zh.md)</b> | [Русский](README.ru.md)
|
|
2
|
-
|
|
3
|
-
# 2captcha API的JavaScript模块
|
|
4
|
-
|
|
5
|
-
## 资料描述
|
|
6
|
-
提供[2captcha](https://2captcha.com/)服务的API的包装器.
|
|
7
|
-
這個 npm 包包括對以下驗證碼類型的支持:reCAPTCHA V2, reCAPTCHA V3, hCaptcha, Arkose Labs FunCaptcha, image captcha, Coordinates (Click Captcha), Geetest, Geetest V4, Yandex Smart Captcha, Lemin captcha, Amazon WAF, Cloudflare Turnstile, Capy Puzzle, DataDome CAPTCHA, CyberSiARA, MTCaptcha.
|
|
8
|
-
|
|
9
|
-
[2captcha](https://2captcha.com/)是一項服務,可讓您解決許多不同類型的驗證碼。這個 npm 包包裝了[2captcha](https://2captcha.com/)API 來為 NodeJS 提供簡單的基於`promise`的功能。
|
|
10
|
-
|
|
11
|
-
## 支持的驗證碼
|
|
12
|
-
- ✅ google-recaptcha (reCAPTCHA v2 / reCAPTCHA v3)
|
|
13
|
-
- ✅ hCaptcha
|
|
14
|
-
- ✅ Arkose Labs FunCaptcha
|
|
15
|
-
- ✅ Image captchas. (`base64` format)
|
|
16
|
-
- ✅ Geetest
|
|
17
|
-
- ✅ Geetest v4
|
|
18
|
-
- ✅ Yandex Smart Captcha
|
|
19
|
-
- ✅ Lemin Cropped Captcha
|
|
20
|
-
- ✅ Cloudflare Turnstile
|
|
21
|
-
- ✅ Amazon WAF Captcha
|
|
22
|
-
- ✅ Capy Puzzle
|
|
23
|
-
- ✅ Coordinates (Click Captcha)
|
|
24
|
-
- ⬜ Audio Recogntion
|
|
25
|
-
- ✅ DataDome CAPTCHA
|
|
26
|
-
- ✅ CyberSiARA
|
|
27
|
-
- ✅ MTCaptcha
|
|
28
|
-
- ✅ Bounding Box Method
|
|
29
|
-
|
|
30
|
-
## 安装/安装
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
npm install @2captcha/captcha-solver
|
|
34
|
-
```
|
|
35
|
-
```sh
|
|
36
|
-
yarn add @2captcha/captcha-solver
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 使用示例
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### reCAPTCHA:
|
|
43
|
-
```js
|
|
44
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
45
|
-
// 具有 2CAPTCHA API 密鑰值的新“求解器”實例。
|
|
46
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
47
|
-
|
|
48
|
-
// reCAPTCHA 解決方案,在包含 reCAPTCHA V2 的演示頁面上
|
|
49
|
-
solver.recaptcha({
|
|
50
|
-
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
|
|
51
|
-
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
|
|
52
|
-
})
|
|
53
|
-
.then((res) => {
|
|
54
|
-
console.log(res);
|
|
55
|
-
})
|
|
56
|
-
.catch((err) => {
|
|
57
|
-
console.log(err);
|
|
58
|
-
})
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### hCaptcha:
|
|
62
|
-
```js
|
|
63
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
64
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
65
|
-
|
|
66
|
-
solver.hcaptcha({
|
|
67
|
-
pageurl: "https://2captcha.com/demo/hcaptcha?difficulty=moderate",
|
|
68
|
-
sitekey: "b76cd927-d266-4cfb-a328-3b03ae07ded6"
|
|
69
|
-
})
|
|
70
|
-
.then((res) => {
|
|
71
|
-
console.log(res);
|
|
72
|
-
})
|
|
73
|
-
.catch((err) => {
|
|
74
|
-
console.log(err);
|
|
75
|
-
})
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Arkose Labs FunCaptcha:
|
|
79
|
-
```js
|
|
80
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
81
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
82
|
-
|
|
83
|
-
solver.funCaptcha({
|
|
84
|
-
pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
|
|
85
|
-
publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
|
|
86
|
-
})
|
|
87
|
-
.then((res) => {
|
|
88
|
-
console.log(res);
|
|
89
|
-
})
|
|
90
|
-
.catch((err) => {
|
|
91
|
-
console.log(err);
|
|
92
|
-
})
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Image captcha:
|
|
96
|
-
```js
|
|
97
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
98
|
-
const fs = require("fs")
|
|
99
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
100
|
-
|
|
101
|
-
// 獲取base64格式的文件內容
|
|
102
|
-
const imageBase64 = fs.readFileSync("./tests/media/imageCaptcha_6e584.png", "base64")
|
|
103
|
-
|
|
104
|
-
solver.imageCaptcha({
|
|
105
|
-
body: imageBase64,
|
|
106
|
-
numeric: 4,
|
|
107
|
-
min_len: 5,
|
|
108
|
-
max_len: 5
|
|
109
|
-
})
|
|
110
|
-
.then((res) => {
|
|
111
|
-
console.log(res);
|
|
112
|
-
})
|
|
113
|
-
.catch((err) => {
|
|
114
|
-
console.log(err);
|
|
115
|
-
})
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### GeeTest Captcha:
|
|
120
|
-
```js
|
|
121
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
122
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
123
|
-
|
|
124
|
-
// `challenge` 值是動態的
|
|
125
|
-
// 关于参数`challenge`的更多信息写在第https://2captcha.com/p/geetest页
|
|
126
|
-
solver.geetest({
|
|
127
|
-
pageurl: 'https://2captcha.com/demo/geetest',
|
|
128
|
-
gt: '81388ea1fc187e0c335c0a8907ff2625',
|
|
129
|
-
challenge: '<you need to get a new challenge value each time>'
|
|
130
|
-
})
|
|
131
|
-
.then((res) => {
|
|
132
|
-
console.log(res);
|
|
133
|
-
})
|
|
134
|
-
.catch((err) => {
|
|
135
|
-
console.log(err);
|
|
136
|
-
})
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### GeeTest V4 Captcha:
|
|
140
|
-
```js
|
|
141
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
142
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
143
|
-
|
|
144
|
-
solver.geetestV4({
|
|
145
|
-
pageurl: 'https://2captcha.com/demo/geetest-v4',
|
|
146
|
-
captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
|
|
147
|
-
})
|
|
148
|
-
.then((res) => {
|
|
149
|
-
console.log(res);
|
|
150
|
-
})
|
|
151
|
-
.catch((err) => {
|
|
152
|
-
console.log(err);
|
|
153
|
-
})
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Yandex Smart Captcha:
|
|
157
|
-
```js
|
|
158
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
159
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
160
|
-
|
|
161
|
-
solver.yandexSmart({
|
|
162
|
-
pageurl: "https://captcha-api.yandex.ru/demo",
|
|
163
|
-
sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
|
|
164
|
-
})
|
|
165
|
-
.then((res) => {
|
|
166
|
-
console.log(res);
|
|
167
|
-
})
|
|
168
|
-
.catch((err) => {
|
|
169
|
-
console.log(err);
|
|
170
|
-
})
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Lemin captcha:
|
|
174
|
-
```js
|
|
175
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
176
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
177
|
-
|
|
178
|
-
solver.lemin({
|
|
179
|
-
pageurl:'https://dashboard.leminnow.com/auth/login',
|
|
180
|
-
captcha_id: 'CROPPED_099216d_34698cb7b8574265925f493cbcb3df4d',
|
|
181
|
-
div_id: 'lemin-cropped-captcha',
|
|
182
|
-
api_server: 'https://api.leminnow.com/captcha/v1/cropped'
|
|
183
|
-
})
|
|
184
|
-
.then((res) => {
|
|
185
|
-
console.log(res);
|
|
186
|
-
})
|
|
187
|
-
.catch((err) => {
|
|
188
|
-
console.log(err);
|
|
189
|
-
})
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Cloudflare Turnstile:
|
|
193
|
-
```js
|
|
194
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
195
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
196
|
-
|
|
197
|
-
solver.cloudflareTurnstile({
|
|
198
|
-
pageurl: "https://app.nodecraft.com/login",
|
|
199
|
-
sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
|
|
200
|
-
})
|
|
201
|
-
.then((res) => {
|
|
202
|
-
console.log(res);
|
|
203
|
-
})
|
|
204
|
-
.catch((err) => {
|
|
205
|
-
console.log(err);
|
|
206
|
-
})
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### Amazon WAF Captcha (AWS WAF):
|
|
210
|
-
```js
|
|
211
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
212
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
213
|
-
|
|
214
|
-
// INFO: 'Context'值是动态的,每次都需要从captcha页面获取新的`context`值。
|
|
215
|
-
solver.amazonWaf({
|
|
216
|
-
pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
|
|
217
|
-
sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRt...",
|
|
218
|
-
context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ...",
|
|
219
|
-
iv: "CgAHbCe2GgAAAAAj",
|
|
220
|
-
})
|
|
221
|
-
.then((res) => {
|
|
222
|
-
console.log(res);
|
|
223
|
-
})
|
|
224
|
-
.catch((err) => {
|
|
225
|
-
console.log(err);
|
|
226
|
-
})
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Capy Puzzle
|
|
230
|
-
```js
|
|
231
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
232
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
233
|
-
|
|
234
|
-
solver.capyPuzzle({
|
|
235
|
-
pageurl: "https://www.capy.me/account/register/",
|
|
236
|
-
captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
|
|
237
|
-
})
|
|
238
|
-
.then((res) => {
|
|
239
|
-
console.log(res);
|
|
240
|
-
})
|
|
241
|
-
.catch((err) => {
|
|
242
|
-
console.log(err);
|
|
243
|
-
})
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### DataDome CAPTCHA
|
|
247
|
-
```js
|
|
248
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
249
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
solver.dataDome({
|
|
253
|
-
pageurl: "https://rendezvousparis.hermes.com/client/register",
|
|
254
|
-
captcha_url: "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMAEuQtkf4k1c0ABZhYZA%3D%3D&hash=789361B674144528D0B7EE76B35826&cid=mY4z7GNmh7Nt1lAFwpbNHAOcWPhyPgjHD2K1Pm~Od1iEKYLUnK3t7N2ZGUj8OqDK65cnwJHtHwd~t902vlwpSBA5l4ZHbS1Qszv~jEuEUJNQ_jMAjar2Kj3kq20MRJYh&t=fe&referer=https%3A%2F%2Frendezvousparis.hermes.com%2Fclient%2Fregister&s=40119&e=67fef144ac1a54dbd7507776367d2f9d5e36ec3add17fa22f3cb881db8385838",
|
|
255
|
-
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
|
|
256
|
-
proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
|
|
257
|
-
proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
|
|
258
|
-
})
|
|
259
|
-
.then((res) => {
|
|
260
|
-
console.log(res);
|
|
261
|
-
})
|
|
262
|
-
.catch((err) => {
|
|
263
|
-
console.log(err);
|
|
264
|
-
})
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### CyberSiARA
|
|
268
|
-
```js
|
|
269
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
270
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
solver.cyberSiARA({
|
|
274
|
-
pageurl: "https://www.cybersiara.com/book-a-demo",
|
|
275
|
-
master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
|
|
276
|
-
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
|
|
277
|
-
})
|
|
278
|
-
.then((res) => {
|
|
279
|
-
console.log(res);
|
|
280
|
-
})
|
|
281
|
-
.catch((err) => {
|
|
282
|
-
console.log(err);
|
|
283
|
-
})
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### MTCaptcha
|
|
287
|
-
```js
|
|
288
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
289
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
solver.mtCaptcha({
|
|
293
|
-
pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
|
|
294
|
-
sitekey: "MTPublic-DemoKey9M"
|
|
295
|
-
})
|
|
296
|
-
.then((res) => {
|
|
297
|
-
console.log(res);
|
|
298
|
-
})
|
|
299
|
-
.catch((err) => {
|
|
300
|
-
console.log(err);
|
|
301
|
-
})
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Coordinates (Click Captcha):
|
|
305
|
-
```js
|
|
306
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
307
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
308
|
-
const imageBase64 = fs.readFileSync("./tests/media/hCaptchaImage.jpg", "base64")
|
|
309
|
-
|
|
310
|
-
solver.coordinates({
|
|
311
|
-
body: imageBase64,
|
|
312
|
-
textinstructions: 'Select all photos containing the boat'
|
|
313
|
-
})
|
|
314
|
-
.then((res) => {
|
|
315
|
-
console.log(res);
|
|
316
|
-
})
|
|
317
|
-
.catch((err) => {
|
|
318
|
-
console.log(err);
|
|
319
|
-
})
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### Bounding Box Method:
|
|
323
|
-
```js
|
|
324
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
325
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
326
|
-
|
|
327
|
-
solver.boundingBox({
|
|
328
|
-
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
|
|
329
|
-
textinstructions: "Circle all the cars in the image.",
|
|
330
|
-
})
|
|
331
|
-
.then((res) => {
|
|
332
|
-
console.log(res);
|
|
333
|
-
})
|
|
334
|
-
.catch((err) => {
|
|
335
|
-
console.log(err);
|
|
336
|
-
})
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Proxy:
|
|
340
|
-
```js
|
|
341
|
-
const Captcha = require("@2captcha/captcha-solver")
|
|
342
|
-
const solver = new Captcha.Solver("<Your 2captcha api key>")
|
|
343
|
-
|
|
344
|
-
solver.recaptcha({
|
|
345
|
-
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
|
|
346
|
-
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
|
|
347
|
-
proxy: "login:password@1.2.3.4:8888", // 您正在使用的代理服务器的参数
|
|
348
|
-
proxytype: "HTTP" // 使用的代理服务器类型: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
349
|
-
})
|
|
350
|
-
.then((res) => {
|
|
351
|
-
console.log(res)
|
|
352
|
-
})
|
|
353
|
-
.catch((err) => {
|
|
354
|
-
console.error(err.message)
|
|
355
|
-
})
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
## 有用的文章
|
|
359
|
-
* [如何解决Geetest v4 captcha](https://2captcha.com/zh/blog/geetest-v4-support)
|
|
360
|
-
* [自动reCAPTCHA V3解决方案-开发人员和客户的说明](https://2captcha.com/zh/blog/recaptcha-v3-automatic-resolution)
|
|
361
|
-
* <a href="./docs/hcaptcha.md">搜索hCaptcha的`sitekey`值</a>
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIError = exports.Solver = void 0;
|
|
4
|
-
var _2captcha_1 = require("./structs/2captcha");
|
|
5
|
-
Object.defineProperty(exports, "Solver", { enumerable: true, get: function () { return _2captcha_1.Solver; } });
|
|
6
|
-
var _2captchaError_1 = require("./structs/2captchaError");
|
|
7
|
-
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return _2captchaError_1.APIError; } });
|
|
8
|
-
// export { Server } from "./structs/2captchaServer.js"
|