Skip to content
alperensert edited this page Dec 25, 2021 · 1 revision

io.github.alperensert.capmonster_java.tasks

ImageToTextTask

Parameter Type Required Default value Purpose
clientKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
base64EncodedImage String Yes - Image body encoded in base64. Make sure to send it without line breaks and as string
methods
Method Parameter Type Required Default value Purpose
setModuleName name String No universal Name of recognizing module e.g yandex
setThreshold value int No - Captcha recognition threshold with a possible value from 0 to 100. For example, if a value of 90 was sent to the system, and the problem was solved with confidence of 80, then the money for the solution will not be charged. In this case, the user will receive an ERROR_CAPTCHA_UNSOLVABLE exception
setCase _case boolean No - Whether to consider case when deciding or not
isNumeric numeric boolean No - true - if the captcha consists of numbers only
setMath math boolean No - true - captcha requires a mathematical action (e.g captcha 2 + 6 = will return the value 8)

RecaptchaV2Task

Parameter Type Required Default value Purpose
clientKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
websiteUrl String Yes - Address of a webpage with Google ReCaptcha
websiteKey String Yes - Recaptcha website key (div class="g-recaptcha" data-sitekey="THAT_ONE")
methods
Method Parameter Type Required Default value Purpose
setCookies cookies Cookies No - Additional cookies which we must use during interaction with target page or Google

If you are pass the cookies as string, here is the format: cookiename1=cookievalue1; cookiename2=cookievalue2
setProxy proxy Proxy No - Set proxy for the task. If the proxy is authorized by IP, then be sure to add 116.203.55.208 to the white list.
setUserAgent ua UserAgent No - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser"
setRecaptchaSValue value String No - Some custom implementations may contain additional "data-s" parameter in ReCaptcha2 div, which is in fact a one-time token and must be grabbed every time you want to solve a ReCaptcha2.
setCache cache boolean No false true - if you want non-cached results.

Explanation: You receive a token, send it to the site, but the site rejects it. Moreover, sometimes the site can accept a token, e.g. in one case out of 10 (the percentage of success in your case may be different)

RecaptchaV3Task

Parameter Type Required Default value Purpose
clientKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
websiteUrl String Yes - Address of a webpage with Google ReCaptcha
websiteKey String Yes - Recaptcha website key

(google.com/recaptcha/api.js?render="THAT_ONE")
methods
Method Parameter Type Required Default value Purpose
setMinScore score double No 0.3 It's like trust value. Must be 0.1 and 0.9
setPageAction action String No verify Widget action value. Website owner defines what user is doing on the page through this parameter.

e.g. grecaptcha.execute('site_key', {action:'login_test'})
setCache cache boolean No false true - if you want non-cached results.

Explanation: You receive a token, send it to the site, but the site rejects it. Moreover, sometimes the site can accept a token, e.g. in one case out of 10 (the percentage of success in your case may be different)

HCaptchaTask

Parameter Type Required Default value Purpose
apiKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
websiteUrl String Yes - Address of a webpage with hCaptcha
websiteKey String Yes - hCaptcha website key
methods
Method Parameter Type Required Default value Purpose
setVisibility visible boolean No false true - for invisible version of hcaptcha
setCustomData data String No - Custom data that is used in some implementations of hCaptcha, mostly with isInvisible=true. In most cases you see it as rqdata inside network requests

IMPORTANT: You MUST provide an user agent if you submit captcha with data parameter. The value should match the user agent you use when interacting with the target website.
setCookies cookies Cookies No - Additional cookies which we must use during interaction with target page or Google

If you are pass the cookies as string, here is the format: cookiename1=cookievalue1; cookiename2=cookievalue2
setProxy proxy Proxy No - Set proxy for the task. If the proxy is authorized by IP, then be sure to add 116.203.55.208 to the white list.
setUserAgent ua UserAgent No - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser"
setCache cache boolean No false true - if you want non-cached results.

Explanation: You receive a token, send it to the site, but the site rejects it. Moreover, sometimes the site can accept a token, e.g. in one case out of 10 (the percentage of success in your case may be different)

FunCaptchaTask

Parameter Type Required Default value Purpose
apiKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
websiteUrl String Yes - Address of a webpage with FunCaptcha
websitePublicKey String Yes - FunCaptcha website key

(div id="funcaptcha" data-pkey="THAT_ONE")
methods
Method Parameter Type Required Default value Purpose
setApiSubdomain subdomain String No - A special subdomain of funcaptcha.com, from which the JS captcha widget should be loaded. Most FunCaptcha installations work from shared domains, so this option is only needed in certain rare cases.
setCookies cookies Cookies No - Additional cookies which we must use during interaction with target page or Google

If you are pass the cookies as string, here is the format: cookiename1=cookievalue1; cookiename2=cookievalue2
setProxy proxy Proxy No - Set proxy for the task. If the proxy is authorized by IP, then be sure to add 116.203.55.208 to the white list.
setUserAgent ua UserAgent No - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser"

GeeTestTask

Parameter Type Required Default value Purpose
apiKey String Yes - Your unique key to solve captchas

method createTask

Parameter Type Required Default value Purpose
taskBuilder TaskBuilder Yes - Create tasks easily with task builder

static class TaskBuilder

Parameter Type Required Default value Purpose
websiteUrl String Yes - Address of the page on which the captcha is recognized
gt String Yes - The GeeTest identifier key for the domain. Static value, rarely updated.
challenge String Yes - A dynamic key.
Each time our API is called, we need to get a new key value. If the captcha is loaded on the page, then the challenge value is no longer valid.
It is necessary to examine the requests and find the one in which this value is returned and, before each creation of the recognition task, execute this request and parse the challenge from it.
methods
Method Parameter Type Required Default value Purpose
setServerSubdomain subdomain String No - Optional parameter. May be required for some sites.
setGetLib lib String No - Optional parameter. May be required for some sites.
Send JSON as a string.
setProxy proxy Proxy No - Set proxy for the task. If the proxy is authorized by IP, then be sure to add 116.203.55.208 to the white list.
setUserAgent ua UserAgent No - Browser's User-Agent which is used in emulation. It is required that you use a signature of a modern browser, otherwise Google will ask you to "update your browser"

Inherited task methods

method getBalance

  • Does not have any specific parameter, returns the current balance of specified api key

method getTaskResult

  • Get task's result. Returns a dictionary if task is ready, else returns false |Parameter|Type|Required|Default value|Purpose| |---------|----|--------|-------------|-------| |taskId|int|Yes|-|ID which was obtained in createTask method|

method joinTaskResult

  • Get task's result. Returns a dictionary if task is ready, else raise CapmonsterException with error code MAXIMUM_TIME_EXCEED
Parameter Type Required Default value Purpose
taskId int Yes - ID which was obtained in createTask method
maximumTime int No 120