Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blackravenx committed Feb 17, 2024
1 parent c5c263c commit 47dd238
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 12 deletions.
46 changes: 34 additions & 12 deletions capsolver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,62 @@ Docs: https://docs.capsolver.com
## Installation
Via [npm](https://www.npmjs.com/package/@captcha-libs/capsolver)
```npm i @captcha-libs/capsolver```
pnpm
```$ pnpm i @captcha-libs/capsolver```
yarn
```$ yarn add @captcha-libs/capsolver```

Usage
### Usage
```javascript
//import CapSolver client and desired task
import { CapSolver, ReCaptchaV3EnterpriseTask } from "@captcha-libs/capsolver";

const capsolverClient = new CapSolver({
clientKey: "<YOUR_CLIENT_KEY>",
pollingInterval: 5000, //optional. Delay in milliseconds to fetch task result, default: 5000ms
timeout: 120_000 //optional. Max time in milliseconds to wait for settled task result, default: 120000ms
pollingInterval: 5000, // optional. Delay in milliseconds to fetch task result, default: 5000ms
timeout: 120_000 // optional. Max time in milliseconds to wait for settled task result, default: 120000ms
});

// Pass captcha params to solve
const reCaptchaV3Request = new ReCaptchaV3EnterpriseTask({
proxy: "http:ip:port:user:pass",
websiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
websiteURL: "https://www.google.com/recaptcha/api2/demo"
});
proxy: "http:ip:port:user:pass",
websiteKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
websiteURL: "https://www.google.com/recaptcha/api2/demo"
});

// returns solution or throws an exception
const reCaptchaV3Solution = await capsolverClient.solve(reCaptchaV3Request);

const {
solution: { expireTime, gRecaptchaResponse, userAgent, taskId }
solution, //returns generic captcha type specific solution
errorId,
errorCode,
errorDescription,
status
} = reCaptchaV3Solution;

const {
gRecaptchaResponse, userAgent, expireTime
} = solution;

//if you want to submit feedback
const feedback = await capsolverClient.feedbackTask({
taskId,
invalid: false, //is captcha solved successfully? required.
message: "success", //optional
code: 1, //optional
taskId,
invalid: false, //is captcha solved successfully? required.
message: "success", //optional
code: 1, //optional
});

//to get balance
const balance = await capsolverClient.getBalance()
```

### Features
* Supports all captcha types, solutions and methods from CapSolver docs (updated at Feb. 2024)
* TypeScript-first design
* Automatically waits for solution
* Fully tested task payloads

### Currently supported task payloads
What 'custom' does mean? Custom means that the parameters and solutions have been narrowed down from the official documentation from more general cases. However, you can still use classes strictly according to the official documentation.

Expand Down
85 changes: 85 additions & 0 deletions capsolver/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47dd238

Please sign in to comment.