Skip to content

CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API.

License

Notifications You must be signed in to change notification settings

LouisBillaut/capMonsterTool

Repository files navigation

✨ CapMonsterTool ✨

About this module

What is ✨ CapMonsterTool ✨ ?

CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API. You need a CapMonster Cloud account to use this module. This API allows you to resolve captcha.

Developed with

CapMonster Cloud API documentation

CapMonster Cloud API documentation is available at this url.
I strongly advise to read this documentation before using the module

Captcha Solvers

Capsolver's Banner

Supporting all common and well known captcha types and a success rate of over 99%, CapSolver allows for affordable AI-based captcha solving with JS/TS clients as well as HTTP support. Their packages are extremely affordable for projects of any size, offering a free trial to test out their service.

Getting started

import the module

The easiest way to use ths module is to import it:

import (
	"github.com/LouisBillaut/capMonsterTool"
)

main API endpoints

There are 3 main API endpoint to CapMonster API:

Examples

The examples/ folder contains some examples of use of this module.
Please note that before run example, put your own API key in apiKey field.

Get account Balance

balance, err := capMonsterTool.GetBalance(apiKey)
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(balance)

Create a task

Start by create a Task type. All possible tasks type here.
Here is some simple examples:

task1 := NoCaptchaTaskProxyless{Type: "NoCaptchaTaskProxyless", WebsiteURL: myUrl, WebsiteKey: myWebsiteKey}
task2 := ImageToTextTask{Type: "ImageToTextTask", Body: body, CapMonsterModule: "yandex"}

Your can now create a Task:

taskId1, err := capMonsterTool.CreateTask(apiKey, task1)
if err != nil {
	fmt.Println(err)
	return
}

taskId2, err := capMonsterTool.CreateTaskWithCallbackUrl(apiKey, task2, myCallbackUrl)
if err != nil {
    fmt.Println(err)
    return
}

Retrieve Task result

⚠️ Please note that calling GetTaskResult does not ensure you have an immediate captcha solution, if the CapMonsterProcessing error is thrown, try again

captchaRes, err := capMonsterTool.GetTaskResult(apiKey, taskId)
for err != nil {
	if !errors.Is(capMonsterTool.CapMonsterProcessing{}, err) {
		fmt.Println(err)
		return
	}
	fmt.Println("task is processing...")
	time.Sleep(2 * time.Second)
	captchaRes, err = capMonsterTool.GetTaskResult(apiKey, taskId)
}
fmt.Println(captchaRes)

About

CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages