anticaptcha

package
v0.0.0-...-f4b5f6f Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountService

type AccountService service

AccountService handles communication with the account actions of the anti-captcha API

func (*AccountService) GetBalance

func (s *AccountService) GetBalance() (float64, error)

GetBalance represents balance from account

type AdditionalParams

type AdditionalParams service

AdditionalParams handles communication with the captcha additional params

func (*AdditionalParams) AddComment

func (ap *AdditionalParams) AddComment(val string)

AddComment represents empty = default value Option 1. Send along with any captcha to make it more clear for workers. Option 2. Send without captcha if you just want to ask a question (example: "What color is the sky?")

func (*AdditionalParams) CaptchaContainsAnyCharacters

func (ap *AdditionalParams) CaptchaContainsAnyCharacters()

CaptchaContainsAnyCharacters represents set default value for Numeric option

func (*AdditionalParams) CaptchaContainsNumericOnly

func (ap *AdditionalParams) CaptchaContainsNumericOnly()

CaptchaContainsNumericOnly represents captcha consists of digits only

func (*AdditionalParams) CaptchaNotContainAnyDigits

func (ap *AdditionalParams) CaptchaNotContainAnyDigits()

CaptchaNotContainAnyDigits represents captcha does not contain any digits

func (*AdditionalParams) DebugParams

func (ap *AdditionalParams) DebugParams()

DebugParams represents show all captcha additional params

func (*AdditionalParams) DisableAllowEmpty

func (ap *AdditionalParams) DisableAllowEmpty()

DisableAllowEmpty represents disable AllowEmpty option

func (*AdditionalParams) DisableCalc

func (ap *AdditionalParams) DisableCalc()

DisableCalc represents disable option Calc

func (*AdditionalParams) DisableHeaderAcao

func (ap *AdditionalParams) DisableHeaderAcao()

DisableHeaderAcao represents disable option HeaderAcao

func (*AdditionalParams) DisableIsRussian

func (ap *AdditionalParams) DisableIsRussian()

DisableIsRussian represents disable option IsRussian

func (*AdditionalParams) DisablePhrate

func (ap *AdditionalParams) DisablePhrate()

DisablePhrate represents disable option Phrate

func (*AdditionalParams) DisableRegsense

func (ap *AdditionalParams) DisableRegsense()

DisableRegsense represents disable option Regsense

func (*AdditionalParams) EnableAllowEmpty

func (ap *AdditionalParams) EnableAllowEmpty()

EnableAllowEmpty represents Allow empty response for Google Recaptcha. This is useful if you want to allow our workers to mark captcha as unsolvable because no matching objects were found on your captcha. If you send value "1", workers will have a button "no objects found" with each recaptcha marked this way.. If worker pushed this button, API will return text "EMPTY_ANSWER" as captcha result.

func (*AdditionalParams) EnableCalc

func (ap *AdditionalParams) EnableCalc()

EnableCalc represents arithmetical operation must be performed

func (*AdditionalParams) EnableHeaderAcao

func (ap *AdditionalParams) EnableHeaderAcao()

EnableHeaderAcao represents API sends Access-Control-Allow-Origin: * parameter in response header. (Required for cross-domain AJAX requests from client-side applications).

func (*AdditionalParams) EnableIsRussian

func (ap *AdditionalParams) EnableIsRussian()

EnableIsRussian represents captcha goes to Russian Queue

func (*AdditionalParams) EnablePhrate

func (ap *AdditionalParams) EnablePhrate()

EnablePhrate represents captcha has 2-3 words

func (*AdditionalParams) EnableRegsense

func (ap *AdditionalParams) EnableRegsense()

EnableRegsense represents captcha is case sensitive

func (*AdditionalParams) LoadParams

func (ap *AdditionalParams) LoadParams() map[string]string

LoadParams represents return all params

func (*AdditionalParams) ResetMaxCaptchaLengthToDefault

func (ap *AdditionalParams) ResetMaxCaptchaLengthToDefault()

ResetMaxCaptchaLengthToDefault represents reset option MsxLength to default value

func (*AdditionalParams) ResetMinCaptchaLengthToDefault

func (ap *AdditionalParams) ResetMinCaptchaLengthToDefault()

ResetMinCaptchaLengthToDefault represents reset option MinLength to default value

