JavaScript captcha solver
Bypass CAPTCHAs, including the widely used reCAPTCHA, using JavaScript.
Once you've integrated the captcha bypass API into your Node.js application, you have a solid foundation to build upon for developing more resilient and automated solutions. The API enables bypassing any types of CAPTCHAs, including reCAPTCHA, Arkose Labs Funcaptcha, and Cloudflare Turnstile.
Consider embedding this bypass logic directly into web scripts, especially in scenarios where captcha challenges may impede seamless automation processes. By doing so, you can streamline your workflow and enhance the efficiency of your web automation tasks.
A sample bypass code demonstrates how easily and effectively you can integrate this solution into your system. By applying this example, you can effortlessly bypass captchas and automate tasks, which is particularly relevant for service and application development. Automate captcha solving and bypass effortlessly.
Hızlı başlangıçKurulum
Komut dosyası paketi, paket yükleyici kullanılarak veya manuel olarak kurulabilir.
Node Package Manager
To install a package, you can use the Node Package Manager. Download Node.js from the link and install according to the instructions.
npm i @2captcha/captcha-solver We invite you to explore our GitHub repository where you can find JavaScript API client for easy integration with our API.
Yapılandırma
Kurulu paketi yapılandırmak için gerekli tüm parametrelerin açıklaması
Solver sınıfının bir örneği şu şekilde oluşturulabilir:
import { Solver } from '@2captcha/captcha-solver'
const solver = new Captcha.Solver("<Your 2captcha api key>")Solve captcha
When you submit any image-based captcha use can provide additional options to help 2Captcha workers to solve it properly
Captcha options
| Option | Default value | Description |
|---|---|---|
| numeric | - | Defines if captcha contains numeric or other symbols see more info in the API docs |
| min_len | - | minimal answer length |
| max_len | - | maximum answer length |
| phrase | - | defines if the answer contains multiple words or not |
| regsense | - | defines if the answer is case sensitive |
| calc | - | defines captcha requires calculation |
| lang | - | defines the captcha language, see the list of supported languages |
| textinstructions | - | hint or task text shown to workers with the captcha |
To bypass a normal captcha (distorted text on image) use the following method. This method also can be used to recognize any text on the image.
solver.imageCaptcha({
body: 'data:image/png;base64,iVBORw0KGgoAAAANSUhE...',
})
.then((res) => {
// Logs the image text
console.log(res);
})Use this method to solve reCAPTCHA V2 and obtain a token to bypass the protection.
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v2',
googlekey: '6LfD3PIbAAAAAJs_eEHvoOl75_83eXSqpPSRFJ_u'
})
.then((res) => {
console.log(res);
})This method provides reCAPTCHA V3 solver and returns a token.
solver.recaptcha({
pageurl: 'https://2captcha.com/demo/recaptcha-v3',
googlekey: '6Lcyqq8oAAAAAJE7eVJ3aZp_hnJcI6LgGdYD8lge',
version: "v3",
min_score: "0.4",
action: 'demo_action'
})
.then((res) => {
console.log(res);
})FunCaptcha (Arkoselabs) solving method. Returns a token.
solver.funCaptcha({
pageurl: "https://www.site.com/page/funcaptcha",
publickey: "823480F4-6844-FFA1-ED4E-5877CA1F1EG0"
})
.then((res) => {
console.log(res);
})Method to solve GeeTest puzzle captcha. Returns a set of tokens as JSON.
solver.geetest({
pageurl: 'https://2captcha.com/demo/geetest',
gt: '81388ea1fc187e0c335c0a8907ff2625',
challenge: '12345678abc90123d45678ef90123a456b'
})
.then((res) => {
console.log(res);
})Token-based method to bypass Capy puzzle captcha.
solver.capyPuzzle({
pageurl: "http://mysite.com/",
captchakey: "PUZZLE_Abc1dEFghIJKLM2no34P56q7rStu8v"
})
.then((res) => {
console.log(res);
})ClickCaptcha method returns coordinates of points on captcha image. Can be used if you need to click on particular points on the image.
solver.coordinates({
body: 'data:image/png;base64,iVBORw0KGgoAAAANSUhE...',
textinstructions: 'Select all photos containing the boat'
})
.then((res) => {
console.log(res);
})Diğer metodlar
Ana komut dosyalarının çalışması sırasında kullanılan ek geçerli yöntemler
send / get
Bu yöntemler, manuel captcha gönderimi ve yanıt yoklaması için kullanılabilir.
solver.imageCaptcha({
body: 'data:image/png;base64,iVBORw0KGgoAAAANSUhE...',
})
.then((res) => {
// Logs the result
console.log(res);
})balance
Hesabınızın bakiyesini almak için bu yöntemi kullanın.
solver.balance()
.then((res) => {
console.log(res)
})report
İyi veya kötü captcha yanıtını bildirmek için bu yöntemi kullanın.
solver.goodReport('7031846604') // captcha solved correctly
solver.badReport('7031854546') // captcha solved incorrectlyHata yönetimi
İstekler işlenirken hizmet tarafından döndürülen standart hataların olası çeşitleri
If case of an error captcha solver throws an exception. It's important to properly handle these cases. We recommend to use try/catch or .catch() to handle exceptions.
solver.imageCaptcha({
body: 'data:image/png;base64,iVBORw0KGgoAAAANSUhE...',
})
.then((res) => {
// Logs the result
console.log(res);
})
.catch((err) => {
// Error handling
console.log(err);
})