UNPKG

bestcaptchasolver

Version:

bestcaptchasolve-nodejs is a super easy to use bypass captcha nodeJS API wrapper for bestcaptchasolver.com captcha service

51 lines (44 loc) 1.77 kB
#!/usr/bin/node // require library var bestcaptchasolver = require('../'); // check /account for accesskey const ACCESS_TOKEN = 'ACCESS_TOKEN_HERE'; // log what's happening to UI and console function log(txt) { console.log(txt); } // for more details check https://bestcaptchasolver.com/captchabypass-api // example method function example() { var captcha_id = undefined; bestcaptchasolver.set_access_token(ACCESS_TOKEN); // balance bestcaptchasolver.account_balance().then(function (balance) { log('Balance: $' + balance); // print balance gathered log('Solving task...'); return bestcaptchasolver.submit_task({ template_name: 'Login test page', page_url: 'https://bestcaptchasolver.com/automation/login', variables: {"username": "xyz", "password": "0000"}, // user_agent: 'your UA', // proxy: '12.34.54.56:1234' // affiliate_id: 'ID of affiliate' }); }).then(function (id) { captcha_id = id; log('Got ID ' + id + ', waiting for completion ...'); // submit pushVariables while task is being solved by the worker // very helpful, for e.g. in cases of 2FA authentication // return bestcaptchasolver.task_push_variables(captcha_id, {"tfa_code": "4965"}) }).then(() => { return bestcaptchasolver.retrieve_captcha(captcha_id); }).then(function (data) { log('Solution: ' + JSON.stringify(data.solution)); // return bestcaptchasolver.set_captcha_bad(captcha_id); // set captcha as bad }).catch(function (err) { log('Error: ' + err.message || err); }).then(function () { log('Example finished !'); }); } example(); // run example