Skip to main content

Working with CAPTCHA

For working with captcha and solving it, A-Parser implements specific methods that allow sending the captcha for solving to a captcha solving service using the following 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 like this:

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

You can find more details in the example from the catalog Checking website category via cyren.com service

More details about Bypassing Captcha

await this.captcha.*

Working with Captcha

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

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

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

The result will be a hash with the fields:

  • answer - text from the image
  • id - 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 captcha will be automatically downloaded via the link (url), without using proxy

.reportBad(preset, id[, overrides])

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