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:
Util::AntiGate - solves image captchas with 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 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 recognitionpreset- points to the preset for
Util::AntiGatetypeone of: 'jpeg', 'gif', 'png' is specified
The result will be a hash with the fields:
answer- text from the imageid- id 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 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
Useful links
🔗 ⏩ Creating JS scrapers. Working with CAPTCHA
Video on how to write a JS scraper that supports anti-gate for solving captchas on pages
🔗 Creating JS scrapers. Working with CAPTCHA
Article on how to write a JS scraper that supports anti-gate for solving captchas on pages
🔗 Checking website category via cyren.com service
Example of implementing Util::ReCaptcha2 connection in a JS scraper