func (*AdditionalParams) ResetToDefault

func (ap *AdditionalParams) ResetToDefault()

ResetToDefault represents reset params to default values

func (*AdditionalParams) SetCaptchaType

func (ap *AdditionalParams) SetCaptchaType(val string)

SetCaptchaType represents empty = default value recaptcha2 = Use this value for Recaptcha2 images. Image must have size ratio 1x1, minimum height 200 pixels and come along with "comment" parameter. This is where you should specify English name of the object which worker must choose (cat, road sign, burger, etc.). recaptcha2_44 = Same thing as "recaptcha2" but we will put this captcha in a mask of 16 squares (4 x 4). recaptcha2_24 = Recaptcha2 in a mask of 8 squares (2 x 4). It is very important that you send only captcha image without blue heading or any comments embeded in image. audio = Use this value to send audio captchas in MP3 format.

func (*AdditionalParams) SetMaxCaptchaLength

func (ap *AdditionalParams) SetMaxCaptchaLength(val int)

SetMaxCaptchaLength represents set maximum length of captcha text required to input

func (*AdditionalParams) SetMinCaptchaLength

func (ap *AdditionalParams) SetMinCaptchaLength(val int)

SetMinCaptchaLength represents set minimum length of captcha text required to input

func (*AdditionalParams) SetSoftID

func (ap *AdditionalParams) SetSoftID(val int)

SetSoftID represents set AppCenter Application ID used for comission earnings

type CaptchaParams

type CaptchaParams struct {
	Phrase      int    `t:"phrase"`
	Regsense    int    `t:"regsense"`
	Calc        int    `t:"calc"`
	IsRussian   int    `t:"is_russian"`
	HeaderAcao  int    `t:"header_acao"`
	AllowEmpty  int    `t:"allow_empty"`
	Numeric     int    `t:"numeric"`
	MinLength   int    `t:"min_len"`
	MaxLength   int    `t:"max_len"`
	SoftID      int    `t:"soft_id"`
	CaptchaType string `t:"type" default:""`
	Comment     string `t:"comment" default:""`
}

CaptchaParams contains additional parametrs for captcha

type CaptchaService

type CaptchaService service

CaptchaService handles communication with the captcha actions of the anti-captcha API

func (*CaptchaService) GetText

func (s *CaptchaService) GetText(id int) (string, error)

GetText represents return captcha text by ID

func (*CaptchaService) UploadCaptchaFromBase64

func (s *CaptchaService) UploadCaptchaFromBase64(base64 string) (int, error)

UploadCaptchaFromBase64 represents updaload base64 string to http://anti-captcha.com API and get capthca ID

func (*CaptchaService) UploadCaptchaFromFile

func (s *CaptchaService) UploadCaptchaFromFile(path string) (int, error)

UploadCaptchaFromFile represents updaload image(jpg, gif, png) to http://anti-captcha.com API and get capthca ID

func (*CaptchaService) UploadCaptchaFromURL

func (s *CaptchaService) UploadCaptchaFromURL(url string) (int, error)

UploadCaptchaFromURL represents upload captcha from url

type Client

type Client struct {

	// Base URL for API requests.
	BaseURL *url.URL

	//Api key
	APIKey string

	// Services used for talking to different parts of the API.
	Account                 *AccountService
	Captcha                 *CaptchaService
	CaptchaAdditionalParams *AdditionalParams
	// contains filtered or unexported fields
}

A Client manages communication with the API.

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a new API client. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(req *http.Request) ([]byte, error)

Do sends an API request and returns the API response.

func (*Client) GetSystemStat

func (c *Client) GetSystemStat() (*SystemStat, error)

GetSystemStat represents load real time load statistics

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client.

type SystemStat

type SystemStat struct {
	Waiting                  int     `xml:"waiting"`
	WaitingRU                int     `xml:"waitingRU"`
	Load                     float64 `xml:"load"`
	Minbid                   float64 `xml:"minbid"`
	MinbidRU                 float64 `xml:"minbidRU"`
	AverageRecognitionTime   float64 `xml:"averageRecognitionTime"`
	AverageRecognitionTimeRU float64 `xml:"averageRecognitionTimeRU"`
}

SystemStat contains statistics from anti-captcha system

Jump to

Keyboard shortcuts

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