captcha

package module
v0.0.0-...-bcc22ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 6 Imported by: 0

README

Golang universal captcha resolve service

GoDoc

One package for all services that support /in.php and /resp.php api. Tested on cptch.net, 2captcha.com and XEvil

Setup: go get -u github.com/Flagon00/CaptchaResolveApiClient

Example usage with reCaptchaV2 and cptch.net:

package main

import (
    "log"

    "github.com/Flagon00/CaptchaResolveApiClient"
)

func main() {
    client := captcha.Client(true, "cptch.net", "api-key")
    resolve, err := client.ReCaptchaV2("https://www.google.com/recaptcha/api2/demo",  "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", 60)
    if err != nil{
        log.Fatal(err)
    }
    log.Println(resolve)
}

Also usage with image captcha example:

client := captcha.Client(true, "cptch.net", "api-key")
resolve, err := client.RegularCaptcha("base64-string", 60)
if err != nil{
    log.Fatal(err)
}
log.Println(resolve)

Example client for 2captcha:

captcha.Client(true, "2captcha.com", "api-key")

Or if you want, you can use this package with XEvil:

captcha.Client(false, "localhost", "api-key")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaptchaServiceClient

type CaptchaServiceClient struct {
	ApiKey string
	Client *http.Client
}

func Client

func Client(secure bool, provider string, apikey string) *CaptchaServiceClient

Preparation client to use package

func (*CaptchaServiceClient) CheckResult

func (c *CaptchaServiceClient) CheckResult(captchaId string) (string, bool, error)

A method to check answer for job

func (*CaptchaServiceClient) CreatTask

func (c *CaptchaServiceClient) CreatTask(dataForm url.Values) (string, error)

A method create job and return the ID

func (*CaptchaServiceClient) ReCaptchaV2

func (c *CaptchaServiceClient) ReCaptchaV2(siteURL string, siteKey string, timeout time.Duration) (string, error)

A method that creates job with Google reCaptcha and gives you the answer

func (*CaptchaServiceClient) RegularCaptcha

func (c *CaptchaServiceClient) RegularCaptcha(base64Image string, timeout time.Duration) (string, error)

A method that creates job with regular image captcha in base64 and gives you the answer

type Response

type Response struct {
	Request string
	Status  float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL