2captcha
Advanced tools
Comparing version 3.0.4 to 3.0.5-1
export { Solver } from "./structs/2captcha"; | ||
export { APIError } from "./structs/2captchaError"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -175,2 +175,26 @@ interface BaseSolve { | ||
/** | ||
* Solves a CloudFlare (turnstile) captcha | ||
* @param publicKey The turnstile Site Key | ||
* @param pageurl The URL to the website the captcha is seen on | ||
* @param serviceURL The FunCaptcha Service URL (recommended) | ||
* @param extra Extra properties to pass to 2captcha | ||
* | ||
* @returns {Promise<CaptchaAnswer>} The result from the solve | ||
* @throws APIError | ||
* turnstile("0x4AAAAAAADIkEVyoXXXXXXX", "http://mysite.com/page/with/turnstile/") | ||
* .then((res) => { | ||
* console.log(res) | ||
* }) | ||
*/ | ||
turnstile(siteKey: string, pageURL: string, extra?: UserHCaptchaExtra): Promise<CaptchaAnswer>; | ||
/** | ||
* Reports a captcha as correctly solved. | ||
* | ||
* @param id The ID of the captcha | ||
* @throws APIError | ||
* @example | ||
* solver.goodReport("123456789") | ||
*/ | ||
goodReport(id: string): Promise<void>; | ||
/** | ||
* Report an unsuccessful solve | ||
@@ -177,0 +201,0 @@ * |
@@ -320,2 +320,70 @@ "use strict"; | ||
/** | ||
* Solves a CloudFlare (turnstile) captcha | ||
* @param publicKey The turnstile Site Key | ||
* @param pageurl The URL to the website the captcha is seen on | ||
* @param serviceURL The FunCaptcha Service URL (recommended) | ||
* @param extra Extra properties to pass to 2captcha | ||
* | ||
* @returns {Promise<CaptchaAnswer>} The result from the solve | ||
* @throws APIError | ||
* turnstile("0x4AAAAAAADIkEVyoXXXXXXX", "http://mysite.com/page/with/turnstile/") | ||
* .then((res) => { | ||
* console.log(res) | ||
* }) | ||
*/ | ||
async turnstile(siteKey, pageURL, extra = {}) { | ||
const payload = { | ||
...extra, | ||
...this.defaultPayload, | ||
method: "turnstile", | ||
sitekey: siteKey, | ||
pageurl: pageURL, | ||
}; | ||
const response = await (0, fetch_1.default)(this.in + utils.objectToURI(payload)); | ||
const result = await response.text(); | ||
let data; | ||
try { | ||
data = JSON.parse(result); | ||
} | ||
catch { | ||
throw new _2captchaError_1.APIError(result); | ||
} | ||
if (data.status == 1) { | ||
return this.pollResponse(data.request); | ||
} | ||
else { | ||
throw new _2captchaError_1.APIError(data.request); | ||
} | ||
} | ||
/** | ||
* Reports a captcha as correctly solved. | ||
* | ||
* @param id The ID of the captcha | ||
* @throws APIError | ||
* @example | ||
* solver.goodReport("123456789") | ||
*/ | ||
async goodReport(id) { | ||
const payload = { | ||
id: id, | ||
action: "reportgood", | ||
...this.defaultPayload | ||
}; | ||
const response = await (0, fetch_1.default)(this.res + utils.objectToURI(payload)); | ||
const result = await response.text(); | ||
let data; | ||
try { | ||
data = JSON.parse(result); | ||
} | ||
catch { | ||
throw new _2captchaError_1.APIError(result); | ||
} | ||
if (data.request == "OK_REPORT_RECORDED") { | ||
return; | ||
} | ||
else { | ||
throw new _2captchaError_1.APIError(data.request); | ||
} | ||
} | ||
/** | ||
* Report an unsuccessful solve | ||
@@ -322,0 +390,0 @@ * |
@@ -0,0 +0,0 @@ export declare class APIError extends Error { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /// <reference types="node" /> |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import nodeFetch from 'node-fetch'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "2captcha", | ||
"version": "3.0.4", | ||
"version": "3.0.5-1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/furry/2captcha", |
@@ -19,13 +19,16 @@ <center> | ||
## Info | ||
<hr> | ||
<center> | ||
<h2> Captcha Solvers | ||
</center> | ||
<h3> | ||
<ul> | ||
<li>Finding Sitekeys | ||
<ul> | ||
<li><a href="./docs/hcaptcha.md">hCaptcha</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<center> | ||
<b>CapSolver.com</b> | ||
<br> | ||
<a href="https://capsolver.com"> | ||
<img src="https://i.imgur.com/YaRmSt4.gif" alt="Capsolver's Banner"> | ||
</a> | ||
</center> | ||
</h3> | ||
Supporting all common and well known captcha types and a success rate of over 99%, CapSolver allows for affordable AI-based captcha solving with JS/TS clients as well as HTTP support. Their packages are extremely affordable for projects of any size, offering a free trial to test out their service. | ||
<hr> | ||
@@ -32,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
71163
40
1312
147
1
4
3