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:
Util::AntiGate - solves image captchas containing letters/numbers/words
Util::ReCaptcha2 - solves Google ReCaptcha v2
Util::ReCaptcha3 - solves Google ReCaptcha v3
Util::hCaptcha - solves hCaptcha captchas
Util::Turnstile - solves Cloudflare Turnstile captchas
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 recognitionpreset- specifies the preset for
Util::AntiGatetypeone of the following is specified: 'jpeg', 'gif', 'png'
The result will be a hash with fields:
answer- text from the imageid- captcha id, to allow reporting an error later via.reportBaderror- 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
Useful links
🔗 ⏩ Creating JS scrapers. Working with CAPTCHA
Video on how to write a JS scraper with AntiGate support for solving captchas on pages
🔗 Creating JS scrapers. Working with CAPTCHA
Article on how to write a JS scraper with AntiGate support for solving captchas on pages
🔗 Checking website categories via cyren.com service
Example implementing Util::ReCaptcha2 connection in a JS scraper