Skip to main content

Working with CAPTCHA

For working and solving CAPTCHA in A-Parser, special methods are implemented that allow sending 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 would look like this:

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

You can learn more in the example from the catalog Checking website categories through the cyren.com service

Learn more about Bypassing CAPTCHA

await this.captcha.*

Working with CAPTCHA

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

await this.captcha.recognize(preset, image, type, overrides) - uploading a CAPTCHA for recognition

  • image - binary image data for recognition
  • preset - indicates a preset for Util::AntiGateUtil::AntiGate
  • type is specified as one of: 'jpeg', 'gif', 'png'

The result will be a hash with fields:

  • answer - text from the image
  • id - CAPTCHA id, for the possibility to report an error later through .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 will be automatically downloaded by the link (url), without using a proxy

.reportBad(preset, id[, overrides])

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