@captcha-libs/capguru
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

CapGuru NodeJS captcha client - use CapGuru with ease

CapGuru logo Donate GitHub stars Docs: https://docs.cap.guru/en/

Register via this link

Installation

Via npm npm i @captcha-libs/capguru

Usage

import { CapGuru, GenericPuzzleTask } from "@captcha-libs/capguru";

const capguruClient = new CapGuru({
  baseUrl: "https://api3.cap.guru/", // base url for capguru, default = "https://api3.cap.guru/"
  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,
});

const puzzleRequest = new GenericPuzzleTask({ body: "puzzle-image-in-base64" });

const puzzleSolution = await capguruClient.solve(puzzleRequest);

const {
  request, // as-is solution from api, example: "coordinates:x=247,y=0"
  solution // parsed solution added by this library, example: { x: 247, y: 0}
} = puzzleSolution;

//to get balance
const balance = await capguruClient.getBalance()

Parsed solution examples

  • Single coordinate

"coordinate:x=44,y=32" -> { x: 44, y: 32}
  • Multiple coordinates

"coordinates:x=99,y=196;x=197,y=148;x=144,y=47" -> [{x:99,y:196},{x:197,y:148},{x:144,y:47}]
  • Images

"5,8,4,1" -> [5, 8, 4, 1]
  • Token (parsed as-is)

"token" -> "token"

Currently supported task payloads

  1. Classification
  2. Token

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @captcha-libs/capguru

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    91.9 kB

    Total Files

    66

    Last publish

    Collaborators

    • blackravenx