Skip to main content

Working with CAPTCHA

To work with and solve captchas in A-Parser, special methods are implemented that allow sending a captcha for solving to a captcha solving service using scrapers:

It is also easy to solve CAPTCHA using the method await this.parser.request()

For example, calling this method for Google ReCaptcha v2 will look as follows:

await this.parser.request('Util::ReCaptcha2', this.conf.Util_ReCaptcha2_preset, {}, siteKey + ' ' + endPoint);

More details can be found in the example from the catalog Checking site category via cyren.com service

More details about CAPTCHA bypass

await this.captcha.*

Working with captcha

.recognize(preset, image, type[, overrides])

await this.captcha.recognize(preset, image, type, overrides) - upload captcha for recognition

  • image - binary image data for recognition
  • preset - specifies the preset for Util::AntiGateUtil::AntiGate
  • type one of the following is specified: 'jpeg', 'gif', 'png'

The result will be a hash with fields:

  • answer - text from the image
  • id - captcha id, to allow reporting an error later via .reportBad
  • error - text error if answer is not set

.recognizeFromUrl(preset, url[, overrides])

await this.captcha.recognizeFromUrl(preset, url, overrides) - similar to the previous method, but the captcha upload will be performed automatically by link (url), without using a proxy

.reportBad(preset, id[, overrides])

await this.captcha.reportBad(preset, id, overrides) - notify the service that the captcha was solved incorrectly