rucaptcha-resolver
v1.0.3
Published
This package provide simple API to RuCaptcha service
Downloads
66
Readme
RuCaptcha Resolver
RuCaptcha Resolver is a simple library for cracking captcha through rucaptcha service.
To install
npm install rucaptcha-resolver
To run the ava tests
npm test
Node versions
RuCaptcha Resolver is intended to be run on NodeJS 4.x or higher.
API
'use strict';
const request = require('co-request').defaults({ encoding: null });
const vo = require('vo');
const RuCaptchaResolver = require('rucaptcha-resolver');
vo(function* () {
const solver = new RuCaptchaResolver({ apiKey: 'YOUR_API_KEY' });
try {
const response = yield request.get('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg');
const body = response.body;
// Image should be in base64 encoding
const image = new Buffer(body).toString('base64');
const result = yield* solver.resolve({ image });
console.log(`Captcha Text: ${result}`);
} catch (e) {
console.log(e);
}
})();