@2captcha/captcha-solver 1.2.0 → 1.3.1

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 CHANGED
@@ -1,578 +1,854 @@
1
- <a href="https://github.com/2captcha/2captcha-python"><img src="https://github.com/user-attachments/assets/37e1d860-033b-4cf3-a158-468fc6b4debc" width="82" height="30"></a>
2
- <a href="https://github.com/2captcha/2captcha-javascript"><img src="https://github.com/user-attachments/assets/371b271e-33c3-4217-af21-b95517a4677c" width="36" height="30"></a>
3
- <a href="https://github.com/2captcha/2captcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
4
- <a href="https://github.com/2captcha/2captcha-ruby"><img src="https://github.com/user-attachments/assets/0270d56f-79b0-4c95-9b09-4de89579914b" width="75" height="30"></a>
5
- <a href="https://github.com/2captcha/2captcha-cpp"><img src="https://github.com/user-attachments/assets/36de8512-acfd-44fb-bb1f-b7c793a3f926" width="45" height="30"></a>
6
- <a href="https://github.com/2captcha/2captcha-php"><img src="https://github.com/user-attachments/assets/e8797843-3f61-4fa9-a155-ab0b21fb3858" width="52" height="30"></a>
7
- <a href="https://github.com/2captcha/2captcha-java"><img src="https://github.com/user-attachments/assets/a3d923f6-4fec-4c07-ac50-e20da6370911" width="50" height="30"></a>
8
- <a href="https://github.com/2captcha/2captcha-csharp"><img src="https://github.com/user-attachments/assets/f4d449de-780b-49ed-bb0a-b70c82ec4b32" width="38" height="30"></a>
9
-
10
- # JavaScript module for 2Captcha API (captcha solver)
11
-
12
- The easiest way to quickly integrate the [2Captcha](https://2captcha.com/) captcha-solving service into your code and automate the solving of any type of captcha.
13
- Examples of API requests for different captcha types are available on the [JavaScript captcha solver](https://2captcha.com/lang/javascript) page.
14
-
15
- - [JavaScript module for 2Captcha API (captcha solver)](#javascript-module-for-2captcha-api-captcha-solver)
16
- - [Installation](#installation)
17
- - [Configuration](#configuration)
18
- - [TwoCaptcha instance options](#twocaptcha-instance-options)
19
- - [Solve captcha](#solve-captcha)
20
- - [Image captchas](#image-captcha)
21
- - [reCAPTCHA v2](#recaptcha-v2)
22
- - [reCAPTCHA v3](#recaptcha-v3)
23
- - [hCaptcha](#hcaptcha)
24
- - [FunCaptcha](#funcaptcha)
25
- - [GeeTest](#geetest-captcha)
26
- - [GeeTest V4](#geetest-v4-captcha)
27
- - [Yandex Smart Captcha](#yandex-smart-captcha)
28
- - [Lemin Cropped Captcha](#lemin-cropped-captcha)
29
- - [Cloudflare Turnstile](#cloudflare-turnstile)
30
- - [Amazon WAF](#amazon-waf)
31
- - [Capy](#capy)
32
- - [ClickCaptcha](#clickcaptcha)
33
- - [DataDome CAPTCHA](#datadome-captcha)
34
- - [CyberSiARA](#cybersiara)
35
- - [MTCaptcha](#mtcaptcha)
36
- - [Friendly Captcha](#friendly-captcha)
37
- - [Bounding Box Method](#bounding-box-method)
38
- - [Grid](#grid)
39
- - [Other methods](#other-methods)
40
- - [goodReport](#goodreport)
41
- - [badReport](#badreport)
42
- - [balance](#balance)
43
- - [Proxies](#proxies)
44
- - [Examples](#examples)
45
- - [Useful articles](#useful-articles)
46
- - [Get in touch](#get-in-touch)
47
- - [Join the team 👪](#join-the-team-)
48
-
49
-
50
- ## Installation
51
- This package can be installed with NPM:
52
-
53
- ```sh
54
- npm install @2captcha/captcha-solver
55
- ```
56
- or Yarn:
57
- ```sh
58
- yarn add @2captcha/captcha-solver
59
- ```
60
-
61
- ## Configuration
62
-
63
- TwoCaptcha instance can be created like this:
64
-
65
- ```js
66
- const TwoCaptcha = require("@2captcha/captcha-solver")
67
- const solver = new TwoCaptcha.Solver("<Your 2captcha api key>")
68
- ```
69
-
70
- Also, there are a few options that can be configured:
71
-
72
- ```javascript
73
- const apiKey = 'YOUR_API_KEY'
74
- const pollingInterval = 10
75
-
76
- const solver = new TwoCaptcha.Solver(apiKey, pollingInterval)
77
- ```
78
- ### TwoCaptcha instance options
79
-
80
- | Option | Default value | Description |
81
- | ---------------- | -------------- | -------------------------------------------------------------------------------------------- |
82
- | apiKey | - | Your API key |
83
- | pollingInterval | 5000 | Interval in milliseconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
84
-
85
- ## Solve captcha
86
-
87
- When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
88
-
89
- ### Captcha options
90
-
91
- | Option | Default Value | Description |
92
- | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
93
- | numeric | 0 | Defines if the captcha contains numeric or other symbols [see more info in the API docs][post options] |
94
- | min_len | 0 | minimal answer length |
95
- | max_len | 0 | maximum answer length |
96
- | phrase | 0 | defines if the answer contains multiple words or not |
97
- | regsense | 0 | defines if the answer is case sensitive |
98
- | calc | 0 | defines captcha requires calculation |
99
- | lang | - | defines the captcha language; see the [list of supported languages] |
100
- | textinstructions| - | hint or task text shown to workers with the captcha |
101
-
102
- Below you can find basic examples for every captcha type, check out the code below.
103
-
104
- ### Image captcha
105
-
106
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
107
-
108
- To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.
109
-
110
- ```js
111
- // Read from a file as base64 text
112
- const imageBase64 = fs.readFileSync("./examples/media/imageCaptcha_6e584.png", "base64")
113
-
114
- solver.imageCaptcha({
115
- body: imageBase64,
116
- numeric: 4,
117
- min_len: 5,
118
- max_len: 5
119
- })
120
- .then((res) => {
121
- // Logs the image text
122
- console.log(res);
123
- })
124
- .catch((err) => {
125
- console.log(err);
126
- })
127
- ```
128
-
129
- ### reCAPTCHA V2
130
-
131
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
132
-
133
- Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
134
-
135
- ```js
136
- solver.recaptcha({
137
- pageurl: 'https://2captcha.com/demo/recaptcha-v2',
138
- googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
139
- })
140
- .then((res) => {
141
- console.log(res);
142
- })
143
- .catch((err) => {
144
- console.log(err);
145
- })
146
- ```
147
-
148
- ### reCAPTCHA V3
149
-
150
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
151
-
152
- This method provides a reCAPTCHA V3 solver and returns a token.
153
-
154
- ```js
155
- solver.recaptcha({
156
- pageurl: 'https://2captcha.com/demo/recaptcha-v3',
157
- googlekey: '6Lcyqq8oAAAAAJE7eVJ3aZp_hnJcI6LgGdYD8lge',
158
- version: "v3",
159
- min_score: "0.4",
160
- action: 'demo_action'
161
- })
162
- .then((res) => {
163
- console.log(res);
164
- })
165
- .catch((err) => {
166
- console.log(err);
167
- })
168
- ```
169
-
170
-
171
- ### hCaptcha
172
-
173
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_hcaptcha)</sup>
174
-
175
- Use this method to solve the hCaptcha challenge. Returns a token to bypass the captcha.
176
-
177
- ```js
178
- solver.hcaptcha({
179
- pageurl: "https://2captcha.com/demo/hcaptcha?difficulty=moderate",
180
- sitekey: "b76cd927-d266-4cfb-a328-3b03ae07ded6"
181
- })
182
- .then((res) => {
183
- console.log(res);
184
- })
185
- .catch((err) => {
186
- console.log(err);
187
- })
188
- ```
189
-
190
- ### FunCaptcha
191
-
192
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
193
-
194
- FunCaptcha (Arkoselabs) solving method. Returns a token.
195
-
196
- ```js
197
- solver.funCaptcha({
198
- pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
199
- publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
200
- })
201
- .then((res) => {
202
- console.log(res);
203
- })
204
- .catch((err) => {
205
- console.log(err);
206
- })
207
- ```
208
-
209
- ### GeeTest Captcha
210
-
211
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
212
-
213
- Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
214
-
215
- ```js
216
- // Read more about `challenge` on the page https://2captcha.com/p/geetest
217
- solver.geetest({
218
- pageurl: 'https://2captcha.com/demo/geetest',
219
- gt: '81388ea1fc187e0c335c0a8907ff2625',
220
- challenge: '<you need to get a new challenge value each time>'
221
- })
222
- .then((res) => {
223
- console.log(res);
224
- })
225
- .catch((err) => {
226
- console.log(err);
227
- })
228
- ```
229
-
230
- ### GeeTest V4 Captcha
231
-
232
- <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
233
-
234
- Use this method to solve GeeTest v4. Returns the response in JSON.
235
-
236
- ```js
237
- solver.geetestV4({
238
- pageurl: 'https://2captcha.com/demo/geetest-v4',
239
- captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
240
- })
241
- .then((res) => {
242
- console.log(res);
243
- })
244
- .catch((err) => {
245
- console.log(err);
246
- })
247
- ```
248
-
249
- ### Yandex Smart Captcha
250
-
251
- Use this method to solve Yandex Smart Captcha and obtain a token to bypass the protection.
252
-
253
- ```js
254
- solver.yandexSmart({
255
- pageurl: "https://captcha-api.yandex.ru/demo",
256
- sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
257
- })
258
- .then((res) => {
259
- console.log(res);
260
- })
261
- .catch((err) => {
262
- console.log(err);
263
- })
264
- ```
265
-
266
- ### Lemin Cropped Captcha
267
-
268
- <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
269
-
270
- Use this method to solve Lemin and obtain a token to bypass the protection.
271
-
272
- ```js
273
- solver.lemin({
274
- pageurl:'https://2captcha.com/demo/lemin',
275
- captcha_id: 'CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
276
- div_id: 'lemin-cropped-captcha',
277
- api_server: 'api.leminnow.com'
278
- })
279
- .then((res) => {
280
- console.log(res);
281
- })
282
- .catch((err) => {
283
- console.log(err);
284
- })
285
- ```
286
-
287
- ### Cloudflare Turnstile
288
-
289
- <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
290
-
291
- Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
292
-
293
- Turnstile captcha has two types, one of them is Cloudflare Turnstile Challenge page. For Turnstile Challenge page cases, we have a [demo](https://github.com/2captcha/cloudflare-demo). Try this [demo](https://github.com/2captcha/cloudflare-demo) if you need to solve Cloudflare Turnstile Challenge page captcha.
294
-
295
- ```js
296
- solver.cloudflareTurnstile({
297
- pageurl: "https://app.nodecraft.com/login",
298
- sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
299
- })
300
- .then((res) => {
301
- console.log(res);
302
- })
303
- .catch((err) => {
304
- console.log(err);
305
- })
306
- ```
307
-
308
- ### Amazon WAF
309
-
310
- <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
311
-
312
- Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
313
-
314
- ```js
315
- //INFO: The `context` value is dynamic, it is necessary to take the actual value from the page each time.
316
- solver.amazonWaf({
317
- pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
318
- sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRt...",
319
- context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ...",
320
- iv: "CgAHbCe2GgAAAAAj",
321
- })
322
- .then((res) => {
323
- console.log(res);
324
- })
325
- .catch((err) => {
326
- console.log(err);
327
- })
328
- ```
329
-
330
- ### Capy
331
-
332
- <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
333
-
334
- Token-based method to bypass Capy puzzle captcha.
335
-
336
- ```js
337
- solver.capyPuzzle({
338
- pageurl: "https://www.capy.me/account/register/",
339
- captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
340
- })
341
- .then((res) => {
342
- console.log(res);
343
- })
344
- .catch((err) => {
345
- console.log(err);
346
- })
347
- ```
348
-
349
- ### DataDome CAPTCHA
350
-
351
- <sup>[API method description.](https://2captcha.com/2captcha-api#datadome)</sup>
352
-
353
- Use this method to solve DataDome and obtain a token to bypass the protection.
354
-
355
- > [!IMPORTANT]
356
- > To solve the DataDome captcha, you must use a proxy. It is recommended to use [residential proxies][Buy residential proxies].
357
-
358
- ```js
359
- solver.dataDome({
360
- pageurl: "https://rendezvousparis.hermes.com/client/register",
361
- 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",
362
- userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
363
- proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
364
- proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
365
- })
366
- .then((res) => {
367
- console.log(res);
368
- })
369
- .catch((err) => {
370
- console.log(err);
371
- })
372
- ```
373
-
374
- ### CyberSiARA
375
-
376
- <sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
377
-
378
- Use this method to solve CyberSiARA and obtain a token to bypass the protection.
379
-
380
- ```js
381
- solver.cyberSiARA({
382
- pageurl: "https://www.cybersiara.com/book-a-demo",
383
- master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
384
- userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
385
- })
386
- .then((res) => {
387
- console.log(res);
388
- })
389
- .catch((err) => {
390
- console.log(err);
391
- })
392
- ```
393
-
394
- ### MTCaptcha
395
-
396
- <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
397
-
398
- Use this method to solve MTCaptcha and obtain a token to bypass the protection.
399
-
400
- ```js
401
- solver.mtCaptcha({
402
- pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
403
- sitekey: "MTPublic-DemoKey9M"
404
- })
405
- .then((res) => {
406
- console.log(res);
407
- })
408
- .catch((err) => {
409
- console.log(err);
410
- })
411
- ```
412
-
413
- ### Friendly Captcha
414
-
415
- <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
416
-
417
- Use this method to solve Friendly Captcha and obtain a token to bypass the protection.
418
-
419
- > [!IMPORTANT]
420
- > To successfully use the received token, the captcha widget must not be loaded on the page. To do this, you need to abort request to `/friendlycaptcha/...module.min.js` on the page. When the captcha widget is already loaded on the page, there is a high probability that the received token will not work.
421
-
422
- ```js
423
- solver.friendlyCaptcha({
424
- pageurl: "https://geizhals.de/?liftban=1&from=/455973138?fsean=5901747021356",
425
- sitekey: "FCMST5VUMCBOCGQ9"
426
- })
427
- .then((res) => {
428
- console.log(res);
429
- })
430
- .catch((err) => {
431
- console.log(err);
432
- })
433
- ```
434
-
435
- ### ClickCaptcha
436
-
437
- <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
438
-
439
- The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.
440
-
441
- ```js
442
- const imageBase64 = fs.readFileSync("./tests/media/hCaptchaImage.jpg", "base64")
443
-
444
- solver.coordinates({
445
- body: imageBase64,
446
- textinstructions: 'Select all photos containing the boat'
447
- })
448
- .then((res) => {
449
- console.log(res);
450
- })
451
- .catch((err) => {
452
- console.log(err);
453
- })
454
- ```
455
-
456
- ### Bounding Box Method
457
-
458
- <sup>[API method description.](https://2captcha.com/2captcha-api#bounding_box)</sup>
459
-
460
-
461
- Use Bounding Box Method when you need to select objects on the image. To do this, you need to pass the markup instructions and image for markup. The instructions can be sent as text or as an image encoded in `base64` format.
462
- > [!IMPORTANT]
463
- > You must to send instruction `imginstructions` or `textinstructions`.
464
-
465
- ```js
466
- solver.boundingBox({
467
- image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
468
- textinstructions: "Circle all the cars in the image.",
469
- })
470
- .then((res) => {
471
- console.log(res);
472
- })
473
- .catch((err) => {
474
- console.log(err);
475
- })
476
- ```
477
-
478
- ### Grid
479
-
480
- <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
481
-
482
- This method allows to solve any captcha where image can be divided into equal parts like reCAPTCHA V2 or hCaptcha. A grid is applied above the image. And you receive the numbers clicked boxes.
483
-
484
- > [!IMPORTANT]
485
- > You must to send instruction `imginstructions` or `textinstructions`.
486
-
487
- ```js
488
- solver.grid({
489
- body: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
490
- textinstructions: "Select cars in the image"
491
- })
492
- .then((res) => {
493
- console.log(res);
494
- })
495
- .catch((err) => {
496
- console.log(err);
497
- })
498
- ```
499
-
500
- ## Other methods
501
-
502
- ### goodReport
503
-
504
- <sup>[API method description.](https://2captcha.com/2captcha-api#reporting-answers)</sup>
505
-
506
- Use this method to report good captcha answer.
507
-
508
- ```js
509
- solver.goodReport('7031846604')
510
- ```
511
-
512
- ### badReport
513
-
514
- <sup>[API method description.](https://2captcha.com/2captcha-api#reporting-answers)</sup>
515
-
516
- Use this method to report bad captcha answer.
517
-
518
- ```js
519
- solver.badReport('7031854546')
520
- ```
521
-
522
- ### balance
523
-
524
- <sup>[API method description.](https://2captcha.com/2captcha-api#additional-methods)</sup>
525
-
526
- Use this method to get your account's balance.
527
-
528
- ```js
529
- solver.balance()
530
- .then((res) => {
531
- console.log(res)
532
- })
533
- ```
534
-
535
- ## Proxies
536
-
537
- You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, hcaptcha, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, DataDome, CyberSiARA, MTCaptcha, Friendly Captcha and etc. The proxy will be forwarded to the API to solve the captcha.
538
-
539
- We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
540
-
541
- Solving reCAPTCHA V2 using proxy:
542
- ```js
543
- solver.recaptcha({
544
- pageurl: 'https://2captcha.com/demo/recaptcha-v2',
545
- googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
546
- proxy: 'HTTPS',
547
- proxytype: 'login:password@123.123.123.123:3128'
548
- })
549
- ```
550
- ## Examples
551
-
552
- Examples of solving all supported captcha types are located in the [examples] directory.
553
-
554
- ## Useful articles
555
- * [How to bypass captcha using JavaScript](https://2captcha.com/blog/how-to-use-javascript-to-bypass-captcha#how-to-solve-and-bypass-a-captcha-with-javascript-using-npm-package-2captchacaptcha-solver)
556
- * [Bypassing Cloudflare Challenge with Puppeteer and 2Captcha](https://2captcha.com/blog/bypassing-cloudflare-challenge-with-puppeteer-and-2captcha)
557
- * [How to bypass Geetest v4 CAPTCHA](https://2captcha.com/blog/geetest-v4-support)
558
- * [Automatic reCAPTCHA V3 resolution - a tutorial for developers and customers](https://2captcha.com/blog/recaptcha-v3-automatic-resolution)
559
- * [Custom Slider Captcha Demo](https://github.com/2captcha/custom-slider-demo)
560
- * [Cloudflare Challenge page bypass code example](https://github.com/2captcha/cloudflare-demo)
561
-
562
- ## Get in touch
563
-
564
- <a href="mailto:support@2captcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
565
- <a href="https://2captcha.com/support/tickets/new"><img src="https://github.com/user-attachments/assets/be044db5-2e67-46c6-8c81-04b78bd99650" width="81" height="30"></a>
566
-
567
- ## Join the team 👪
568
-
569
- There are many ways to contribute, of which development is only one! Find your next job. Open positions: AI experts, scrapers, developers, technical support, and much more! 😍
570
-
571
- <a href="mailto:job@2captcha.com"><img src="https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033" width="80" height="30"></a>
572
-
573
- <!-- Shared links -->
574
- [post options]: https://2captcha.com/2captcha-api#normal_post
575
- [list of supported languages]: https://2captcha.com/2captcha-api#language
576
- [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
577
- [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
578
- [examples]: ./examples
1
+ <a href="https://github.com/2captcha/2captcha-python"><img src="https://github.com/user-attachments/assets/37e1d860-033b-4cf3-a158-468fc6b4debc" width="82" height="30"></a>
2
+ <a href="https://github.com/2captcha/2captcha-javascript"><img src="https://github.com/user-attachments/assets/371b271e-33c3-4217-af21-b95517a4677c" width="36" height="30"></a>
3
+ <a href="https://github.com/2captcha/2captcha-go"><img src="https://github.com/user-attachments/assets/ab22182e-6cb2-41fa-91f4-d5e89c6d7c6f" width="63" height="30"></a>
4
+ <a href="https://github.com/2captcha/2captcha-ruby"><img src="https://github.com/user-attachments/assets/0270d56f-79b0-4c95-9b09-4de89579914b" width="75" height="30"></a>
5
+ <a href="https://github.com/2captcha/2captcha-cpp"><img src="https://github.com/user-attachments/assets/36de8512-acfd-44fb-bb1f-b7c793a3f926" width="45" height="30"></a>
6
+ <a href="https://github.com/2captcha/2captcha-php"><img src="https://github.com/user-attachments/assets/e8797843-3f61-4fa9-a155-ab0b21fb3858" width="52" height="30"></a>
7
+ <a href="https://github.com/2captcha/2captcha-java"><img src="https://github.com/user-attachments/assets/a3d923f6-4fec-4c07-ac50-e20da6370911" width="50" height="30"></a>
8
+ <a href="https://github.com/2captcha/2captcha-csharp"><img src="https://github.com/user-attachments/assets/f4d449de-780b-49ed-bb0a-b70c82ec4b32" width="38" height="30"></a>
9
+
10
+ # JavaScript module for 2Captcha API (captcha solver)
11
+
12
+ The easiest way to quickly integrate the [2Captcha] captcha-solving service into your code and automate the solving of any type of captcha.
13
+ Examples of API requests for different captcha types are available on the [JavaScript captcha solver] page.
14
+
15
+ - [JavaScript module for 2Captcha API (captcha solver)](#javascript-module-for-2captcha-api-captcha-solver)
16
+ - [Installation](#installation)
17
+ - [Configuration](#configuration)
18
+ - [TwoCaptcha instance options](#twocaptcha-instance-options)
19
+ - [Solve captcha](#solve-captcha)
20
+ - [Image Captcha](#image-captcha)
21
+ - [reCAPTCHA v2](#recaptcha-v2)
22
+ - [reCAPTCHA v3](#recaptcha-v3)
23
+ - [FunCaptcha](#funcaptcha)
24
+ - [GeeTest](#geetest-captcha)
25
+ - [GeeTest V4](#geetest-v4-captcha)
26
+ - [Yandex Smart Captcha](#yandex-smart-captcha)
27
+ - [Lemin Cropped Captcha](#lemin-cropped-captcha)
28
+ - [Cloudflare Turnstile](#cloudflare-turnstile)
29
+ - [Amazon WAF](#amazon-waf)
30
+ - [Capy](#capy)
31
+ - [ClickCaptcha](#clickcaptcha)
32
+ - [DataDome CAPTCHA](#datadome-captcha)
33
+ - [CyberSiARA](#cybersiara)
34
+ - [MTCaptcha](#mtcaptcha)
35
+ - [Friendly Captcha](#friendly-captcha)
36
+ - [Bounding Box Method](#bounding-box-method)
37
+ - [Grid](#grid)
38
+ - [Text Captcha](#text-captcha)
39
+ - [Canvas](#canvas)
40
+ - [Rotate](#rotate)
41
+ - [KeyCaptcha](#keycaptcha)
42
+ - [Cutcaptcha](#cutcaptcha)
43
+ - [Tencent](#tencent)
44
+ - [atbCAPTCHA](#atbcaptcha)
45
+ - [Prosopo](#prosopo)
46
+ - [CaptchaFox](#captchafox)
47
+ - [VkImage](#vkimage)
48
+ - [VkCaptcha](#vkcaptcha)
49
+ - [Temu](#temu)
50
+ - [Audio Captcha](#audio-captcha)
51
+ - [Other methods](#other-methods)
52
+ - [goodReport](#goodreport)
53
+ - [badReport](#badreport)
54
+ - [balance](#balance)
55
+ - [Proxies](#proxies)
56
+ - [Examples](#examples)
57
+ - [Examples using Puppeteer](#examples-using-puppeteer)
58
+ - [Useful articles](#useful-articles)
59
+ - [Get in touch](#get-in-touch)
60
+ - [Join the team 👪](#join-the-team-)
61
+ - [License](#license)
62
+ - [Graphics and Trademarks](#graphics-and-trademarks)
63
+
64
+
65
+ ## Installation
66
+ This package can be installed with NPM:
67
+
68
+ ```sh
69
+ npm install @2captcha/captcha-solver
70
+ ```
71
+ or Yarn:
72
+ ```sh
73
+ yarn add @2captcha/captcha-solver
74
+ ```
75
+
76
+ ## Configuration
77
+
78
+ TwoCaptcha instance can be created like this:
79
+
80
+ ```js
81
+ const TwoCaptcha = require("@2captcha/captcha-solver")
82
+ const solver = new TwoCaptcha.Solver("<Your 2captcha api key>")
83
+ ```
84
+
85
+ Also, there are a few options that can be configured:
86
+
87
+ ```javascript
88
+ const apiKey = 'YOUR_API_KEY'
89
+ const pollingInterval = 10
90
+
91
+ const solver = new TwoCaptcha.Solver(apiKey, pollingInterval)
92
+ ```
93
+ ### TwoCaptcha instance options
94
+
95
+ | Option | Default value | Description |
96
+ | ---------------- | -------------- | -------------------------------------------------------------------------------------------- |
97
+ | apiKey | - | Your API key |
98
+ | pollingInterval | 5000 | Interval in milliseconds between requests to the `res.php` API endpoint. Setting values less than 5 seconds is not recommended |
99
+
100
+ ## Solve captcha
101
+
102
+ When you submit any image-based captcha use can provide additional options to help 2captcha workers to solve it properly.
103
+
104
+ ### Captcha options
105
+
106
+ | Option | Default Value | Description |
107
+ | ------------- | ------------- | -------------------------------------------------------------------------------------------------- |
108
+ | numeric | 0 | Defines if the captcha contains numeric or other symbols [see more info in the API docs][post options] |
109
+ | min_len | 0 | minimal answer length |
110
+ | max_len | 0 | maximum answer length |
111
+ | phrase | 0 | defines if the answer contains multiple words or not |
112
+ | regsense | 0 | defines if the answer is case sensitive |
113
+ | calc | 0 | defines captcha requires calculation |
114
+ | lang | - | defines the captcha language; see the [list of supported languages] |
115
+ | textinstructions| - | hint or task text shown to workers with the captcha |
116
+
117
+ Below you can find basic examples for every captcha type, check out the code below.
118
+
119
+ ### Image captcha
120
+
121
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_normal_captcha)</sup>
122
+
123
+ To bypass a normal captcha (distorted text on an image) use the following method. This method can also be used to recognize any text in an image.
124
+
125
+ ```js
126
+ const imageBase64 = fs.readFileSync("./examples/media/imageCaptcha_6e584.png", "base64")
127
+
128
+ solver.imageCaptcha({
129
+ body: imageBase64,
130
+ numeric: 4,
131
+ min_len: 5,
132
+ max_len: 5
133
+ })
134
+ .then((res) => {
135
+ console.log(res);
136
+ })
137
+ .catch((err) => {
138
+ console.log(err);
139
+ })
140
+ ```
141
+
142
+ ### reCAPTCHA V2
143
+
144
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav2_new)</sup>
145
+
146
+ Use the following method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
147
+
148
+ ```js
149
+ solver.recaptcha({
150
+ pageurl: 'https://2captcha.com/demo/recaptcha-v2',
151
+ googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
152
+ })
153
+ .then((res) => {
154
+ console.log(res);
155
+ })
156
+ .catch((err) => {
157
+ console.log(err);
158
+ })
159
+ ```
160
+
161
+ ### reCAPTCHA V3
162
+
163
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_recaptchav3)</sup>
164
+
165
+ This method provides a reCAPTCHA V3 solver and returns a token.
166
+
167
+ ```js
168
+ solver.recaptcha({
169
+ pageurl: 'https://2captcha.com/demo/recaptcha-v3',
170
+ googlekey: '6Lcyqq8oAAAAAJE7eVJ3aZp_hnJcI6LgGdYD8lge',
171
+ version: "v3",
172
+ min_score: "0.4",
173
+ action: 'demo_action'
174
+ })
175
+ .then((res) => {
176
+ console.log(res);
177
+ })
178
+ .catch((err) => {
179
+ console.log(err);
180
+ })
181
+ ```
182
+
183
+ ### FunCaptcha
184
+
185
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_funcaptcha_new)</sup>
186
+
187
+ FunCaptcha (Arkoselabs) solving method. Returns a token.
188
+
189
+ ```js
190
+ solver.funCaptcha({
191
+ pageurl: "https://funcaptcha.com/tile-game-lite-mode/fc/api/nojs/?pkey=804380F4-6844-FFA1-ED4E-5877CA1F1EA4&lang=en",
192
+ publickey: "804380F4-6844-FFA1-ED4E-5877CA1F1EA4"
193
+ })
194
+ .then((res) => {
195
+ console.log(res);
196
+ })
197
+ .catch((err) => {
198
+ console.log(err);
199
+ })
200
+ ```
201
+
202
+ ### GeeTest Captcha
203
+
204
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_geetest)</sup>
205
+
206
+ Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
207
+
208
+ ```js
209
+ // Read more about `challenge` on the page https://2captcha.com/p/geetest
210
+ solver.geetest({
211
+ pageurl: 'https://2captcha.com/demo/geetest',
212
+ gt: '81388ea1fc187e0c335c0a8907ff2625',
213
+ challenge: '<you need to get a new challenge value each time>'
214
+ })
215
+ .then((res) => {
216
+ console.log(res);
217
+ })
218
+ .catch((err) => {
219
+ console.log(err);
220
+ })
221
+ ```
222
+
223
+ ### GeeTest V4 Captcha
224
+
225
+ <sup>[API method description.](https://2captcha.com/2captcha-api#geetest-v4)</sup>
226
+
227
+ Use this method to solve GeeTest v4. Returns the response in JSON.
228
+
229
+ ```js
230
+ solver.geetestV4({
231
+ pageurl: 'https://2captcha.com/demo/geetest-v4',
232
+ captcha_id: 'e392e1d7fd421dc63325744d5a2b9c73'
233
+ })
234
+ .then((res) => {
235
+ console.log(res);
236
+ })
237
+ .catch((err) => {
238
+ console.log(err);
239
+ })
240
+ ```
241
+
242
+ ### Yandex Smart Captcha
243
+
244
+ Use this method to solve Yandex Smart Captcha and obtain a token to bypass the protection.
245
+
246
+ ```js
247
+ solver.yandexSmart({
248
+ pageurl: "https://captcha-api.yandex.ru/demo",
249
+ sitekey: "FEXfAbHQsToo97VidNVk3j4dC74nGW1DgdxjtNB9"
250
+ })
251
+ .then((res) => {
252
+ console.log(res);
253
+ })
254
+ .catch((err) => {
255
+ console.log(err);
256
+ })
257
+ ```
258
+
259
+ ### Lemin Cropped Captcha
260
+
261
+ <sup>[API method description.](https://2captcha.com/2captcha-api#lemin)</sup>
262
+
263
+ Use this method to solve Lemin and obtain a token to bypass the protection.
264
+
265
+ ```js
266
+ solver.lemin({
267
+ pageurl:'https://2captcha.com/demo/lemin',
268
+ captcha_id: 'CROPPED_3dfdd5c_d1872b526b794d83ba3b365eb15a200b',
269
+ div_id: 'lemin-cropped-captcha',
270
+ api_server: 'api.leminnow.com'
271
+ })
272
+ .then((res) => {
273
+ console.log(res);
274
+ })
275
+ .catch((err) => {
276
+ console.log(err);
277
+ })
278
+ ```
279
+
280
+ ### Cloudflare Turnstile
281
+
282
+ <sup>[API method description.](https://2captcha.com/2captcha-api#turnstile)</sup>
283
+
284
+ Use this method to solve Cloudflare Turnstile. Returns JSON with the token.
285
+
286
+ Turnstile captcha has two types, one of them is Cloudflare Turnstile Challenge page. For Turnstile Challenge page cases, we have a [demo](https://github.com/2captcha/cloudflare-demo). Try this [demo](https://github.com/2captcha/cloudflare-demo) if you need to solve Cloudflare Turnstile Challenge page captcha.
287
+
288
+ ```js
289
+ solver.cloudflareTurnstile({
290
+ pageurl: "https://app.nodecraft.com/login",
291
+ sitekey: "0x4AAAAAAAAkg0s3VIOD10y4"
292
+ })
293
+ .then((res) => {
294
+ console.log(res);
295
+ })
296
+ .catch((err) => {
297
+ console.log(err);
298
+ })
299
+ ```
300
+
301
+ ### Amazon WAF
302
+
303
+ <sup>[API method description.](https://2captcha.com/2captcha-api#amazon-waf)</sup>
304
+
305
+ Use this method to solve Amazon WAF Captcha also known as AWS WAF Captcha is a part of Intelligent threat mitigation for Amazon AWS. Returns JSON with the token.
306
+
307
+ ```js
308
+ //INFO: The `context` value is dynamic, it is necessary to take the actual value from the page each time.
309
+ solver.amazonWaf({
310
+ pageurl: "https://non-existent-example.execute-api.us-east-1.amazonaws.com/latest",
311
+ sitekey: "AQIDAHjcYu/GjX+QlghicBgQ/7bFaQZ+m5FKCMDnO+vTbNg96AHMDLodoefdvyOnsHMRt...",
312
+ context: "9BUgmlm48F92WUoqv97a49ZuEJJ50TCk9MVr3C7WMtQ0X6flVbufM4n8mjFLmbLVAPgaQ...",
313
+ iv: "CgAHbCe2GgAAAAAj",
314
+ })
315
+ .then((res) => {
316
+ console.log(res);
317
+ })
318
+ .catch((err) => {
319
+ console.log(err);
320
+ })
321
+ ```
322
+
323
+ ### Capy
324
+
325
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_capy)</sup>
326
+
327
+ Token-based method to bypass Capy puzzle captcha.
328
+
329
+ ```js
330
+ solver.capyPuzzle({
331
+ pageurl: "https://www.capy.me/account/register/",
332
+ captchakey: "PUZZLE_Cme4hZLjuZRMYC3uh14C52D3uNms5w"
333
+ })
334
+ .then((res) => {
335
+ console.log(res);
336
+ })
337
+ .catch((err) => {
338
+ console.log(err);
339
+ })
340
+ ```
341
+
342
+ ### DataDome CAPTCHA
343
+
344
+ <sup>[API method description.](https://2captcha.com/2captcha-api#datadome)</sup>
345
+
346
+ Use this method to solve DataDome and obtain a token to bypass the protection.
347
+
348
+ > [!IMPORTANT]
349
+ > To solve the DataDome captcha, you must use a proxy. It is recommended to use [residential proxies][Buy residential proxies].
350
+
351
+ ```js
352
+ solver.dataDome({
353
+ pageurl: "https://rendezvousparis.hermes.com/client/register",
354
+ 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",
355
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
356
+ proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
357
+ proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
358
+ })
359
+ .then((res) => {
360
+ console.log(res);
361
+ })
362
+ .catch((err) => {
363
+ console.log(err);
364
+ })
365
+ ```
366
+
367
+ ### CyberSiARA
368
+
369
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cybersiara)</sup>
370
+
371
+ Use this method to solve CyberSiARA and obtain a token to bypass the protection.
372
+
373
+ ```js
374
+ solver.cyberSiARA({
375
+ pageurl: "https://www.cybersiara.com/book-a-demo",
376
+ master_url_id: "OXR2LVNvCuXykkZbB8KZIfh162sNT8S2",
377
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
378
+ })
379
+ .then((res) => {
380
+ console.log(res);
381
+ })
382
+ .catch((err) => {
383
+ console.log(err);
384
+ })
385
+ ```
386
+
387
+ ### MTCaptcha
388
+
389
+ <sup>[API method description.](https://2captcha.com/2captcha-api#mtcaptcha)</sup>
390
+
391
+ Use this method to solve MTCaptcha and obtain a token to bypass the protection.
392
+
393
+ ```js
394
+ solver.mtCaptcha({
395
+ pageurl: "https://service.mtcaptcha.com/mtcv1/demo/index.html",
396
+ sitekey: "MTPublic-DemoKey9M"
397
+ })
398
+ .then((res) => {
399
+ console.log(res);
400
+ })
401
+ .catch((err) => {
402
+ console.log(err);
403
+ })
404
+ ```
405
+
406
+ ### Friendly Captcha
407
+
408
+ <sup>[API method description.](https://2captcha.com/2captcha-api#friendly-captcha)</sup>
409
+
410
+ Use this method to solve Friendly Captcha and obtain a token to bypass the protection.
411
+
412
+ > [!IMPORTANT]
413
+ > To successfully use the received token, the captcha widget must not be loaded on the page. To do this, you need to abort request to `/friendlycaptcha/...module.min.js` on the page. When the captcha widget is already loaded on the page, there is a high probability that the received token will not work.
414
+
415
+ ```js
416
+ solver.friendlyCaptcha({
417
+ pageurl: "https://geizhals.de/?liftban=1&from=/455973138?fsean=5901747021356",
418
+ sitekey: "FCMST5VUMCBOCGQ9"
419
+ })
420
+ .then((res) => {
421
+ console.log(res);
422
+ })
423
+ .catch((err) => {
424
+ console.log(err);
425
+ })
426
+ ```
427
+
428
+ ### ClickCaptcha
429
+
430
+ <sup>[API method description.](https://2captcha.com/2captcha-api#coordinates)</sup>
431
+
432
+ The ClickCaptcha method returns the coordinates of points on the captcha image. It can be used if you need to click on particular points in the image.
433
+
434
+ ```js
435
+ const imageBase64 = fs.readFileSync("./tests/media/coordinates.jpg", "base64")
436
+
437
+ solver.coordinates({
438
+ body: imageBase64,
439
+ textinstructions: 'Select all photos containing the boat'
440
+ })
441
+ .then((res) => {
442
+ console.log(res);
443
+ })
444
+ .catch((err) => {
445
+ console.log(err);
446
+ })
447
+ ```
448
+
449
+ ### Bounding Box Method
450
+
451
+ <sup>[API method description.](https://2captcha.com/2captcha-api#bounding_box)</sup>
452
+
453
+
454
+ Use Bounding Box Method when you need to select objects on the image. To do this, you need to pass the markup instructions and image for markup. The instructions can be sent as text or as an image encoded in `base64` format.
455
+ > [!IMPORTANT]
456
+ > You must to send instruction `imginstructions` or `textinstructions`.
457
+
458
+ ```js
459
+ solver.boundingBox({
460
+ image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
461
+ textinstructions: "Circle all the cars in the image.",
462
+ })
463
+ .then((res) => {
464
+ console.log(res);
465
+ })
466
+ .catch((err) => {
467
+ console.log(err);
468
+ })
469
+ ```
470
+
471
+ ### Grid
472
+
473
+ <sup>[API method description.](https://2captcha.com/2captcha-api#grid)</sup>
474
+
475
+ This method allows to solve any captcha where image can be divided into equal parts like reCAPTCHA V2. A grid is applied above the image. And you receive the numbers clicked boxes.
476
+
477
+ > [!IMPORTANT]
478
+ > You must to send instruction `imginstructions` or `textinstructions`.
479
+
480
+ ```js
481
+ solver.grid({
482
+ body: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACwCAIAAAB...",
483
+ textinstructions: "Select cars in the image"
484
+ })
485
+ .then((res) => {
486
+ console.log(res);
487
+ })
488
+ .catch((err) => {
489
+ console.log(err);
490
+ })
491
+ ```
492
+
493
+ ### Text Captcha
494
+
495
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
496
+
497
+ This method can be used to bypass a captcha that requires answering a question provided in clear text.
498
+
499
+ ```js
500
+ solver.textCaptcha({
501
+ textcaptcha: "If tomorrow is Saturday, what day is today?",
502
+ lang: 'en'
503
+ })
504
+ .then((res) => {
505
+ console.log(res);
506
+ })
507
+ .catch((err) => {
508
+ console.log(err);
509
+ })
510
+ ```
511
+
512
+ ### Canvas
513
+
514
+ <sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
515
+
516
+ The canvas method can be used when you need to draw a line around an object on an image. Returns a set of points' coordinates to draw a polygon.
517
+
518
+ ```js
519
+ solver.canvas({
520
+ body: 'iVBORw0KGgoAAAANSgAAAcIA...',
521
+ imginstructions: '/9j/4AAQSkZJRgABAQEA...',
522
+ textinstructions: 'Highlight the red CIRCLE'
523
+ })
524
+ .then((res) => {
525
+ console.log(res);
526
+ })
527
+ .catch((err) => {
528
+ console.log(err);
529
+ })
530
+ ```
531
+
532
+ ### Rotate
533
+
534
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
535
+
536
+ This method can be used to solve a captcha that asks to rotate an object. It is mostly used to bypass FunCaptcha. Returns the rotation angle.
537
+
538
+ ```js
539
+ solver.rotate({
540
+ body: imageBase64,
541
+ textinstructions: "Rotate the object to the correct position"
542
+ })
543
+ .then((res) => {
544
+ console.log(res);
545
+ })
546
+ .catch((err) => {
547
+ console.log(err);
548
+ })
549
+ ```
550
+
551
+ ### KeyCaptcha
552
+
553
+ <sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
554
+
555
+ Token-based method to solve KeyCaptcha.
556
+
557
+ ```js
558
+ solver.keyCaptcha({
559
+ pageurl: "https://2captcha.com/demo/keycaptcha",
560
+ userId: '184015',
561
+ sessionId: '0917788cad24ad3a69813c4fcd556061',
562
+ webServerSign: '02f7f9669f1269595c4c69bcd4a3c52e',
563
+ webServerSign2: 'd888700f6f324ec0f32b44c32c50bde1'
564
+ })
565
+ .then((res) => {
566
+ console.log(res);
567
+ })
568
+ .catch((err) => {
569
+ console.log(err);
570
+ })
571
+ ```
572
+
573
+ ### Cutcaptcha
574
+
575
+ <sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
576
+
577
+ Use this method to solve Cutcaptcha. Returns the response in JSON.
578
+
579
+ ```js
580
+ solver.cutCaptcha({
581
+ pageurl: "https://mysite.com/page/with/cutcaptcha",
582
+ misery_key: "098e6a849af406142e3150dbf4e6d0538db2b51f",
583
+ api_key: "SAs61IAI",
584
+ })
585
+ .then((res) => {
586
+ console.log(res);
587
+ })
588
+ .catch((err) => {
589
+ console.log(err);
590
+ })
591
+ ```
592
+
593
+ ### Tencent
594
+
595
+ <sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
596
+
597
+ Use this method to solve Tencent captcha. Returns the response in JSON.
598
+
599
+ ```js
600
+ solver.tencent({
601
+ pageurl: "https://mysite.com/page/with/tencent",
602
+ appId: "189956587"
603
+ })
604
+ .then((res) => {
605
+ console.log(res);
606
+ })
607
+ .catch((err) => {
608
+ console.log(err);
609
+ })
610
+ ```
611
+
612
+ ### atbCAPTCHA
613
+
614
+ <sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
615
+
616
+ Use this method to solve atbCAPTCHA challenge. Returns a token to bypass the captcha.
617
+
618
+ ```js
619
+ solver.atbCaptcha({
620
+ pageurl: "https://mysite.com/page/with/atbCAPTCHA",
621
+ appId: "af25e409b33d722a95e56a230ff8771c",
622
+ apiServer: "https://cap.aisecurius.com"
623
+ })
624
+ .then((res) => {
625
+ console.log(res);
626
+ })
627
+ .catch((err) => {
628
+ console.log(err);
629
+ })
630
+ ```
631
+
632
+ ### Prosopo
633
+
634
+ <sup>[API method description.](http://2captcha.com/2captcha-api#prosopo-procaptcha)</sup>
635
+
636
+ Use this method to solve Prosopo and obtain a token to bypass the protection.
637
+
638
+ ```js
639
+ solver.prosopo({
640
+ pageurl: "https://mysite.com/page/with/prosopo",
641
+ sitekey: "5DWvYfCSGqbUiQ..."
642
+ })
643
+ .then((res) => {
644
+ console.log(res);
645
+ })
646
+ .catch((err) => {
647
+ console.log(err);
648
+ })
649
+ ```
650
+
651
+ ### CaptchaFox
652
+
653
+ <sup>[API method description.](https://2captcha.com/2captcha-api#captchafox)</sup>
654
+
655
+ Use this method to solve CaptchaFox and obtain a token to bypass the protection.
656
+
657
+ > [!IMPORTANT]
658
+ > To solve the CaptchaFox, you must use a proxy. It is recommended to use [residential proxies][Buy residential proxies].
659
+
660
+ ```js
661
+ solver.captchaFox({
662
+ pageurl: "https://mysite.com/page/with/captchafox",
663
+ sitekey: "sk_ILKWN...",
664
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...",
665
+ proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
666
+ proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
667
+ })
668
+ .then((res) => {
669
+ console.log(res);
670
+ })
671
+ .catch((err) => {
672
+ console.log(err);
673
+ })
674
+ ```
675
+
676
+ ### VkImage
677
+
678
+ <sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
679
+
680
+ This method can be used to solve VK captcha using graphical captcha. Returns the number of steps and solution value in the target site's API format.
681
+
682
+ ```js
683
+ solver.vkimage({
684
+ body: "iVBORw0KGgoAAAANSUhEUgAAAcIA...",
685
+ steps: "[5,19,4,3,23,8,20,4,18,10,6,10,5,12,13,18,9,14,9,15,12,19,3,12,...]",
686
+ })
687
+ .then((res) => {
688
+ console.log(res);
689
+ })
690
+ .catch((err) => {
691
+ console.log(err);
692
+ })
693
+ ```
694
+
695
+ ### VkCaptcha
696
+
697
+ <sup>[API method description.](https://2captcha.com/2captcha-api#vkcaptcha)</sup>
698
+
699
+ Use this method to solve VkCaptcha and obtain a token to bypass the protection.
700
+
701
+ > [!IMPORTANT]
702
+ > To solve the VkCaptcha, you must use a proxy. It is recommended to use [residential proxies][Buy residential proxies].
703
+
704
+ ```js
705
+ solver.vkcaptcha({
706
+ redirect_uri: "https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJhbGciOiJBM...",
707
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...",
708
+ proxy: "login:password@1.2.3.4:8888", // The (Username : Password @ Address : Port) of our chosen proxy
709
+ proxytype: "http" // The 'Type' of proxy, http, https, socks, ect.
710
+ })
711
+ .then((res) => {
712
+ console.log(res);
713
+ })
714
+ .catch((err) => {
715
+ console.log(err);
716
+ })
717
+ ```
718
+
719
+ ### Temu
720
+
721
+ <sup>[API method description.](https://2captcha.com/ru/2captcha-api#temucaptcha)</sup>
722
+
723
+ This method can be used to solve Temu captcha. Returns a coordinates.
724
+
725
+ ```js
726
+ solver.temu({
727
+ body: "data:image/png;base64,iVBORw0KG...",
728
+ part1: "data:image/png;base64,iVBORw0KG...",
729
+ part2: "data:image/png;base64,iVBORw0KG...",
730
+ part3: "data:image/png;base64,iVBORw0KG...",
731
+ })
732
+ .then((res) => {
733
+ console.log(res);
734
+ })
735
+ .catch((err) => {
736
+ console.log(err);
737
+ })
738
+ ```
739
+
740
+ ### Audio Captcha
741
+
742
+ <sup>[API method description.](https://2captcha.com/2captcha-api#audio-recognition)</sup>
743
+
744
+ Use the following method to bypass an audio captcha (`mp3` formats only). You must provide the language as `lang = 'en'`. Supported languages are "en", "ru", "de", "el", "pt", "fr".
745
+
746
+ ```js
747
+ solver.audio({
748
+ body: "SUQzBAAAAAAAHFRTU0UAAAA...",
749
+ lang: "en"
750
+ })
751
+ .then((res) => {
752
+ console.log(res);
753
+ })
754
+ .catch((err) => {
755
+ console.log(err);
756
+ })
757
+ ```
758
+
759
+ ## Other methods
760
+
761
+ ### goodReport
762
+
763
+ <sup>[API method description.](https://2captcha.com/2captcha-api#reporting-answers)</sup>
764
+
765
+ Use this method to report good captcha answer.
766
+
767
+ ```js
768
+ solver.goodReport('7031846604')
769
+ ```
770
+
771
+ ### badReport
772
+
773
+ <sup>[API method description.](https://2captcha.com/2captcha-api#reporting-answers)</sup>
774
+
775
+ Use this method to report bad captcha answer.
776
+
777
+ ```js
778
+ solver.badReport('7031854546')
779
+ ```
780
+
781
+ ### balance
782
+
783
+ <sup>[API method description.](https://2captcha.com/2captcha-api#additional-methods)</sup>
784
+
785
+ Use this method to get your account's balance.
786
+
787
+ ```js
788
+ solver.balance()
789
+ .then((res) => {
790
+ console.log(res)
791
+ })
792
+ ```
793
+
794
+ ## Proxies
795
+
796
+ You can pass your proxy as an additional argument for methods: recaptcha, funcaptcha, geetest, geetest v4, keycaptcha, capy puzzle, lemin, turnstile, amazon waf, DataDome, CyberSiARA, MTCaptcha, Friendly Captcha and etc. The proxy will be forwarded to the API to solve the captcha.
797
+
798
+ We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
799
+
800
+ Solving reCAPTCHA V2 using proxy:
801
+ ```js
802
+ solver.recaptcha({
803
+ pageurl: 'https://2captcha.com/demo/recaptcha-v2',
804
+ googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
805
+ proxy: 'HTTPS',
806
+ proxytype: 'login:password@123.123.123.123:3128'
807
+ })
808
+ ```
809
+ ## Examples
810
+
811
+ Examples of solving all supported captcha types are located in the [examples] directory.
812
+
813
+ ## Examples using Puppeteer
814
+ Also we have a separate repositories you can find examples of solving captcha using Puppeteer.
815
+ At the moment we have implemented examples of bypassing Cloudflare Challenge page and reCAPTCHA.
816
+ Links:
817
+ - [Cloudflare Bypassing Demo using Puppeteer](https://github.com/2captcha/cloudflare-demo)
818
+ - [Solving reCAPTCHA V2 using Puppeteer and clicks](https://github.com/2captcha/puppeteer-recaptcha-solver-using-clicks)
819
+ - [Custom Slider Captcha Demo](https://github.com/2captcha/custom-slider-demo)
820
+
821
+
822
+ ## Useful articles
823
+ * [How to bypass captcha using JavaScript](https://2captcha.com/blog/how-to-use-javascript-to-bypass-captcha#how-to-solve-and-bypass-a-captcha-with-javascript-using-npm-package-2captchacaptcha-solver)
824
+ * [Bypassing Cloudflare Challenge with Puppeteer and 2Captcha](https://2captcha.com/blog/bypassing-cloudflare-challenge-with-puppeteer-and-2captcha)
825
+ * [How to bypass Geetest v4 CAPTCHA](https://2captcha.com/blog/geetest-v4-support)
826
+ * [Automatic reCAPTCHA V3 resolution - a tutorial for developers and customers](https://2captcha.com/blog/recaptcha-v3-automatic-resolution)
827
+
828
+ ## Get in touch
829
+
830
+ <a href="mailto:support@2captcha.com"><img src="https://github.com/user-attachments/assets/539df209-7c85-4fa5-84b4-fc22ab93fac7" width="80" height="30"></a>
831
+ <a href="https://2captcha.com/support/tickets/new"><img src="https://github.com/user-attachments/assets/be044db5-2e67-46c6-8c81-04b78bd99650" width="81" height="30"></a>
832
+
833
+ ## Join the team 👪
834
+
835
+ There are many ways to contribute, of which development is only one! Find your next job. Open positions: AI experts, scrapers, developers, technical support, and much more! 😍
836
+
837
+ <a href="mailto:job@2captcha.com"><img src="https://github.com/user-attachments/assets/36d23ef5-7866-4841-8e17-261cc8a4e033" width="80" height="30"></a>
838
+
839
+ ## License
840
+
841
+ The code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
842
+
843
+ ### Graphics and Trademarks
844
+
845
+ The graphics and trademarks included in this repository are not covered by the MIT License. Please contact <a href="mailto:support@2captcha.com">support</a> for permissions regarding the use of these materials.
846
+
847
+ <!-- Shared links -->
848
+ [2Captcha]: https://2captcha.com/
849
+ [JavaScript captcha solver]: https://2captcha.com/lang/javascript
850
+ [post options]: https://2captcha.com/2captcha-api#normal_post
851
+ [list of supported languages]: https://2captcha.com/2captcha-api#language
852
+ [Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
853
+ [Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
854
+ [examples]: ./examples