
Product
Announcing Precomputed Reachability Analysis in Socket
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
puppeteer-recaptcha-solver
Advanced tools
Google Recapctha v2 solver with puppeteer. You can simply use it in your project by passing to the constructor your
Page
object. The solver is using SpeechToText recognition, you can use one of our integrated solvers with your API key or to provide your own solving function. You can also integrate your own logger.
This is an academic project, it is not intended to be used in production. It is not recommended to use this project for any other purpose than educational. The author is not responsible for any misuse of this project.
This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install.
These instructions will help to you install the package in your project, set it and use it. See Contributing for notes on how to help and contribute this project.
BEFORE YOU INSTALL: please read the prerequisites
To install and set up the library, run:
$ npm install puppeteer-recaptcha-solver
To use, simply create the object and execute the solve
command.
Example:
(async () => {
const browser = await puppeteer.launch({
headless: false,
});
const page = await browser.newPage();
const solver = new ReCaptchaSolver({
page,
maxRetries: 3,
transcriber: Transcribers.witAI,
apiKey: 'YOUR_API_KEY'
});
await page.goto(
'https://recaptcha-demo.appspot.com/recaptcha-v2-checkbox.php'
);
const solved = await solver.solve();
console.log('Captcha solved: ', solved);
await page.screenshot({ path: 'example/example.png' });
await browser.close();
})();
const solver = new ReCaptchaSolver({
page,
log,
maxRetries: 3,
transcriber: Transcribers.witAI,
apiKey: 'YOUR_API_KEY'
});
A constructor to the object.
Supported options for the constructor
field are listed below.
Field | Type | Default value | Required | Description |
---|---|---|---|---|
page | Page | Yes | puppeteer page object | |
log | Logger | console.log | No | A logger that the solver will use. You can also use the default logger or noopLogger to disable the logs |
transcriber | Transcriber | witAI | No | A transcriber that the solver will use to transcriber the audio to text. You can can choose between witAI or googleSpeechToText by passing Transcribers.witAI or Transcribers.googeSpeechToText or passing you own Transcriber function. |
maxRetries | number | 3 | No | Total number of retries until the captcha is solved |
apiKey | string | No | API key to your transcribe service |
const solved: boolean = await solver.solve();
A command that will start the solving process.
Returns a Promise<boolean>
to indicate if the captcha successfully solved.
Type | Signature | Description |
---|---|---|
Logger | interface Logger { | A logger object that the solver will use. |
Transcriber | type Transcriber = ( | A transcribe function that gets an ArrayBuffer and should return the text |
const defaultLogger: Logger = {
log: (message: string) => console.log('[LOG]', message),
error: (message: string) => console.error('[ERROR]', message),
warn: (message: string) => console.warn('[WARN]', message),
info: (message: string) => console.info('[INFO]', message),
debug: (message: string) => console.debug('[DEBUG]', message),
};
const witAI: Transcriber = async (
audioBuffer: ArrayBuffer,
apiKey?: string
) => {
if (!apiKey) {
throw new Error('witAI transcriber requires API key');
}
const { data } = await axios.post<string>(
'https://api.wit.ai/speech?v=20220622',
audioBuffer,
{
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'audio/mpeg3',
},
}
);
const parsed =
typeof data === 'string'
? JSON.parse(data.split('\r\n').slice(-1)[0] || '{}')
: data;
return parsed?.text;
}
const googleSpeechToText: Transcriber = async (
audioBuffer: ArrayBuffer,
apiKey?: string
) => {
if (!apiKey) {
throw new Error('googleSpeechToText transcriber requires API key');
}
const { data } = await axios.post<string>(
`https://speech.googleapis.com/v1p1beta1/speech:recognize?key=${apiKey}`,
{
config: {
encoding: 'MP3',
sampleRateHertz: 16000,
languageCode: 'en-US',
},
audio: {
content: Buffer.from(audioBuffer).toString('base64'),
},
}
);
const parsed =
typeof data === 'string'
? JSON.parse(data.split('\r\n').slice(-1)[0] || '{}')
: data;
return parsed?.results?.[0]?.alternatives?.[0]?.transcript;
};
Start with cloning this repo on your local machine:
$ git clone https://github.com/dore51/puppeteer-captcha-solver.git
$ cd puppeteer-captcha-solver
To install and set up the library, run:
$ npm install
$ npm run example
$ npm test
$ npm run build
This task will create a distribution version of the project
inside your local lib/
folder
$ npm publish
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
git checkout -b my-new-feature
git add .
git commit -am 'Add some feature'
git push origin my-new-feature
This package has the following dependencies:
The following dependencies are only required for development and testing purposes:
See also the list of contributors who participated in this project.
MIT License © Dor Eitan
FAQs
ReCaptcha solver for puppeteer
The npm package puppeteer-recaptcha-solver receives a total of 5 weekly downloads. As such, puppeteer-recaptcha-solver popularity was classified as not popular.
We found that puppeteer-recaptcha-solver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.