All Projects → infosimples → node_two_captcha

infosimples / node_two_captcha

Licence: MIT license
Node package for 2Captcha (Captcha Solver as a Service)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node two captcha

BocchiBot
BocchiBot is a multipurpose WhatsApp bot using wa-automate-nodejs library!
Stars: ✭ 228 (+430.23%)
Mutual labels:  node-js
node-ts-dedent
TypeScript package which smartly trims and strips indentation from multi-line strings
Stars: ✭ 119 (+176.74%)
Mutual labels:  node-js
node-healthchecks-api
The Node.js implementation of the Health Checks API by Hootsuite
Stars: ✭ 25 (-41.86%)
Mutual labels:  node-js
mern-ecommerce
MERN Stack ecommerce site
Stars: ✭ 122 (+183.72%)
Mutual labels:  node-js
Mastering-Node.js
📚 Belajar Dengan Jenius Node.js bareng Gun Gun Febrianza
Stars: ✭ 57 (+32.56%)
Mutual labels:  node-js
minimal-node-application
Basic Node Babel Server
Stars: ✭ 126 (+193.02%)
Mutual labels:  node-js
Shock
Shock - 내가 골라 외우는 영단어
Stars: ✭ 20 (-53.49%)
Mutual labels:  node-js
barnowl
Technology-agnostic middleware for RFID, RTLS and M2M, enabling location-aware physical spaces. We believe in an open Internet of Things.
Stars: ✭ 25 (-41.86%)
Mutual labels:  node-js
proffy
📗 Sua plataforma de estudos online.
Stars: ✭ 24 (-44.19%)
Mutual labels:  node-js
fbash
Terminal over Facebook Messenger, running continuously as a background process.
Stars: ✭ 39 (-9.3%)
Mutual labels:  node-js
nodejsdesignpatterns.com
Source for Website for Node.js Design Patterns, book by Mario Casciaro and Luciano Mammino, published by Packt (https://nodejsdp.link/buy)
Stars: ✭ 27 (-37.21%)
Mutual labels:  node-js
redive linebot
基於 Bottender 框架實作出的,公主連結聊天機器人,附加其他實用管理功能。
Stars: ✭ 20 (-53.49%)
Mutual labels:  node-js
mutode
Mutation testing for JavaScript and Node.js
Stars: ✭ 61 (+41.86%)
Mutual labels:  node-js
express-file-upload
Node.js Express Upload/Download File Rest APIs example with Multer
Stars: ✭ 64 (+48.84%)
Mutual labels:  node-js
Density-Wars
Real time peer to peer RTS game running on WebGL (WIP).
Stars: ✭ 60 (+39.53%)
Mutual labels:  node-js
adyen-node-api-library
Adyen API Library for Node.js
Stars: ✭ 82 (+90.7%)
Mutual labels:  node-js
IT API
The Internet services of the IT department of Alexander Technological Education Institute of Thessaloniki
Stars: ✭ 14 (-67.44%)
Mutual labels:  node-js
karachi
Repository for organizing the karachi nodeschools events
Stars: ✭ 21 (-51.16%)
Mutual labels:  node-js
nodejs-questions
Some common node.js questions and answers.
Stars: ✭ 22 (-48.84%)
Mutual labels:  node-js
proffy
React Native + ReactJS + NodeJS project developed on RocketSeat NexLevelWeek. This project is based on an application for connect students and teachers.
Stars: ✭ 30 (-30.23%)
Mutual labels:  node-js

Node TwoCaptcha

npm version Maintainability

Node TwoCaptcha is a Javascript package for 2Captcha - 2Captcha.com.

Installation

Just run:

npm install @infosimples/node_two_captcha

JSDoc documentation can be found at https://infosimples.github.io/node_two_captcha/

Usage

1. Create a client

// Import module
const Client = require('@infosimples/node_two_captcha');

// Declare your client
client = new Client('your_2captcha_key', {
                    timeout: 60000,
                    polling: 5000,
                    throwErrors: false});

The first parameter of the TwoCaptchaClient constructor is your API key from 2Captcha. The other parameters are:

  • timeout: Time (milliseconds) to wait before giving up on waiting for a captcha solution.
  • polling: Time (milliseconds) between polls to 2captcha server. 2Captcha documentation suggests this time to be at least 5 seconds, or you might get blocked.
  • throwErrors: Whether the client should throw errors or just log the errors.

2. Solve a CAPTCHA

Image CAPTCHA

client.decode({
  url: 'http://bit.ly/1xXZcKo'
}).then(function(response) {
  console.log(response.text);
});

> infosimples

decode is an async function. Valid parameters for decode function are:

  • base64: An already base64-coded image.
  • buffer: A buffer object of a binary image.
  • path: The path for a system-stored image.
  • url: Url for a web-located image.

The returned value will be a Captcha object. Its properties are:

  • apiResponse: Complete API response body for captcha request.
  • id: Captcha ID, as provided from 2Captcha.
  • text: Text from captcha.
  • coordinates(): If the captcha sent was a image, this function returns the coordinates (X, Y) clicked.
  • indexes(): If the captcha sent was tile-like, this function returns the indexes of the clicks on an array.

reCAPTCHA v2

client.decodeRecaptchaV2({
  googlekey: 'the_key_extracted_from_the_page',
  pageurl: 'https://www.google.com/recaptcha/api2/demo'
}).then(function(response) {
  console.log(response.text);
});

> jTfh3o9uqafa-u5RtYofHHo2uDk0T78f78HvttFGYft8pG3wuhd-UHAIy271bQXPeUNRm...

decodeRecaptchaV2 is an async function. The parameters for decodeRecaptchaV2 function are:

  • googlekey: The Google key for the reCAPTCHA.
  • pageurl: The URL of the page with the reCAPTCHA challenge.
  • invisible: optional (Boolean) switch for invisible reCAPTCHA, default is false
  • enterprise: optional (Boolean) switch for reCAPTCHA Enterprise, default is false

reCAPTCHA v3

client.decodeRecaptchaV3({
  googlekey: 'the_key_extracted_from_the_page',
  pageurl: 'https://www.site.with.recaptcha.v3/example',
  action: 'test'
}).then(function(response) {
  console.log(response.text);
});

> jTfh3o9uqafa-u5RtYofHHo2uDk0T78f78HvttFGYft8pG3wuhd-UHAIy271bQXPeUNRm...

decodeRecaptchaV3 is an async function. The parameters for decodeRecaptchaV3 function are:

  • googlekey: The Google key for the reCAPTCHA.
  • pageurl: The URL of the page with the reCAPTCHA challenge.
  • action: the action name used by the CAPTCHA.
  • enterprise: optional (Boolean) switch for reCAPTCHA Enterprise, default is false

hCaptcha

client.decodeHCaptcha({
  sitekey: 'the_key_extracted_from_the_page',
  pageurl: 'https://www.site.with.hcaptcha/example',
}).then(function(response) {
  console.log(response.text);
});

> P0_eyJ0eXAiIoJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXNza2V5IjoiczHiam4vKzZnb...

decodeHCaptcha is an async function. The parameters for decodeHCaptcha function are:

  • sitekey: The site key for the hCaptcha.
  • pageurl: The URL of the page with the hCaptcha challenge.
  • invisible: optional (Boolean) switch for invisible hCaptcha, default is false.

3. Retrieve a previously solved captcha

// 61086191138 is the ID of a previously sent CAPTCHA
client.captcha('61086191138').then(function(response){
  console.log(response);
});

> Captcha {
   _id: '61086191138',
   _apiResponse: 'OK|infosimples',
   _text: 'infosimples' }

4. Report an incorrectly solved CATPCHA for a refund

client.report('61086191138').then(function(response) {
  console.log(response);
});

// Returns whether the report was received or not
> true

Or send a correct report by setting bad parameter to false. Default is true.

client.report('61086191138', false);

Warning: abusing on this method may get you banned.

5. Get usage statistics for a specific date

let date = new Date('2019-02-04');
client.stats(date).then(function(response) {
  console.log(response);
});

// Returns an XML string with your usage statistics
> <?xml version="1.0"?><response><stats dateint="1549227600" date="2019-02-04" hour="00"><volume>0</volume><money>0</money></stats><stats dateint="1549231200" date="2019-02-04" hour="01"><volume>0</volume><money>0</money></stats>...

6. Get your 2Captcha account balance

client.balance().then(function(response) {
  console.log(response);
});

// Returns a float with your account balance in USD
> 3.75371
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].