@2captcha/captcha-solver 1.2.0 → 1.3.0
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 +192 -8
- package/dist/structs/2captcha.d.ts +287 -45
- package/dist/structs/2captcha.d.ts.map +1 -1
- package/dist/structs/2captcha.js +433 -20
- package/dist/utils/checkCaptchaParams.d.ts +8 -0
- package/dist/utils/checkCaptchaParams.d.ts.map +1 -1
- package/dist/utils/checkCaptchaParams.js +49 -16
- package/dist/utils/renameParams.d.ts.map +1 -1
- package/dist/utils/renameParams.js +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
# JavaScript module for 2Captcha API (captcha solver)
|
|
11
11
|
|
|
12
|
-
The easiest way to quickly integrate the [2Captcha]
|
|
13
|
-
Examples of API requests for different captcha types are available on the [JavaScript captcha solver]
|
|
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
14
|
|
|
15
15
|
- [JavaScript module for 2Captcha API (captcha solver)](#javascript-module-for-2captcha-api-captcha-solver)
|
|
16
16
|
- [Installation](#installation)
|
|
17
17
|
- [Configuration](#configuration)
|
|
18
18
|
- [TwoCaptcha instance options](#twocaptcha-instance-options)
|
|
19
19
|
- [Solve captcha](#solve-captcha)
|
|
20
|
-
- [Image
|
|
20
|
+
- [Image Captcha](#image-captcha)
|
|
21
21
|
- [reCAPTCHA v2](#recaptcha-v2)
|
|
22
22
|
- [reCAPTCHA v3](#recaptcha-v3)
|
|
23
23
|
- [hCaptcha](#hcaptcha)
|
|
@@ -36,15 +36,26 @@ Examples of API requests for different captcha types are available on the [JavaS
|
|
|
36
36
|
- [Friendly Captcha](#friendly-captcha)
|
|
37
37
|
- [Bounding Box Method](#bounding-box-method)
|
|
38
38
|
- [Grid](#grid)
|
|
39
|
+
- [Text Captcha](#text-captcha)
|
|
40
|
+
- [Canvas](#canvas)
|
|
41
|
+
- [Rotate](#rotate)
|
|
42
|
+
- [KeyCaptcha](#keycaptcha)
|
|
43
|
+
- [Cutcaptcha](#cutcaptcha)
|
|
44
|
+
- [Tencent](#tencent)
|
|
45
|
+
- [atbCAPTCHA](#atbcaptcha)
|
|
46
|
+
- [Audio Captcha](#audio-captcha)
|
|
39
47
|
- [Other methods](#other-methods)
|
|
40
48
|
- [goodReport](#goodreport)
|
|
41
49
|
- [badReport](#badreport)
|
|
42
50
|
- [balance](#balance)
|
|
43
51
|
- [Proxies](#proxies)
|
|
44
52
|
- [Examples](#examples)
|
|
45
|
-
- [
|
|
53
|
+
- [Examples using Puppeteer](#examples-using-puppeteer)
|
|
54
|
+
- [Useful articles](#useful-articles)
|
|
46
55
|
- [Get in touch](#get-in-touch)
|
|
47
56
|
- [Join the team 👪](#join-the-team-)
|
|
57
|
+
- [License](#license)
|
|
58
|
+
- [Graphics and Trademarks](#graphics-and-trademarks)
|
|
48
59
|
|
|
49
60
|
|
|
50
61
|
## Installation
|
|
@@ -108,7 +119,6 @@ Below you can find basic examples for every captcha type, check out the code bel
|
|
|
108
119
|
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
120
|
|
|
110
121
|
```js
|
|
111
|
-
// Read from a file as base64 text
|
|
112
122
|
const imageBase64 = fs.readFileSync("./examples/media/imageCaptcha_6e584.png", "base64")
|
|
113
123
|
|
|
114
124
|
solver.imageCaptcha({
|
|
@@ -118,7 +128,6 @@ solver.imageCaptcha({
|
|
|
118
128
|
max_len: 5
|
|
119
129
|
})
|
|
120
130
|
.then((res) => {
|
|
121
|
-
// Logs the image text
|
|
122
131
|
console.log(res);
|
|
123
132
|
})
|
|
124
133
|
.catch((err) => {
|
|
@@ -497,6 +506,164 @@ solver.grid({
|
|
|
497
506
|
})
|
|
498
507
|
```
|
|
499
508
|
|
|
509
|
+
### Text Captcha
|
|
510
|
+
|
|
511
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_text_captcha)</sup>
|
|
512
|
+
|
|
513
|
+
This method can be used to bypass a captcha that requires answering a question provided in clear text.
|
|
514
|
+
|
|
515
|
+
```js
|
|
516
|
+
solver.textCaptcha({
|
|
517
|
+
textcaptcha: "If tomorrow is Saturday, what day is today?",
|
|
518
|
+
lang: 'en'
|
|
519
|
+
})
|
|
520
|
+
.then((res) => {
|
|
521
|
+
console.log(res);
|
|
522
|
+
})
|
|
523
|
+
.catch((err) => {
|
|
524
|
+
console.log(err);
|
|
525
|
+
})
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### Canvas
|
|
529
|
+
|
|
530
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#canvas)</sup>
|
|
531
|
+
|
|
532
|
+
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.
|
|
533
|
+
|
|
534
|
+
```js
|
|
535
|
+
solver.canvas({
|
|
536
|
+
body: 'iVBORw0KGgoAAAANSgAAAcIA...',
|
|
537
|
+
imginstructions: '/9j/4AAQSkZJRgABAQEA...',
|
|
538
|
+
textinstructions: 'Highlight the red CIRCLE'
|
|
539
|
+
})
|
|
540
|
+
.then((res) => {
|
|
541
|
+
console.log(res);
|
|
542
|
+
})
|
|
543
|
+
.catch((err) => {
|
|
544
|
+
console.log(err);
|
|
545
|
+
})
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### Rotate
|
|
549
|
+
|
|
550
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_rotatecaptcha)</sup>
|
|
551
|
+
|
|
552
|
+
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.
|
|
553
|
+
|
|
554
|
+
```js
|
|
555
|
+
solver.rotate({
|
|
556
|
+
body: imageBase64,
|
|
557
|
+
textinstructions: "Rotate the object to the correct position"
|
|
558
|
+
})
|
|
559
|
+
.then((res) => {
|
|
560
|
+
console.log(res);
|
|
561
|
+
})
|
|
562
|
+
.catch((err) => {
|
|
563
|
+
console.log(err);
|
|
564
|
+
})
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### KeyCaptcha
|
|
568
|
+
|
|
569
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#solving_keycaptcha)</sup>
|
|
570
|
+
|
|
571
|
+
Token-based method to solve KeyCaptcha.
|
|
572
|
+
|
|
573
|
+
```js
|
|
574
|
+
solver.keyCaptcha({
|
|
575
|
+
pageurl: "https://2captcha.com/demo/keycaptcha",
|
|
576
|
+
userId: '184015',
|
|
577
|
+
sessionId: '0917788cad24ad3a69813c4fcd556061',
|
|
578
|
+
webServerSign: '02f7f9669f1269595c4c69bcd4a3c52e',
|
|
579
|
+
webServerSign2: 'd888700f6f324ec0f32b44c32c50bde1'
|
|
580
|
+
})
|
|
581
|
+
.then((res) => {
|
|
582
|
+
console.log(res);
|
|
583
|
+
})
|
|
584
|
+
.catch((err) => {
|
|
585
|
+
console.log(err);
|
|
586
|
+
})
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Cutcaptcha
|
|
590
|
+
|
|
591
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#cutcaptcha)</sup>
|
|
592
|
+
|
|
593
|
+
Use this method to solve Cutcaptcha. Returns the response in JSON.
|
|
594
|
+
|
|
595
|
+
```js
|
|
596
|
+
solver.cutCaptcha({
|
|
597
|
+
pageurl: "https://mysite.com/page/with/cutcaptcha",
|
|
598
|
+
misery_key: "098e6a849af406142e3150dbf4e6d0538db2b51f",
|
|
599
|
+
api_key: "SAs61IAI",
|
|
600
|
+
})
|
|
601
|
+
.then((res) => {
|
|
602
|
+
console.log(res);
|
|
603
|
+
})
|
|
604
|
+
.catch((err) => {
|
|
605
|
+
console.log(err);
|
|
606
|
+
})
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### Tencent
|
|
610
|
+
|
|
611
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#tencent)</sup>
|
|
612
|
+
|
|
613
|
+
Use this method to solve Tencent captcha. Returns the response in JSON.
|
|
614
|
+
|
|
615
|
+
```js
|
|
616
|
+
solver.tencent({
|
|
617
|
+
pageurl: "https://mysite.com/page/with/tencent",
|
|
618
|
+
appId: "189956587"
|
|
619
|
+
})
|
|
620
|
+
.then((res) => {
|
|
621
|
+
console.log(res);
|
|
622
|
+
})
|
|
623
|
+
.catch((err) => {
|
|
624
|
+
console.log(err);
|
|
625
|
+
})
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### atbCAPTCHA
|
|
629
|
+
|
|
630
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#atb-captcha)</sup>
|
|
631
|
+
|
|
632
|
+
Use this method to solve atbCAPTCHA challenge. Returns a token to bypass the captcha.
|
|
633
|
+
|
|
634
|
+
```js
|
|
635
|
+
solver.atbCaptcha({
|
|
636
|
+
pageurl: "https://mysite.com/page/with/atbCAPTCHA",
|
|
637
|
+
appId: "af25e409b33d722a95e56a230ff8771c",
|
|
638
|
+
apiServer: "https://cap.aisecurius.com"
|
|
639
|
+
})
|
|
640
|
+
.then((res) => {
|
|
641
|
+
console.log(res);
|
|
642
|
+
})
|
|
643
|
+
.catch((err) => {
|
|
644
|
+
console.log(err);
|
|
645
|
+
})
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
### Audio Captcha
|
|
649
|
+
|
|
650
|
+
<sup>[API method description.](https://2captcha.com/2captcha-api#audio-recognition)</sup>
|
|
651
|
+
|
|
652
|
+
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".
|
|
653
|
+
|
|
654
|
+
```js
|
|
655
|
+
solver.audio({
|
|
656
|
+
body: "SUQzBAAAAAAAHFRTU0UAAAA...",
|
|
657
|
+
lang: "en"
|
|
658
|
+
})
|
|
659
|
+
.then((res) => {
|
|
660
|
+
console.log(res);
|
|
661
|
+
})
|
|
662
|
+
.catch((err) => {
|
|
663
|
+
console.log(err);
|
|
664
|
+
})
|
|
665
|
+
```
|
|
666
|
+
|
|
500
667
|
## Other methods
|
|
501
668
|
|
|
502
669
|
### goodReport
|
|
@@ -551,13 +718,20 @@ solver.recaptcha({
|
|
|
551
718
|
|
|
552
719
|
Examples of solving all supported captcha types are located in the [examples] directory.
|
|
553
720
|
|
|
721
|
+
## Examples using Puppeteer
|
|
722
|
+
Also we have a separate repositories you can find examples of solving captcha using Puppeteer.
|
|
723
|
+
At the moment we have implemented examples of bypassing Cloudflare Challenge page and reCAPTCHA.
|
|
724
|
+
Links:
|
|
725
|
+
- [Cloudflare Bypassing Demo using Puppeteer](https://github.com/2captcha/cloudflare-demo)
|
|
726
|
+
- [Solving reCAPTCHA V2 using Puppeteer and clicks](https://github.com/2captcha/puppeteer-recaptcha-solver-using-clicks)
|
|
727
|
+
- [Custom Slider Captcha Demo](https://github.com/2captcha/custom-slider-demo)
|
|
728
|
+
|
|
729
|
+
|
|
554
730
|
## Useful articles
|
|
555
731
|
* [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
732
|
* [Bypassing Cloudflare Challenge with Puppeteer and 2Captcha](https://2captcha.com/blog/bypassing-cloudflare-challenge-with-puppeteer-and-2captcha)
|
|
557
733
|
* [How to bypass Geetest v4 CAPTCHA](https://2captcha.com/blog/geetest-v4-support)
|
|
558
734
|
* [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
735
|
|
|
562
736
|
## Get in touch
|
|
563
737
|
|
|
@@ -570,7 +744,17 @@ There are many ways to contribute, of which development is only one! Find your n
|
|
|
570
744
|
|
|
571
745
|
<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
746
|
|
|
747
|
+
## License
|
|
748
|
+
|
|
749
|
+
The code in this repository is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more details.
|
|
750
|
+
|
|
751
|
+
### Graphics and Trademarks
|
|
752
|
+
|
|
753
|
+
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.
|
|
754
|
+
|
|
573
755
|
<!-- Shared links -->
|
|
756
|
+
[2Captcha]: https://2captcha.com/
|
|
757
|
+
[JavaScript captcha solver]: https://2captcha.com/lang/javascript
|
|
574
758
|
[post options]: https://2captcha.com/2captcha-api#normal_post
|
|
575
759
|
[list of supported languages]: https://2captcha.com/2captcha-api#language
|
|
576
760
|
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
@@ -66,18 +66,6 @@ export interface paramsGeetest {
|
|
|
66
66
|
proxytype?: string;
|
|
67
67
|
userAgent?: string;
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Interface for yandexSmart captcha
|
|
71
|
-
*
|
|
72
|
-
* @typedef {object} yandexSmart
|
|
73
|
-
* @property {string} pageurl URL of the page where the captcha is located
|
|
74
|
-
* @property {string} sitekey The `sitekey` value you found on the captcha page
|
|
75
|
-
* @property {string} pingback
|
|
76
|
-
* @property {string} proxy Format: `login:password@123.123.123.123:3128`. You can find more info about proxies [here](https://2captcha.com/2captcha-api#proxies).
|
|
77
|
-
* @property {string} proxytype Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
78
|
-
* @property {string} userAgent Your `userAgent` that will be passed to our worker and used to solve the captcha.
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
69
|
export interface yandexSmart {
|
|
82
70
|
pageurl: string;
|
|
83
71
|
sitekey: string;
|
|
@@ -86,18 +74,6 @@ export interface yandexSmart {
|
|
|
86
74
|
proxytype?: string;
|
|
87
75
|
userAgent?: string;
|
|
88
76
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Interface for GeeTest V4 captcha
|
|
91
|
-
*
|
|
92
|
-
* @typedef {object} paramsGeeTestV4
|
|
93
|
-
* @property {string} pageurl Required parameter. URL of the page where the captcha is located
|
|
94
|
-
* @property {string} captcha_id Required parameter. Value of `captcha_id` parameter you found on target website.
|
|
95
|
-
* @property {string} pingback An optional param. [More info here](https://2captcha.com/2captcha-api#pingback).
|
|
96
|
-
* @property {string} proxy An optional param. Format: `login:password@123.123.123.123:3128`
|
|
97
|
-
* @property {string} proxytype An optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
98
|
-
* @property {string} userAgent An optional param. Your `userAgent` that will be passed to our worker and used to solve the captcha.
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
77
|
export interface paramsGeeTestV4 {
|
|
102
78
|
pageurl: string;
|
|
103
79
|
captcha_id: string;
|
|
@@ -180,6 +156,14 @@ export interface paramsMTCaptcha {
|
|
|
180
156
|
proxy?: string;
|
|
181
157
|
proxytype?: string;
|
|
182
158
|
}
|
|
159
|
+
export interface paramsCutcaptcha {
|
|
160
|
+
pageurl: string;
|
|
161
|
+
miseryKey: string;
|
|
162
|
+
apiKey: string;
|
|
163
|
+
pingback?: string;
|
|
164
|
+
proxy?: string;
|
|
165
|
+
proxytype?: string;
|
|
166
|
+
}
|
|
183
167
|
export interface friendlyCaptcha {
|
|
184
168
|
pageurl: string;
|
|
185
169
|
sitekey: string;
|
|
@@ -194,18 +178,63 @@ export interface paramsBoundingBox {
|
|
|
194
178
|
}
|
|
195
179
|
export interface paramsGrid {
|
|
196
180
|
body: string;
|
|
197
|
-
recaptcha:
|
|
181
|
+
recaptcha: number;
|
|
182
|
+
canvas?: number;
|
|
198
183
|
rows?: number;
|
|
199
184
|
cols?: number;
|
|
200
|
-
|
|
201
|
-
|
|
185
|
+
minClicks?: number;
|
|
186
|
+
maxClicks?: number;
|
|
202
187
|
previousId?: string;
|
|
188
|
+
imgType?: string;
|
|
203
189
|
textinstructions?: string;
|
|
204
190
|
imginstructions?: string;
|
|
205
191
|
canSkip?: number;
|
|
206
192
|
lang?: string;
|
|
207
193
|
pingback?: string;
|
|
208
194
|
}
|
|
195
|
+
export interface paramsTextcaptcha {
|
|
196
|
+
textcaptcha: string;
|
|
197
|
+
lang?: string;
|
|
198
|
+
pingback?: string;
|
|
199
|
+
}
|
|
200
|
+
export interface paramsRotateCaptcha {
|
|
201
|
+
body: string;
|
|
202
|
+
angle?: number;
|
|
203
|
+
pingback?: string;
|
|
204
|
+
lang?: string;
|
|
205
|
+
textinstructions?: string;
|
|
206
|
+
imginstructions?: string;
|
|
207
|
+
}
|
|
208
|
+
export interface paramsKeyCaptcha {
|
|
209
|
+
pageurl: string;
|
|
210
|
+
userId: string;
|
|
211
|
+
sessionId: string;
|
|
212
|
+
webServerSign: string;
|
|
213
|
+
webServerSign2: string;
|
|
214
|
+
pingback?: string;
|
|
215
|
+
proxy?: string;
|
|
216
|
+
proxytype?: string;
|
|
217
|
+
}
|
|
218
|
+
export interface paramsTencent {
|
|
219
|
+
pageurl: string;
|
|
220
|
+
appId: string;
|
|
221
|
+
pingback?: string;
|
|
222
|
+
proxy?: string;
|
|
223
|
+
proxytype?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface paramsAtbCaptcha {
|
|
226
|
+
pageurl: string;
|
|
227
|
+
appId: string;
|
|
228
|
+
apiServer: string;
|
|
229
|
+
pingback?: string;
|
|
230
|
+
proxy?: string;
|
|
231
|
+
proxytype?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface paramsAudioCaptcha {
|
|
234
|
+
body: string;
|
|
235
|
+
lang: string;
|
|
236
|
+
pingback?: string;
|
|
237
|
+
}
|
|
209
238
|
/**
|
|
210
239
|
* An object containing properties of the captcha solution.
|
|
211
240
|
* @typedef {Object} CaptchaAnswer
|
|
@@ -588,7 +617,7 @@ export declare class Solver {
|
|
|
588
617
|
*
|
|
589
618
|
* [Read more about Cloudflare Turnstile captcha](https://2captcha.com/2captcha-api#turnstile).
|
|
590
619
|
*
|
|
591
|
-
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The
|
|
620
|
+
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `cloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
|
|
592
621
|
* @param {string} params.pageurl Full `URL` of the page where you see the captcha.
|
|
593
622
|
* @param {string} params.sitekey Is a value of `sitekey` parameter in the page source.
|
|
594
623
|
* @param {string} params.action Value of optional `action` parameter you found on page.
|
|
@@ -613,7 +642,7 @@ export declare class Solver {
|
|
|
613
642
|
/**
|
|
614
643
|
* ### Solves a Coordinates captcha.
|
|
615
644
|
*
|
|
616
|
-
* @param {{ body, imginstructions, textinstructions, language, lang, pingback }} params parameters
|
|
645
|
+
* @param {{ body, imginstructions, textinstructions, language, lang, pingback }} params parameters Coordinates Captcha as an object.
|
|
617
646
|
* @param {string} params.body Base64-encoded captcha image.
|
|
618
647
|
* @param {string} params.imginstructions Base64-encoded image with instruction for solving captcha.
|
|
619
648
|
* @param {string} params.textinstructions Text will be shown to worker to help him to solve the captcha correctly. For example: click on all objects in red color.
|
|
@@ -739,28 +768,36 @@ export declare class Solver {
|
|
|
739
768
|
*/
|
|
740
769
|
mtCaptcha(params: paramsMTCaptcha): Promise<CaptchaAnswer>;
|
|
741
770
|
/**
|
|
742
|
-
* ### Solves Cutcaptcha
|
|
771
|
+
* ### Solves a Cutcaptcha.
|
|
743
772
|
*
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
* @param {
|
|
748
|
-
* @param {string} params.
|
|
749
|
-
* @param {string} params.
|
|
773
|
+
* Use this method to solve Cutcaptcha. Returns the response in JSON.
|
|
774
|
+
* [Read more about Cutcaptcha Method](https://2captcha.com/2captcha-api#cutcaptcha).
|
|
775
|
+
*
|
|
776
|
+
* @param {{ pageurl, miseryKey, apiKey, pingback, proxy, proxytype }} params Parameters for solving Cutcaptcha as an object.
|
|
777
|
+
* @param {string} params.pageurl The URL where the captcha is located.
|
|
778
|
+
* @param {string} params.miseryKey The value of `CUTCAPTCHA_MISERY_KEY` variable defined on page.
|
|
779
|
+
* @param {string} params.apiKey The value of `data-apikey` attribute of iframe's body. Also the name of javascript file included on the page
|
|
780
|
+
* @param {string} [params.pingback] Optional param. URL for pingback (callback) response when captcha is solved.
|
|
781
|
+
* @param {string} [params.proxy] Optional param. Proxy to use while solving the captcha. Format: `login:password@123.123.123.123:3128`.
|
|
782
|
+
* @param {string} [params.proxytype] Optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
783
|
+
*
|
|
784
|
+
* @returns {Promise<CaptchaAnswer>} The result from the solve.
|
|
785
|
+
* @throws APIError
|
|
750
786
|
*
|
|
751
787
|
* @example
|
|
752
788
|
* solver.cutCaptcha({
|
|
753
|
-
* pageurl: "https://
|
|
754
|
-
*
|
|
789
|
+
* pageurl: "https://mysite.com/page/with/cutcaptcha",
|
|
790
|
+
* miseryKey: "098e6a849af406142e3150dbf4e6d0538db2b51f",
|
|
791
|
+
* apiKey: "SAs61IAI",
|
|
755
792
|
* })
|
|
756
793
|
* .then((res) => {
|
|
757
|
-
*
|
|
758
|
-
*
|
|
794
|
+
* console.log(res);
|
|
795
|
+
* })
|
|
759
796
|
* .catch((err) => {
|
|
760
|
-
*
|
|
797
|
+
* console.log(err);
|
|
761
798
|
* })
|
|
762
799
|
*/
|
|
763
|
-
cutCaptcha(params:
|
|
800
|
+
cutCaptcha(params: paramsCutcaptcha): Promise<CaptchaAnswer>;
|
|
764
801
|
/**
|
|
765
802
|
* ### Solves Friendly Captcha
|
|
766
803
|
*
|
|
@@ -810,14 +847,15 @@ export declare class Solver {
|
|
|
810
847
|
*
|
|
811
848
|
* The method can be used to bypass tasks where a grid is applied to an image and you need to click on grid tiles, like reCAPTCHA or hCaptcha images.
|
|
812
849
|
*
|
|
813
|
-
* @param {{ body, textinstructions, imginstructions, rows, cols,
|
|
850
|
+
* @param {{ body, textinstructions, imginstructions, rows, cols, minClicks, maxClicks, imgType, previousId, canSkip, lang, pingback}} params Parameters Grid Method as an object.
|
|
814
851
|
* @param {string} params.body `Base64`- encoded captcha image.
|
|
815
852
|
* @param {string} params.textinstructions Text will be shown to worker to help him to select object on the image correctly. For example: "*Select cars in the image*". **Optional parameter**, if the instruction already exists in the form of the `imginstructions`.
|
|
816
853
|
* @param {string} params.imginstructions Image with instruction for worker to help him to select object on the image correctly. The image must be encoded in `Base64` format. **Optional parameter**, if the instruction already exists in the form of the `textinstructions`.
|
|
817
854
|
* @param {number} params.rows Number of rows in grid captcha.
|
|
818
855
|
* @param {number} params.cols Number of columns in grid captcdha.
|
|
819
|
-
* @param {number} params.
|
|
820
|
-
* @param {number} params.
|
|
856
|
+
* @param {number} params.minClicks The minimum number of tiles that must be selected. Can't be more than `rows` * `cols`.
|
|
857
|
+
* @param {number} params.maxClicks The maximum number of tiles that can be selected on the image.
|
|
858
|
+
* @param {string} params.imgType The image will be recognized using Computer Vision. Supported value options: `recaptcha`, `hcaptcha`, `funcaptcha`, `funcaptcha_compare`. [More info here](https://2captcha.com/2captcha-api#grid).
|
|
821
859
|
* @param {string} params.previousId Id of your previous request with the same captcha challenge.
|
|
822
860
|
* @param {number} params.canSkip Set the value to `1` only if it's possible that there's no images matching to the instruction. We'll provide a button "No matching images" to worker and you will receive `No_matching_images` as answer.
|
|
823
861
|
* @param {string} params.lang Language code. [See the list of supported languages](https://2captcha.com/2captcha-api#language).
|
|
@@ -837,6 +875,210 @@ export declare class Solver {
|
|
|
837
875
|
* })
|
|
838
876
|
*/
|
|
839
877
|
grid(params: paramsGrid): Promise<CaptchaAnswer>;
|
|
878
|
+
/**
|
|
879
|
+
* ### Text Captcha method
|
|
880
|
+
*
|
|
881
|
+
* Text Captcha is a type of captcha that is represented as text and doesn't contain images. Usually you have to answer a question to pass the verification. For example: "If tomorrow is Saturday, what day is today?".
|
|
882
|
+
* [Read more about Text Captcha Method](https://2captcha.com/2captcha-api#text-captcha).
|
|
883
|
+
*
|
|
884
|
+
* @param {{ textcaptcha, lang, pingback}} params Parameters Text Captcha Method as an object.
|
|
885
|
+
* @param {string} params.textcaptcha Text Captcha is a type of captcha that is represented as text and doesn't contain images. Usually you have to answer a question to pass the verification.
|
|
886
|
+
* @param {string} params.lang Language code. [See the list of supported languages](https://2captcha.com/2captcha-api#language).
|
|
887
|
+
* @param {string} params.pingback params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* solver.text({
|
|
891
|
+
* textcaptcha: "If tomorrow is Saturday, what day is today?",
|
|
892
|
+
* lang: 'en'
|
|
893
|
+
* })
|
|
894
|
+
* .then((res) => {
|
|
895
|
+
* console.log(res);
|
|
896
|
+
* })
|
|
897
|
+
* .catch((err) => {
|
|
898
|
+
* console.log(err);
|
|
899
|
+
* })
|
|
900
|
+
*/
|
|
901
|
+
text(params: paramsTextcaptcha): Promise<CaptchaAnswer>;
|
|
902
|
+
/**
|
|
903
|
+
* ### Canvas method
|
|
904
|
+
*
|
|
905
|
+
* This method can be used to bypass tasks in which you need to circle an object or line in an image.
|
|
906
|
+
* [Read more about Canvas Method](https://2captcha.com/2captcha-api#canvas).
|
|
907
|
+
*
|
|
908
|
+
* @param {{ body, textinstructions, imginstructions, canSkip, lang, pingback}} params Parameters Canvas as an object.
|
|
909
|
+
* @param {string} params.body `Base64`- encoded captcha image.
|
|
910
|
+
* @param {string} params.textinstructions Text will be shown to worker to help him to select object on the image correctly. For example: "*Select cars in the image*". **Optional parameter**, if the instruction already exists in the form of the `imginstructions`.
|
|
911
|
+
* @param {string} params.imginstructions Image with instruction for worker to help him to select object on the image correctly. The image must be encoded in `Base64` format. **Optional parameter**, if the instruction already exists in the form of the `textinstructions`.
|
|
912
|
+
* @param {number} params.canSkip Set the value to `1` only if it's possible that there's no images matching to the instruction. We'll provide a button "No matching images" to worker and you will receive `No_matching_images` as answer.
|
|
913
|
+
* @param {string} params.lang Language code. [See the list of supported languages](https://2captcha.com/2captcha-api#language).
|
|
914
|
+
* @param {string} params.pingback params.pingback URL for pingback (callback) response that will be sent when captcha is solved. URL should be registered on the server. [More info here](https://2captcha.com/2captcha-api#pingback).
|
|
915
|
+
*
|
|
916
|
+
* @example
|
|
917
|
+
* solver.canvas({
|
|
918
|
+
* body: 'iVBORw0KGgoAAAANSgAAAcIA...',
|
|
919
|
+
* imginstructions: '/9j/4AAQSkZJRgABAQEA...',
|
|
920
|
+
* textinstructions: 'Highlight the red CIRCLE'
|
|
921
|
+
* })
|
|
922
|
+
* .then((res) => {
|
|
923
|
+
* console.log(res);
|
|
924
|
+
* })
|
|
925
|
+
* .catch((err) => {
|
|
926
|
+
* console.log(err);
|
|
927
|
+
* })
|
|
928
|
+
*/
|
|
929
|
+
canvas(params: paramsGrid): Promise<CaptchaAnswer>;
|
|
930
|
+
/**
|
|
931
|
+
* ### Rotate method
|
|
932
|
+
*
|
|
933
|
+
* 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.
|
|
934
|
+
* [Read more about Rotate Method](https://2captcha.com/2captcha-api#solving_rotatecaptcha).
|
|
935
|
+
*
|
|
936
|
+
* @param {{ body, angle, pingback, lang, textinstructions, imginstructions }} params Parameters for solving Rotate Captcha as an object.
|
|
937
|
+
* @param {string} params.body Base64-encoded image of the captcha that needs to be rotated.
|
|
938
|
+
* @param {number} params.angle Angle to which the captcha needs to be rotated to solve it correctly. Value between `0` to `360`.
|
|
939
|
+
* @param {string} params.textinstructions Optional param. Text instruction that will be shown to worker to help solve the captcha correctly.
|
|
940
|
+
* @param {string} params.imginstructions Optional param. Base64-encoded image instruction that will be shown to worker to help solve the captcha correctly.
|
|
941
|
+
* @param {string} params.lang Optional param. Language code for worker to use while solving the captcha.
|
|
942
|
+
* @param {string} params.pingback Optional param. URL for pingback (callback) response when captcha is solved.
|
|
943
|
+
*
|
|
944
|
+
* @returns {Promise<CaptchaAnswer>} The result from the solve.
|
|
945
|
+
* @throws APIError
|
|
946
|
+
*
|
|
947
|
+
* @example
|
|
948
|
+
* solver.rotate({
|
|
949
|
+
* body: "iVBORw0KGgoAAAANSUhEUgAAAcIA...",
|
|
950
|
+
* angle: 15,
|
|
951
|
+
* textinstructions: "Rotate the object to the correct position"
|
|
952
|
+
* })
|
|
953
|
+
* .then((res) => {
|
|
954
|
+
* console.log(res);
|
|
955
|
+
* })
|
|
956
|
+
* .catch((err) => {
|
|
957
|
+
* console.log(err);
|
|
958
|
+
* })
|
|
959
|
+
*/
|
|
960
|
+
rotate(params: paramsRotateCaptcha): Promise<CaptchaAnswer>;
|
|
961
|
+
/**
|
|
962
|
+
* ### Solves a KeyCaptcha.
|
|
963
|
+
*
|
|
964
|
+
* This method can be used to solve a KeyCaptcha. It is mostly used to bypass captchas that use KeyCaptcha technology.
|
|
965
|
+
* [Read more about KeyCaptcha Method](https://2captcha.com/2captcha-api#solving_keycaptcha).
|
|
966
|
+
*
|
|
967
|
+
* @param {{ pageurl, userId, sessionId, webServerSign, webServerSign2, pingback, proxy, proxytype }} params Parameters for solving KeyCaptcha as an object.
|
|
968
|
+
* @param {string} params.pageurl The URL where the captcha is located.
|
|
969
|
+
* @param {string} params.userId Value of `s_s_c_user_id` parameter you found on page.
|
|
970
|
+
* @param {string} params.sessionId Value of `s_s_c_session_id` parameter you found on page.
|
|
971
|
+
* @param {string} params.webServerSign Value of `s_s_c_web_server_sign` parameter you found on page.
|
|
972
|
+
* @param {string} params.webServerSign2 Value of `s_s_c_web_server_sign2` parameter you found on page.
|
|
973
|
+
* @param {string} [params.pingback] Optional param. URL for pingback (callback) response when captcha is solved.
|
|
974
|
+
* @param {string} [params.proxy] Optional param. Proxy to use while solving the captcha. Format: `login:password@123.123.123.123:3128`.
|
|
975
|
+
* @param {string} [params.proxytype] Optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
976
|
+
*
|
|
977
|
+
* @returns {Promise<CaptchaAnswer>} The result from the solve.
|
|
978
|
+
* @throws APIError
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* solver.keyCaptcha({
|
|
982
|
+
* pageurl: "https://2captcha.com/demo/keycaptcha",
|
|
983
|
+
* userId: "184015",
|
|
984
|
+
* sessionId: "11975dc265ce9174a54edb1619af15b7",
|
|
985
|
+
* webServerSign: "73ef77fd3cf0ce02947d9088bdc8412a",
|
|
986
|
+
* webServerSign2: "93836d9e7007f38f072ce07d89bb7e2b"
|
|
987
|
+
* })
|
|
988
|
+
* .then((res) => {
|
|
989
|
+
* console.log(res);
|
|
990
|
+
* })
|
|
991
|
+
* .catch((err) => {
|
|
992
|
+
* console.log(err);
|
|
993
|
+
* })
|
|
994
|
+
*/
|
|
995
|
+
keyCaptcha(params: paramsKeyCaptcha): Promise<CaptchaAnswer>;
|
|
996
|
+
/**
|
|
997
|
+
* ### Solves a Tencent.
|
|
998
|
+
*
|
|
999
|
+
* Use this method to solve Tencent captcha. Returns a token.
|
|
1000
|
+
* [Read more about Tencent Method](https://2captcha.com/2captcha-api#tencent).
|
|
1001
|
+
*
|
|
1002
|
+
* @param {{ pageurl, appId, pingback, proxy, proxytype }} params Parameters for solving Tencent as an object.
|
|
1003
|
+
* @param {string} params.pageurl The URL where the captcha is located.
|
|
1004
|
+
* @param {string} params.appId The value of `appId` parameter in the website source code.
|
|
1005
|
+
* @param {string} [params.pingback] Optional param. URL for pingback (callback) response when captcha is solved.
|
|
1006
|
+
* @param {string} [params.proxy] Optional param. Proxy to use while solving the captcha. Format: `login:password@123.123.123.123:3128`.
|
|
1007
|
+
* @param {string} [params.proxytype] Optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
1008
|
+
*
|
|
1009
|
+
* @returns {Promise<CaptchaAnswer>} The result from the solve.
|
|
1010
|
+
* @throws APIError
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* solver.tencent({
|
|
1014
|
+
* pageurl: "https://mysite.com/page/with/tencent",
|
|
1015
|
+
* appId: "189956587"
|
|
1016
|
+
* })
|
|
1017
|
+
* .then((res) => {
|
|
1018
|
+
* console.log(res);
|
|
1019
|
+
* })
|
|
1020
|
+
* .catch((err) => {
|
|
1021
|
+
* console.log(err);
|
|
1022
|
+
* })
|
|
1023
|
+
*/
|
|
1024
|
+
tencent(params: paramsTencent): Promise<CaptchaAnswer>;
|
|
1025
|
+
/**
|
|
1026
|
+
* ### Solves a atbCAPTCHA.
|
|
1027
|
+
*
|
|
1028
|
+
* Use this method to solve atbCAPTCHA captcha. Returns a token.
|
|
1029
|
+
* [Read more about atbCAPTCHA Method](https://2captcha.com/2captcha-api#atb-captcha).
|
|
1030
|
+
*
|
|
1031
|
+
* @param {{ pageurl, appId, apiServer, pingback, proxy, proxytype }} params Parameters for solving atbCAPTCHA as an object.
|
|
1032
|
+
* @param {string} params.pageurl The URL where the captcha is located.
|
|
1033
|
+
* @param {string} params.appId The value of `appId` parameter in the website source code.
|
|
1034
|
+
* @param {string} params.apiServer The value of `apiServer` parameter in the website source code.
|
|
1035
|
+
* @param {string} [params.pingback] Optional param. URL for pingback (callback) response when captcha is solved.
|
|
1036
|
+
* @param {string} [params.proxy] Optional param. Proxy to use while solving the captcha. Format: `login:password@123.123.123.123:3128`.
|
|
1037
|
+
* @param {string} [params.proxytype] Optional param. Type of your proxy: `HTTP`, `HTTPS`, `SOCKS4`, `SOCKS5`.
|
|
1038
|
+
*
|
|
1039
|
+
* @returns {Promise<CaptchaAnswer>} The result from the solve.
|
|
1040
|
+
* @throws APIError
|
|
1041
|
+
*
|
|
1042
|
+
* @example
|
|
1043
|
+
* solver.atbCaptcha({
|
|
1044
|
+
* pageurl: "https://mysite.com/page/with/tencent",
|
|
1045
|
+
* appId: "af25e409b33d722a95e56a230ff8771c",
|
|
1046
|
+
apiServer: "https://cap.aisecurius.com"
|
|
1047
|
+
* })
|
|
1048
|
+
* .then((res) => {
|
|
1049
|
+
* console.log(res);
|
|
1050
|
+
* })
|
|
1051
|
+
* .catch((err) => {
|
|
1052
|
+
* console.log(err);
|
|
1053
|
+
* })
|
|
1054
|
+
*/
|
|
1055
|
+
atbCaptcha(params: paramsAtbCaptcha): Promise<CaptchaAnswer>;
|
|
1056
|
+
/**
|
|
1057
|
+
* ### Method for solving Audio captcha.
|
|
1058
|
+
*
|
|
1059
|
+
* 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".
|
|
1060
|
+
* [Read more about Audio recognition Method](https://2captcha.com/2captcha-api#audio-recognition).
|
|
1061
|
+
*
|
|
1062
|
+
* @param {{ body, lang, pingback }} params Object containing parameters for the audio captcha.
|
|
1063
|
+
* @param {string} params.body Base64 encoded audio file in `mp3` format. Max file size: 1 MB.
|
|
1064
|
+
* @param {string} params.lang The language of audio record. Supported languages are: "en", "ru", "de", "el", "pt", "fr".
|
|
1065
|
+
* @param {string} [params.pingback] URL for pingback response once captcha is solved.
|
|
1066
|
+
*
|
|
1067
|
+
* @returns {Promise<CaptchaAnswer>} The result from solving the audio captcha.
|
|
1068
|
+
* @throws APIError
|
|
1069
|
+
* @example
|
|
1070
|
+
* solver.audio({
|
|
1071
|
+
* body: "SUQzBAAAAAAAHFRTU0UAAAA...",
|
|
1072
|
+
* lang: "en"
|
|
1073
|
+
* })
|
|
1074
|
+
* .then((res) => {
|
|
1075
|
+
* console.log(res);
|
|
1076
|
+
* })
|
|
1077
|
+
* .catch((err) => {
|
|
1078
|
+
* console.log(err);
|
|
1079
|
+
* })
|
|
1080
|
+
*/
|
|
1081
|
+
audio(params: paramsAudioCaptcha): Promise<CaptchaAnswer>;
|
|
840
1082
|
/**
|
|
841
1083
|
* Reports a captcha as correctly solved.
|
|
842
1084
|
*
|