capsolver-npm
v2.0.2
Published
Manage to solve captcha challenges with AI in a NodeJS app (captcha service based).
Downloads
7,448
Maintainers
Readme
capsolver.com api wrapper🧠
- Manage to solve captcha challenges with AI in a NodeJS app (captcha service based).
- ❗ An API key it's required. Get here.
- 👀 Puppeteer-extra integration at puppeteer-extra-plugin-capsolver.
🔥 Promise based 🔥 Catch TaskException with error code and description
⬇️ Install
npm i capsolver-npm
✋ Usage
❗ You need to debug each website and the captcha use case, in order to adjust the correct implementation parameters.
- Initialize
Solver
:
const { Solver } = require("capsolver-npm");
const solver = new Solver("CAP-XXXXXX ..."); // one solver by apikey
- Handle any
api.capsolver.com
supported task.
📚 Docs
Request a custom tasks (in case this lib doesn't support it yet):
- It's possible to specify the task type within the JSON object and add the rest of parameters using
.runCustomTaskType({})
. mustPoll
indicates if this task requires to poll the solution after create the task.- When using proxy-required tasks, add your proxy connection matching the following:
{ proxy: "ip:port:user:pass", ... parameters }
const { Solver } = require("capsolver-npm");
const solver = new Solver("CAP-XXXXXX ...");
await solver.runCustomTaskType({
task: {
type: "AkamaiTask", // suppose this task exists at docs.capsolver.com
proxy: "ip:port:user:pass" // custom proxy usage
... parameters
}
mustPoll: true
})
.then(solution => { console.log(solution) })
.catch(e => { console.error(e) });
- Check the balance with
.balance()
.
if(await solver.balance() < 5.00){
console.log("Your CapSolver balance is under 5 USD")
}
📁 Working examples
Figure out here.
🔨 Native methods
- Parameters that have a
null
by default are optional sometimes, it depends on implementation. - Read the "Solving ..." docs.
await solver.recaptchav2({ websiteURL, websiteKey, proxy, pageAction: null, enterprisePayload: null, isInvisible: false, apiDomain: null, userAgent: null, cookie: null });
await solver.recaptchav2proxyless({ websiteURL, websiteKey, pageAction: null, enterprisePayload: null, isInvisible: false, apiDomain: null, userAgent: null, cookie: null });
await solver.recaptchav2enterprise({ websiteURL, websiteKey, proxy, pageAction: null, enterprisePayload: null, isInvisible: false, apiDomain: null, userAgent: null, cookie: null });
await solver.recaptchav2enterpriseproxyless({ websiteURL, websiteKey, pageAction: null, enterprisePayload: null, isInvisible: false, apiDomain: null, userAgent: null, cookie: null });
await solver.recaptchav3({ websiteURL, websiteKey, proxy, pageAction, enterprisePayload: null, apiDomain: null, userAgent: null, cookies: null });
await solver.recaptchav3proxyless({ websiteURL, websiteKey, pageAction, enterprisePayload: null, apiDomain: null, userAgent: null, cookies: null });
await solver.recaptchav3enterprise({ websiteURL, websiteKey, proxy, pageAction, enterprisePayload: null, apiDomain: null, userAgent: null, cookies: null });
await solver.recaptchav3enterpriseproxyless({ websiteURL, websiteKey, pageAction, enterprisePayload: null, apiDomain: null, userAgent: null, cookies: null });
await solver.hcaptcha({ websiteURL, websiteKey, proxy, isInvisible: null, enterprisePayload: null, userAgent: null })
await solver.hcaptchaproxyless({ websiteURL, websiteKey, isInvisible: null, enterprisePayload: null, userAgent: null })
// under manteniance at 27-07-2024
await solver.hcaptchaclassification({ websiteURL: null, websiteKey: null, queries, question })
await solver.funcaptcha({ websiteURL, websitePublicKey, data: null, userAgent: null, proxy });
await solver.funcaptchaproxyless({ websiteURL, websitePublicKey, data: null, userAgent: null })
await solver.funcaptchaclassification({ websiteURL: null, websiteKey: null, images, module: null, question });
await solver.geetest({ websiteURL, gt: null, challenge: null, proxy, geetestApiServerSubdomain: null, captchaId: null });
await solver.geetest_proxyless({ websiteURL, gt: null, challenge: null, captchaId: null, geetestApiServerSubdomain: null });
await solver.datadome({ websiteURL, userAgent, captchaUrl, proxy });
// under manteniance at 27-07-2024
await solver.antiturnstile({ websiteURL, websiteKey, metadata: null });
await.solver.mtcatpcha({ websiteURL, websiteKey, proxy });
await solver.image2text({ websiteURL: null, body, module: null, score: null, caseSensitive: null });
- ❌ Unsupported:
- AwsWaf (token)
- AwsWafClassification
- ReCaptchaClassification
- VisionEngine