CAPTCHAFORUM
Administrator
Client for sites https://rucaptcha.com and https://2captcha.com . Easy to use because it is completely promise based.
Installation
Usage example
Properties
Installation
npm install rucaptcha-client
Usage example
Code:
import Rucaptcha from 'rucaptcha-client' ;
async ( ) => {
const rucaptcha = new Rucaptcha ( 'YOUR_APIKEY' ) ;
// If you want to use 2captcha as endpoint
// By default, rucaptcha.com will be used
rucaptcha . baseUrl = 'https://2captcha.com' ;
// If the API key was specified incorrectly, RucaptchaError will be thrown with the code
// ERROR_KEY_DOES_NOT_EXIST. It is useful to call this method immediately after
// initialization to make sure the API key is correct.
const balance = await rucaptcha.getBalance();
const imageUrl =
'https://raw.githubusercontent.com/ivan-podgornov/rucaptcha-client/master/src/rucaptcha/images/captcha.jpg';
const answer = await rucaptcha.solve(imageUrl);
console.log(answer.text); //
};
Properties
- balance: number - the result of the last getBalance or null.
- baseUrl: string = 'https://rucaptcha.com'- the base URL to which the request should be made. If you want to change it to https://2captcha.com , after creating the captcha object, change the baseUrl property. See example above
- constructor(apikey: string)- the key can be found here: https://2captcha.com/setting .
- async getBalance: Promise<number> - returns the balance of the current user.
- async solve(url: string): Promise<{ text: string }> - solves a captcha with an image that can be downloaded at the specified url.