Skip to content

Latest commit

 

History

History
144 lines (104 loc) · 5.95 KB

README.md

File metadata and controls

144 lines (104 loc) · 5.95 KB

capsolver.com api wrapper🧠

🔥 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.

Solving recaptchav2

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 });

Solving recaptchav3

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 });

Solving hcaptcha

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 })

Solving funcaptcha

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 });

Solving geetest V3 & V4

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 });

Solving datadome

await solver.datadome({ websiteURL, userAgent, captchaUrl, proxy });

Solving turnstile

// under manteniance at 27-07-2024
await solver.antiturnstile({ websiteURL, websiteKey, metadata: null });

Solving mtcaptcha

await.solver.mtcatpcha({ websiteURL, websiteKey, proxy });

Solving image2text captcha

await solver.image2text({ websiteURL: null, body, module: null, score: null, caseSensitive: null });
  • ❌ Unsupported:
    • AwsWaf (token)
    • AwsWafClassification
    • ReCaptchaClassification
    • VisionEngine