Documentation
¶
Index ¶
- Variables
- type Api
- type CreateTaskResponse
- type FuncaptchaTaskProxyless
- type GetBalanceResponse
- type GetTaskResultResponse
- type HCaptchaTaskProxyless
- type ImageToTextTask
- type RecaptchaV2EnterpriseTaskProxyless
- type RecaptchaV2TaskProxyless
- type RecaptchaV3TaskProxyless
- type Task
- type TaskNumericFlag
- type TaskStatus
- type TaskType
Constants ¶
This section is empty.
Variables ¶
var ( ErrCheckingTooFast = errors.New("checks should be 3 seconds apart") ErrTaskNotSubmitted = errors.New("task not yet submitted") ErrTaskNotComplete = errors.New("task not yet complete") ErrZeroBalance = errors.New("account has zero or negative balance") ErrApiKeyInvalid = errors.New("invalid api key") ErrNoAvailableWorkers = errors.New("no available workers") ErrCaptchaIdExpired = errors.New("captcha expired") ErrCaptchaUnsolvable = errors.New("captcha could not be solved by 5 different workers") )
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { ClientKey string `json:"clientKey"` // ClientKey is the API key used to access the Anti-Captcha service. // contains filtered or unexported fields }
Api is the struct used to store the http.Client & ClientKey for Anti-Captcha requests.
func NewAntiCaptchaApi ¶
NewAntiCaptchaApi creates a new Api with the client key provided.
func (*Api) GetBalance ¶
func (*Api) GetTaskStatus ¶
GetTaskStatus retrieves the status of a Task object.
func (*Api) SubmitTask ¶
SubmitTask submits a Task object for solving. The Task object is assigned its ID.
type CreateTaskResponse ¶
type FuncaptchaTaskProxyless ¶
type FuncaptchaTaskProxyless struct { WebsiteUrl string `json:"websiteURL"` WebsitePublicKey string `json:"websitePublicKey"` ApiJsSubdomain string `json:"funcaptchaApiJSSubdomain,omitempty"` Data string `json:"data,omitempty"` }
FuncaptchaTaskProxyless is a captcha solving Task aimed at Funcaptcha (Arkose Labs). See: https://anti-captcha.com/apidoc/task-types/FunCaptchaTaskProxyless
func (*FuncaptchaTaskProxyless) ToTask ¶
func (t *FuncaptchaTaskProxyless) ToTask(a *Api) *Task
ToTask creates a new Task object from a FuncaptchaTaskProxyless.
type GetBalanceResponse ¶
type GetTaskResultResponse ¶
type GetTaskResultResponse struct { ErrorId int `json:"errorId"` ErrorCode string `json:"errorCode"` ErrorDescription string `json:"errorDescription"` Status string `json:"status"` Solution map[string]interface{} `json:"solution"` Cost string `json:"cost"` Ip string `json:"ip"` CreateTime int `json:"createTime"` EndTime int `json:"endTime"` SolveCount int `json:"solveCount"` }
type HCaptchaTaskProxyless ¶
type HCaptchaTaskProxyless struct { WebsiteUrl string `json:"websiteURL"` WebsiteKey string `json:"websiteKey"` }
HCaptchaTaskProxyless is a captcha solving Task aimed at hCaptcha. See: https://anti-captcha.com/apidoc/task-types/HCaptchaTaskProxyless
func NewHCaptchaTaskProxyless ¶
func NewHCaptchaTaskProxyless(websiteUrl string, websiteKey string) (*HCaptchaTaskProxyless, error)
func (*HCaptchaTaskProxyless) ToTask ¶
func (t *HCaptchaTaskProxyless) ToTask(a *Api) *Task
ToTask creates a new Task object from a HCaptchaTaskProxyless.
type ImageToTextTask ¶
type ImageToTextTask struct { Body string `json:"body"` // Body is the base64-encoded image data, exclusive of tags such as "data:image/png". Phrase bool `json:"phrase"` // Phrase is a flag that marks the Task as requiring at least one space. If there are none, it is skipped. CaseSensitive bool `json:"case"` // CaseSensitive is a flag that marks the Task as case-sensitive. Numeric TaskNumericFlag `json:"numeric"` // Numeric is a TaskNumericFlag that is used to define the requirements for the solution. Math bool `json:"math"` // Math is a flag that marks the Task as a mathematical problem that requires calculation. MinLength int `json:"minLength"` // MinLength is a flag that marks the minimum length of a solution. 0 means unlimited. MaxLength int `json:"maxLength"` // MaxLength is a flag that marks the maximum length of a solution. 0 means unlimited. }
ImageToTextTask is a captcha solving Task that takes an image and returns the text contained in it. See: https://anti-captcha.com/apidoc/task-types/ImageToTextTask
func NewImageToTextTask ¶
func NewImageToTextTask(body string, isPhrase bool, isCaseSensitive bool, numericFlag TaskNumericFlag, isMath bool, minLength int, maxLength int) (*ImageToTextTask, error)
NewImageToTextTask creates a new ImageToTextTask.
func (*ImageToTextTask) ToTask ¶
func (t *ImageToTextTask) ToTask(a *Api) *Task
ToTask creates a new Task object from a ImageToTextTask.
type RecaptchaV2EnterpriseTaskProxyless ¶
type RecaptchaV2EnterpriseTaskProxyless struct { WebsiteUrl string `json:"websiteURL"` // WebsiteUrl is the url of the page the ReCaptcha task is in. WebsiteKey string `json:"websiteKey"` // WebsiteKey is the ReCaptcha key used by the page. EnterprisePayload *map[string]interface{} `json:"enterprisePayload,omitempty"` // EnterprisePayload is the additional parameters present in the ReCaptcha widget. ApiDomain string `json:"apiDomain,omitempty"` // ApiDomain is the domain the ReCaptcha script should be served from. Do not use unless you know what you're doing. }
RecaptchaV2EnterpriseTaskProxyless is a captcha solving Task aimed at ReCaptcha V2. See: https://anti-captcha.com/apidoc/task-types/RecaptchaV2EnterpriseTaskProxyless
func NewRecaptchaV2EnterpriseTaskProxyless ¶
func NewRecaptchaV2EnterpriseTaskProxyless(websiteUrl string, websiteKey string, enterprisePayload *map[string]interface{}, apiDomain string) (*RecaptchaV2EnterpriseTaskProxyless, error)
NewRecaptchaV2EnterpriseTaskProxyless creates a new RecaptchaV2EnterpriseTaskProxyless.
func (*RecaptchaV2EnterpriseTaskProxyless) ToTask ¶
func (t *RecaptchaV2EnterpriseTaskProxyless) ToTask(a *Api) *Task
ToTask creates a new Task object from a RecaptchaV2TaskProxyless.
type RecaptchaV2TaskProxyless ¶
type RecaptchaV2TaskProxyless struct { WebsiteUrl string `json:"websiteURL"` // WebsiteUrl is the url of the page the ReCaptcha task is in. WebsiteKey string `json:"websiteKey"` // WebsiteKey is the ReCaptcha key used by the page. DataSValue string `json:"recaptchaDataSValue,omitempty"` // DataSValue is the value of the `data-s` field (only present on Google sites) IsInvisible bool `json:"isInvisible"` // IsInvisible is a flag indicating whether the ReCaptcha is invisible or not. }
RecaptchaV2TaskProxyless is a captcha solving Task aimed at ReCaptcha V2. See: https://anti-captcha.com/apidoc/task-types/RecaptchaV2TaskProxyless
func NewRecaptchaV2TaskProxyless ¶
func NewRecaptchaV2TaskProxyless(websiteUrl string, websiteKey string, dataSValue string, isInvisible bool) (*RecaptchaV2TaskProxyless, error)
NewRecaptchaV2TaskProxyless creates a new RecaptchaV2TaskProxyless.
func (*RecaptchaV2TaskProxyless) ToTask ¶
func (t *RecaptchaV2TaskProxyless) ToTask(a *Api) *Task
ToTask creates a new Task object from a RecaptchaV2TaskProxyless.
type RecaptchaV3TaskProxyless ¶
type RecaptchaV3TaskProxyless struct { WebsiteUrl string `json:"websiteURL"` // WebsiteUrl is the url of the page the ReCaptcha task is in. WebsiteKey string `json:"websiteKey"` // WebsiteKey is the ReCaptcha key used by the page. MinScore float64 `json:"minScore"` // MinScore is the minimum ReCaptcha score of the worker to be assigned to the Task. Valid values: 0.3, 0.7, 0.9. PageAction string `json:"pageAction,omitempty"` // PageAction is the ReCaptcha `action` value. IsEnterprise bool `json:"isEnterprise,omitempty"` // IsEnterprise is a flag indicating whether the ReCaptcha is being solved using the Enterprise API. ApiDomain string `json:"apiDomain,omitempty"` // ApiDomain is the domain the ReCaptcha script should be served from. Do not use unless you know what you're doing. }
RecaptchaV3TaskProxyless is a captcha solving Task aimed at ReCaptcha V3. See: https://anti-captcha.com/apidoc/task-types/RecaptchaV3TaskProxyless
func NewRecaptchaV3TaskProxyless ¶
func NewRecaptchaV3TaskProxyless(websiteUrl string, websiteKey string, minScore float64, pageAction string, isEnterprise bool, apiDomain string) (*RecaptchaV3TaskProxyless, error)
NewRecaptchaV3TaskProxyless creates a new RecaptchaV3TaskProxyless.
func (*RecaptchaV3TaskProxyless) ToTask ¶
func (t *RecaptchaV3TaskProxyless) ToTask(a *Api) *Task
ToTask creates a new Task object from a RecaptchaV3TaskProxyless.
type Task ¶
type Task struct { ID int // ID is the task identifier generated by Anti-Captcha Type TaskType // Type is the TaskType of the Task. Parameters interface{} // Parameters is a struct of task parameters (e.g.: ImageToTextTask, RecaptchaV2TaskProxyless) Status TaskStatus // Status is the current TaskStatus of the Task. // contains filtered or unexported fields }
Task is the root struct used for submitting tasks to Anti-Captcha.
type TaskNumericFlag ¶
type TaskNumericFlag int
TaskNumericFlag is an int-flag used in ImageToTextTask that defines the requirements for a solution.
TaskNumericFlagAll (0): No specific requirements. TaskNumericFlagNumbersOnly (1): The answer can only contain numbers. TaskNumericFlagNumbersExcluded (2): The answer cannot contain numbers.
const ( TaskNumericFlagAll TaskNumericFlag = 0 TaskNumericFlagNumbersOnly TaskNumericFlag = 1 TaskNumericFlagNumbersExcluded TaskNumericFlag = 2 )
type TaskStatus ¶
type TaskStatus string
const ( TaskStatusNotSubmitted TaskStatus = "NotSubmitted" TaskStatusProcessing TaskStatus = "processing" TaskStatusReady TaskStatus = "ready" )
type TaskType ¶
type TaskType string
TaskType is an enum containing valid types for a Task.
const ( TaskTypeImageToText TaskType = "ImageToTextTask" TaskTypeRecaptchaV2Proxyless TaskType = "RecaptchaV2TaskProxyless" TaskTypeRecaptchaV2EnterpriseProxyless TaskType = "RecaptchaV2EnterpriseTaskProxyless" TaskTypeRecaptchaV3Proxyless TaskType = "RecaptchaV3TaskProxyless" TaskTypeFuncaptchaProxyless TaskType = "FuncaptchaTaskProxyless" TaskTypeHCaptchaProxyless TaskType = "HCaptchaTaskProxyless" )