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.
CapMonster Cloud API documentation is available at this url.
I strongly advise to read this documentation before using the module
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.
The easiest way to use ths module is to import it:
import (
"github.com/LouisBillaut/capMonsterTool"
)
There are 3 main API endpoint to CapMonster API:
- https://api.capmonster.cloud/createTask which allows you to create a captcha task
- https://api.capmonster.cloud/getTaskResult which allows you to get a request task result
- https://api.capmonster.cloud/getBalance which allows you to retrieve account balance
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.
balance, err := capMonsterTool.GetBalance(apiKey)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(balance)
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
}
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)