@2captcha/captcha-solver 1.0.0 → 1.0.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 +25 -3
- package/dist/structs/2captcha.d.ts +2 -2
- package/dist/structs/2captcha.js +2 -2
- package/dist/structs/2captchaError.js +4 -4
- package/dist/structs/2captchaServer.d.ts +0 -1
- package/dist/structs/2captchaServer.d.ts.map +1 -1
- package/dist/utils/checkCaptchaParams.js +2 -2
- package/dist/utils/fetch.d.ts +1 -2
- package/dist/utils/fetch.d.ts.map +1 -1
- package/package.json +64 -64
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<b>[English](README.md)</b> (recommended) | [中国语文科](README.zh.md) | [Русский](README.ru.md)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
# JavaScript
|
|
4
|
+
# JavaScript captcha solver module for 2Captcha API
|
|
5
5
|
|
|
6
6
|
## Description
|
|
7
|
-
A wrapper around the [2captcha](https://2captcha.com/) API. This wrapper
|
|
7
|
+
A wrapper around the [2captcha](https://2captcha.com/) API. This wrapper supports any captcha bypass: 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, Friendly Captcha.
|
|
8
8
|
|
|
9
9
|
Also added support for the `bounding_box` method. The Bounding Box Method allows you to mark data on the image. This method can be used to mark up datasets or highlight any objects in an image according to the given instructions. Read more about using *Bounding Box Method* on [documentation](https://2captcha.com/2captcha-api#bounding_box).
|
|
10
10
|
|
|
@@ -36,6 +36,7 @@ Also added support for the `bounding_box` method. The Bounding Box Method allows
|
|
|
36
36
|
- [badReport](#badreport)
|
|
37
37
|
- [goodReport](#goodreport)
|
|
38
38
|
- [balance](#balance)
|
|
39
|
+
- [Proxies](#proxies)
|
|
39
40
|
- [Useful articles](#useful-articles)
|
|
40
41
|
- [How to bypass Geetest v4 CAPTCHA](https://2captcha.com/blog/geetest-v4-support)
|
|
41
42
|
- [Automatic reCAPTCHA V3 resolution - a tutorial for developers and customers](https://2captcha.com/blog/recaptcha-v3-automatic-resolution)
|
|
@@ -445,7 +446,28 @@ solver.balance()
|
|
|
445
446
|
})
|
|
446
447
|
```
|
|
447
448
|
|
|
449
|
+
## Proxies
|
|
450
|
+
|
|
451
|
+
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.
|
|
452
|
+
|
|
453
|
+
We have our own proxies that we can offer you. [Buy residential proxies] for avoid restrictions and blocks. [Quick start].
|
|
454
|
+
|
|
455
|
+
Solving reCAPTCHA V2 using proxy:
|
|
456
|
+
```js
|
|
457
|
+
solver.recaptcha({
|
|
458
|
+
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
|
|
459
|
+
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u',
|
|
460
|
+
proxy: 'HTTPS',
|
|
461
|
+
proxytype: 'login:password@123.123.123.123:3128'
|
|
462
|
+
})
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
|
|
448
466
|
## Useful articles
|
|
449
467
|
* [How to bypass Geetest v4 CAPTCHA](https://2captcha.com/blog/geetest-v4-support)
|
|
450
468
|
* [Automatic reCAPTCHA V3 resolution - a tutorial for developers and customers](https://2captcha.com/blog/recaptcha-v3-automatic-resolution)
|
|
451
|
-
* Finding Sitekey <a href="./docs/hcaptcha.md">hCaptcha</a>
|
|
469
|
+
* Finding Sitekey <a href="./docs/hcaptcha.md">hCaptcha</a>
|
|
470
|
+
|
|
471
|
+
<!-- Shared links -->
|
|
472
|
+
[Buy residential proxies]: https://2captcha.com/proxy/residential-proxies
|
|
473
|
+
[Quick start]: https://2captcha.com/proxy?openAddTrafficModal=true
|
|
@@ -538,7 +538,7 @@ export declare class Solver {
|
|
|
538
538
|
*
|
|
539
539
|
* [Read more about "Amazon WAF" captcha](https://2captcha.com/2captcha-api#amazon-waf).
|
|
540
540
|
*
|
|
541
|
-
* @param {{ pageurl, sitekey, iv, context, pingback, proxy, proxytype}} params The `amazonWaf` method takes arguments as an object. Thus, the `pageurl`, `sitekey`, `iv`, `context` fields in the passed object are mandatory.
|
|
541
|
+
* @param {{ pageurl, sitekey, iv, context, pingback, proxy, proxytype}} params The `amazonWaf` method takes arguments as an object. Thus, the `pageurl`, `sitekey`, `iv`, `context` fields in the passed object are mandatory.
|
|
542
542
|
* @param {string} params.pageurl Is the full `URL` of page where you were challenged by the captcha.
|
|
543
543
|
* @param {string} params.sitekey Is a value of `key` parameter in the page source.
|
|
544
544
|
* @param {string} params.iv Is a value of `iv` parameter in the page source.
|
|
@@ -568,7 +568,7 @@ export declare class Solver {
|
|
|
568
568
|
*
|
|
569
569
|
* [Read more about Cloudflare Turnstile captcha](https://2captcha.com/2captcha-api#turnstile).
|
|
570
570
|
*
|
|
571
|
-
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `сloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
|
|
571
|
+
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `сloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
|
|
572
572
|
* @param {string} params.pageurl Full `URL` of the page where you see the captcha.
|
|
573
573
|
* @param {string} params.sitekey Is a value of `sitekey` parameter in the page source.
|
|
574
574
|
* @param {string} params.action Value of optional `action` parameter you found on page.
|
package/dist/structs/2captcha.js
CHANGED
|
@@ -593,7 +593,7 @@ class Solver {
|
|
|
593
593
|
*
|
|
594
594
|
* [Read more about "Amazon WAF" captcha](https://2captcha.com/2captcha-api#amazon-waf).
|
|
595
595
|
*
|
|
596
|
-
* @param {{ pageurl, sitekey, iv, context, pingback, proxy, proxytype}} params The `amazonWaf` method takes arguments as an object. Thus, the `pageurl`, `sitekey`, `iv`, `context` fields in the passed object are mandatory.
|
|
596
|
+
* @param {{ pageurl, sitekey, iv, context, pingback, proxy, proxytype}} params The `amazonWaf` method takes arguments as an object. Thus, the `pageurl`, `sitekey`, `iv`, `context` fields in the passed object are mandatory.
|
|
597
597
|
* @param {string} params.pageurl Is the full `URL` of page where you were challenged by the captcha.
|
|
598
598
|
* @param {string} params.sitekey Is a value of `key` parameter in the page source.
|
|
599
599
|
* @param {string} params.iv Is a value of `iv` parameter in the page source.
|
|
@@ -645,7 +645,7 @@ class Solver {
|
|
|
645
645
|
*
|
|
646
646
|
* [Read more about Cloudflare Turnstile captcha](https://2captcha.com/2captcha-api#turnstile).
|
|
647
647
|
*
|
|
648
|
-
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `сloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
|
|
648
|
+
* @param {{ pageurl, sitekey, action, data, pingback, proxy, proxytype}} params The `сloudflareTurnstile` method takes arguments as an object. Thus, the `pageurl`, `sitekey` fields in the passed object are mandatory.
|
|
649
649
|
* @param {string} params.pageurl Full `URL` of the page where you see the captcha.
|
|
650
650
|
* @param {string} params.sitekey Is a value of `sitekey` parameter in the page source.
|
|
651
651
|
* @param {string} params.action Value of optional `action` parameter you found on page.
|
|
@@ -101,7 +101,7 @@ class APIError extends Error {
|
|
|
101
101
|
case "ERROR_UPLOAD":
|
|
102
102
|
{
|
|
103
103
|
this.code = 14;
|
|
104
|
-
this.message = "The Solve Request was malformed. Please make sure the image is valid. If it is, please open up a github issue detailing this event.
|
|
104
|
+
this.message = "The Solve Request was malformed. Please make sure the image is valid. If it is, please open up a github issue detailing this event.";
|
|
105
105
|
}
|
|
106
106
|
;
|
|
107
107
|
break;
|
|
@@ -164,7 +164,7 @@ class APIError extends Error {
|
|
|
164
164
|
case "ERROR_BAD_PARAMETERS":
|
|
165
165
|
{
|
|
166
166
|
this.code = 23;
|
|
167
|
-
this.message = "Some parameters are missing in this request. If you're using a pre-provided function, please open up an issue on the GitHub
|
|
167
|
+
this.message = "Some parameters are missing in this request. If you're using a pre-provided function, please open up an issue on the GitHub";
|
|
168
168
|
}
|
|
169
169
|
;
|
|
170
170
|
break;
|
|
@@ -186,7 +186,7 @@ class APIError extends Error {
|
|
|
186
186
|
case "CAPCHA_NOT_READY":
|
|
187
187
|
{
|
|
188
188
|
this.code = 25;
|
|
189
|
-
this.message = "The captcha is not solved yet. If you see this error, Please open up an issue on the GitHub
|
|
189
|
+
this.message = "The captcha is not solved yet. If you see this error, Please open up an issue on the GitHub";
|
|
190
190
|
}
|
|
191
191
|
;
|
|
192
192
|
break;
|
|
@@ -242,7 +242,7 @@ class APIError extends Error {
|
|
|
242
242
|
case "ERROR_EMPTY_ACTION":
|
|
243
243
|
{
|
|
244
244
|
this.code = 33;
|
|
245
|
-
this.message = "The ACtion parameter is missing. Please open an issue in the GitHub
|
|
245
|
+
this.message = "The ACtion parameter is missing. Please open an issue in the GitHub";
|
|
246
246
|
}
|
|
247
247
|
;
|
|
248
248
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2captchaServer.d.ts","sourceRoot":"","sources":["../../src/structs/2captchaServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"2captchaServer.d.ts","sourceRoot":"","sources":["../../src/structs/2captchaServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACpD,UAAU,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,MAAM;IACnB,EAAE,CAAC,CAAC,SAAS,MAAM,YAAY,EAC3B,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GACpC,IAAI,CAAC;CACX;AAED;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,WAAW,CAAkB;gBAEzB,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,GAAE,OAAc;YAWxG,MAAM;IA8BpB,OAAO,KAAK,cAAc,GAIzB;IAED;;OAEG;IACI,SAAS;IAGhB,gBAAgB,CAAC,MAAM,EAAE,eAAe;CAO3C"}
|
|
@@ -99,7 +99,7 @@ function checkCaptchaParams(params, method) {
|
|
|
99
99
|
const isThisFieldNotAvailable = !params.hasOwnProperty(fieldName);
|
|
100
100
|
if (isThisFieldNotAvailable) {
|
|
101
101
|
isCorrectCaptchaParams = false;
|
|
102
|
-
throw new Error(`Error when check params captcha.\nNot found "${fieldName}" field in the Object. Field "${fieldName}" is required for "${method}" method. Please add field "${fieldName}" in object and try again.\nPlease correct your code for the "${method}" method according to the code examples
|
|
102
|
+
throw new Error(`Error when check params captcha.\nNot found "${fieldName}" field in the Object. Field "${fieldName}" is required for "${method}" method. Please add field "${fieldName}" in object and try again.\nPlease correct your code for the "${method}" method according to the code examples`);
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
isCorrectCaptchaParams = true;
|
|
@@ -111,7 +111,7 @@ function checkCaptchaParams(params, method) {
|
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
113
|
isCorrectCaptchaParams = false;
|
|
114
|
-
throw new Error(`Error when check params captcha.\nNot found "textinstructions" or "imginstructions" field in the Object. One of this field is required for "bounding_box" method. Please add field "textinstructions" or "imginstructions" in object and try again.\nPlease correct your code for the "bounding_box" method according to the code examples
|
|
114
|
+
throw new Error(`Error when check params captcha.\nNot found "textinstructions" or "imginstructions" field in the Object. One of this field is required for "bounding_box" method. Please add field "textinstructions" or "imginstructions" in object and try again.\nPlease correct your code for the "bounding_box" method according to the code examples`);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
return isCorrectCaptchaParams;
|
package/dist/utils/fetch.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":";AAEA,kBAA8E"}
|
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@2captcha/captcha-solver",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, hCaptcha, funcaptcha, geetest and solve any other captchas.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/2captcha/2captcha-javascript.git"
|
|
9
|
-
},
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"author": "2Captcha",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/2captcha/2captcha-javascript/issues"
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/2captcha/2captcha-javascript",
|
|
16
|
-
"types": "dist/index.d.ts",
|
|
17
|
-
"keywords": [
|
|
18
|
-
"2captcha",
|
|
19
|
-
"captcha",
|
|
20
|
-
"api",
|
|
21
|
-
"captchasolver",
|
|
22
|
-
"capmonster",
|
|
23
|
-
"reCAPTCHA",
|
|
24
|
-
"hCaptcha",
|
|
25
|
-
"FunCaptcha",
|
|
26
|
-
"Geetest",
|
|
27
|
-
"image captcha",
|
|
28
|
-
"
|
|
29
|
-
"Click Captcha",
|
|
30
|
-
"Geetest V4",
|
|
31
|
-
"Yandex Smart Captcha",
|
|
32
|
-
"Lemin captcha",
|
|
33
|
-
"bypass captcha",
|
|
34
|
-
"solve captcha",
|
|
35
|
-
"Amazon WAF",
|
|
36
|
-
"Cloudflare Turnstile",
|
|
37
|
-
"Capy Puzzle",
|
|
38
|
-
"行为验证4.0",
|
|
39
|
-
"行为验证",
|
|
40
|
-
"DataDome CAPTCHA",
|
|
41
|
-
"CyberSiARA",
|
|
42
|
-
"MTCaptcha",
|
|
43
|
-
"Bounding Box Method",
|
|
44
|
-
"Friendly Captcha"
|
|
45
|
-
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"go": "tsc && node ./dist/index.js",
|
|
48
|
-
"dev": "tsc && node ./issues/dev",
|
|
49
|
-
"jsdoc": "jsdoc",
|
|
50
|
-
"docgen": "tsc && yarn jsdoc ./dist -R \"./readme.md\" -P \"./package.json\" -t \"./node_modules/jaguarjs-jsdoc\" -d \"./docs\" -r",
|
|
51
|
-
"test": "tsc && node ./tests/mtCaptcha.js"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"node-fetch": "^2.6.1"
|
|
55
|
-
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@types/node": "^20.8.7",
|
|
58
|
-
"@types/node-fetch": "^2.5.7",
|
|
59
|
-
"dotenv": "^16.0.3",
|
|
60
|
-
"jaguarjs-jsdoc": "^1.0.2",
|
|
61
|
-
"jsdoc": "^4.0.2",
|
|
62
|
-
"typescript": "^4.9.4"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@2captcha/captcha-solver",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "JavaScript library for easy integration with the API of 2captcha captcha solving service to bypass reCAPTCHA, hCaptcha, funcaptcha, geetest and solve any other captchas.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/2captcha/2captcha-javascript.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "2Captcha",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/2captcha/2captcha-javascript/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/2captcha/2captcha-javascript",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"2captcha",
|
|
19
|
+
"captcha",
|
|
20
|
+
"api",
|
|
21
|
+
"captchasolver",
|
|
22
|
+
"capmonster",
|
|
23
|
+
"reCAPTCHA",
|
|
24
|
+
"hCaptcha",
|
|
25
|
+
"FunCaptcha",
|
|
26
|
+
"Geetest",
|
|
27
|
+
"image captcha",
|
|
28
|
+
"Coordinates",
|
|
29
|
+
"Click Captcha",
|
|
30
|
+
"Geetest V4",
|
|
31
|
+
"Yandex Smart Captcha",
|
|
32
|
+
"Lemin captcha",
|
|
33
|
+
"bypass captcha",
|
|
34
|
+
"solve captcha",
|
|
35
|
+
"Amazon WAF",
|
|
36
|
+
"Cloudflare Turnstile",
|
|
37
|
+
"Capy Puzzle",
|
|
38
|
+
"行为验证4.0",
|
|
39
|
+
"行为验证",
|
|
40
|
+
"DataDome CAPTCHA",
|
|
41
|
+
"CyberSiARA",
|
|
42
|
+
"MTCaptcha",
|
|
43
|
+
"Bounding Box Method",
|
|
44
|
+
"Friendly Captcha"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"go": "tsc && node ./dist/index.js",
|
|
48
|
+
"dev": "tsc && node ./issues/dev",
|
|
49
|
+
"jsdoc": "jsdoc",
|
|
50
|
+
"docgen": "tsc && yarn jsdoc ./dist -R \"./readme.md\" -P \"./package.json\" -t \"./node_modules/jaguarjs-jsdoc\" -d \"./docs\" -r",
|
|
51
|
+
"test": "tsc && node ./tests/mtCaptcha.js"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"node-fetch": "^2.6.1"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "^20.8.7",
|
|
58
|
+
"@types/node-fetch": "^2.5.7",
|
|
59
|
+
"dotenv": "^16.0.3",
|
|
60
|
+
"jaguarjs-jsdoc": "^1.0.2",
|
|
61
|
+
"jsdoc": "^4.0.2",
|
|
62
|
+
"typescript": "^4.9.4"
|
|
63
|
+
}
|
|
64
|
+
}
|