<center>
    <h1>
        CaptchaAI
    </h1>


<a href="https://discord.gg/tamVs2Ujrf">
    <img src="https://discordapp.com/api/guilds/769020183540400128/widget.png?style=banner2" alt="Discord Banner 2"/>
</a>
<a href="https://discord.com/invite/wQKktx9gar">
    <img src="https://discordapp.com/api/guilds/972799001462194217/widget.png?style=banner2" alt="Discord Banner 2"/>
</a>

![Discord Shield](https://img.shields.io/github/commit-activity/m/furry/CaptchaAI)
![Size](https://img.shields.io/bundlephobia/min/captchaai)
![Downloads](https://img.shields.io/npm/dw/captchaai)

</center>

<center>A wrapper around the <a href="https://captchaai.io">CaptchaAI</a> API</center>

## Features

- Promise based API methods
- Browser & Node.js support
- Powered by Node-Fetch ECMAScript Module.
- Fluent typings & TS support
- Proxy Support

Currently supports:

- google-recaptcha (v2 / v3 / enterprise),
- hcaptcha,
- FunCaptcha,
- base64 image captchas,

## Planned Coverage
- Funcaptcha
- DatadomeSlider
- AntiKasada
- AntiAkamiBMP

## Install

```sh
npm install captchaai
```
```sh
yarn add captchaai
```

## Usage


Recaptcha,
```js
const Captcha = require("captchaai")

// A new 'solver' instance with our API key
const solver = new Captcha.Solver("<Your captchaai api key>")

/* Example ReCaptcha Website */
// solver.<recaptchaV2 | recaptchaV2Enterprise | recaptchaV3>
solver.recaptchaV2("6Ld2sf4SAAAAAKSgzs0Q13IZhY02Pyo31S2jgOB5", "https://patrickhlauke.github.io/recaptcha/")

.then((res) => {
    console.log(res)
})
.catch((err) => {
    console.error("Could not solve captcha.")
})
```

Image,
```js
const Captcha = require("captchaai")
const fs = require("fs")

const solver = new Captcha.Solver("<Your captchaai api key>")

// Read from a file as base64 text
solver.imageCaptcha(fs.readFileSync("./captcha.png", "base64"))
.then((res) => {
    console.log(res)
})
.catch((err) => {
    console.error("Could not solve captcha..")
})
```

Proxy,
```js
const Captcha = require("captchaai")

const solver = new Captcha.Solver("<Your captchaai api key>")


solver.recaptchaV2("6Ld2sf4SAAAAAKSgzs0Q13IZhY02Pyo31S2jgOB5", "https://patrickhlauke.github.io/recaptcha/", {
    proxyAddress: "login:password@21.214.43.26", // The (Username : Password @ Address) of our chosen proxy
    proxyType: "HTTP" // The 'Type' of proxy, http, https, socks, ect.
    proxyPort: 8080
})

.then((res) => {
    console.log(res)
})
.catch((err) => {
    console.error("Could not solve captcha..")
})
```

## Commit Guidelines

The latest version of the code base will always be under the '**next**' branch!

- All pull requiests must provide a valid reason for the change or implementation
- All **CORE CHANGES** require an issue with reasoning made before a PR will even be addressed.
- All PR's must follow the general structure of the code base
- If you have questions, feel free to make an issue and i'll get to it right away!

<hr>
<div style="text-align: center">
<a href="https://www.buymeacoffee.com/ether" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
</div>