Socket
Socket
Sign inDemoInstall

puppeteer-extra-plugin-recaptcha

Package Overview
Dependencies
140
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.3 to 3.1.4

dist/puppeteer-mods.d.ts

9

dist/index.cjs.js
/*!
* puppeteer-extra-plugin-recaptcha v3.1.2 by berstend
* puppeteer-extra-plugin-recaptcha v3.1.3 by berstend
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-recaptcha

@@ -462,2 +462,5 @@ * @license MIT

this.debug('getRecaptchaSolutions', response);
if (response && response.error) {
console.warn('PuppeteerExtraPluginRecaptcha: An error occured during "getRecaptchaSolutions":', response.error);
}
if (this.opts.throwOnError && response.error) {

@@ -470,3 +473,5 @@ throw new Error(response.error);

this.debug('enterRecaptchaSolutions');
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', { solutions }));
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', {
solutions
}));
const response = evaluateReturn;

@@ -473,0 +478,0 @@ response.error = response.error || response.solved.find(s => !!s.error);

import { PuppeteerExtraPlugin } from 'puppeteer-extra-plugin';
import { Page } from 'puppeteer';
import * as types from './types';

@@ -14,7 +15,7 @@ export declare const BuiltinSolutionProviders: types.SolutionProvider[];

private _generateContentScript;
findRecaptchas(page: types.Page): Promise<types.FindRecaptchasResult>;
findRecaptchas(page: Page): Promise<types.FindRecaptchasResult>;
getRecaptchaSolutions(captchas: types.CaptchaInfo[], provider?: types.SolutionProvider): Promise<types.GetSolutionsResult>;
enterRecaptchaSolutions(page: types.Page, solutions: types.CaptchaSolution[]): Promise<types.EnterRecaptchaSolutionsResult>;
solveRecaptchas(page: types.Page): Promise<types.SolveRecaptchasResult>;
onPageCreated(page: types.Page): Promise<void>;
enterRecaptchaSolutions(page: Page, solutions: types.CaptchaSolution[]): Promise<types.EnterRecaptchaSolutionsResult>;
solveRecaptchas(page: Page): Promise<types.SolveRecaptchasResult>;
onPageCreated(page: Page): Promise<void>;
}

@@ -21,0 +22,0 @@ /** Default export, PuppeteerExtraPluginRecaptcha */

/*!
* puppeteer-extra-plugin-recaptcha v3.1.2 by berstend
* puppeteer-extra-plugin-recaptcha v3.1.3 by berstend
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-recaptcha

@@ -456,2 +456,5 @@ * @license MIT

this.debug('getRecaptchaSolutions', response);
if (response && response.error) {
console.warn('PuppeteerExtraPluginRecaptcha: An error occured during "getRecaptchaSolutions":', response.error);
}
if (this.opts.throwOnError && response.error) {

@@ -464,3 +467,5 @@ throw new Error(response.error);

this.debug('enterRecaptchaSolutions');
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', { solutions }));
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', {
solutions
}));
const response = evaluateReturn;

@@ -467,0 +472,0 @@ response.error = response.error || response.solved.find(s => !!s.error);

@@ -99,2 +99,5 @@ "use strict";

this.debug('getRecaptchaSolutions', response);
if (response && response.error) {
console.warn('PuppeteerExtraPluginRecaptcha: An error occured during "getRecaptchaSolutions":', response.error);
}
if (this.opts.throwOnError && response.error) {

@@ -107,3 +110,5 @@ throw new Error(response.error);

this.debug('enterRecaptchaSolutions');
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', { solutions }));
const evaluateReturn = await page.evaluate(this._generateContentScript('enterRecaptchaSolutions', {
solutions
}));
const response = evaluateReturn;

@@ -110,0 +115,0 @@ response.error = response.error || response.solved.find(s => !!s.error);

@@ -8,5 +8,9 @@ "use strict";

const index_1 = __importDefault(require("./index"));
// import * as types from './types'
// import { Puppeteer } from './puppeteer-mods'
const puppeteer_extra_1 = require("puppeteer-extra");
const PUPPETEER_ARGS = ['--no-sandbox', '--disable-setuid-sandbox'];
ava_1.default('will detect captchas', async (t) => {
const puppeteer = require('puppeteer-extra');
// const puppeteer = require('puppeteer-extra')
const puppeteer = puppeteer_extra_1.addExtra(require('puppeteer'));
const recaptchaPlugin = index_1.default();

@@ -13,0 +17,0 @@ puppeteer.use(recaptchaPlugin);

@@ -1,2 +0,2 @@

import * as Puppeteer from 'puppeteer';
/// <reference path="../src/puppeteer-mods.d.ts" />
/**

@@ -14,8 +14,9 @@ * Extend window object with recaptcha things

export declare type RecaptchaPluginPageAdditions = {
/** Attempt to find all reCAPTCHAs on this page. */
findRecaptchas: () => Promise<FindRecaptchasResult>;
getRecaptchaSolutions: (captchas: CaptchaInfo[], provider?: SolutionProvider) => Promise<GetSolutionsResult>;
enterRecaptchaSolutions: (solutions: CaptchaSolution[]) => Promise<EnterRecaptchaSolutionsResult>;
/** Attempt to detect and solve reCAPTCHAs on this page automatically. 🔮 */
solveRecaptchas: () => Promise<SolveRecaptchasResult>;
};
export declare type Page = Puppeteer.Page & RecaptchaPluginPageAdditions;
export interface SolutionProvider {

@@ -22,0 +23,0 @@ id?: string;

"use strict";
/// <reference path="./puppeteer-mods.d.ts" />
// Warn: The above is EXTREMELY important for our custom page mods to be recognized by the end users typescript!
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map
{
"name": "puppeteer-extra-plugin-recaptcha",
"version": "3.1.3",
"version": "3.1.4",
"description": "A puppeteer-extra plugin to solve reCAPTCHAs automatically.",

@@ -18,7 +18,8 @@ "main": "dist/index.cjs.js",

"tscheck": "tsc --pretty --noEmit",
"build": "yarn clean && tsc --module commonjs && rollup -c rollup.config.ts",
"build": "yarn clean && tsc --module commonjs && rollup -c rollup.config.ts && yarn copy-dts",
"docs": "exit 0",
"docs2": "rm -rf docs/* && typedoc --module commonjs --readme none --target ES6 --theme markdown --excludeNotExported --excludeExternals --excludePrivate --out docs --mode file src/index.ts",
"test": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava -v src/**.test.ts",
"test-ci": "yarn build && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava -v dist/*.test.js"
"test-ci": "yarn build && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ava -v dist/*.test.js",
"copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist"
},

@@ -51,13 +52,14 @@ "engines": {

"devDependencies": {
"@types/debug": "^4.1.0",
"@types/debug": "^4.1.5",
"@types/node": "^12.12.14",
"@types/puppeteer": "^2.0.0",
"ava": "2.4.0",
"copyfiles": "^2.1.1",
"puppeteer": "^2.0.0",
"puppeteer-extra": "^2.1.6",
"puppeteer-extra": "^3.1.4",
"ts-node": "^8.5.4",
"tslint": "^5.12.1",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-config-standard": "^9.0.0",
"typescript": "^3.3.3"
"typescript": "^3.7.2"
},

@@ -67,3 +69,3 @@ "dependencies": {

"debug": "^4.1.1",
"merge-deep": "^3.0.1",
"merge-deep": "^3.0.2",
"puppeteer-extra-plugin": "^3.1.2"

@@ -74,3 +76,3 @@ },

},
"gitHead": "9edf6f0e6b513520d50e3ceacc2d173eacd4adcd"
"gitHead": "c9970364e39cc68d2735bf25abd23169fb16a3ed"
}

@@ -23,2 +23,12 @@ # puppeteer-extra-plugin-recaptcha [![Build Status](https://travis-ci.org/berstend/puppeteer-extra.svg?branch=master)](https://travis-ci.org/berstend/puppeteer-extra) [![npm](https://img.shields.io/npm/v/puppeteer-extra-plugin-recaptcha.svg)](https://www.npmjs.com/package/puppeteer-extra-plugin-recaptcha)

<details>
<summary><strong>Changelog</strong></summary>
#### `3.1.4`
- Improved TypeScript experience: I found a way to make your TypeScript compiler automaticallly aware of the additions to the `Page` object (e.g. `page.solveRecaptchas()`).
- We now print a warning if the provider throws an error (e.g. invalid api key)
</details>
## Usage

@@ -39,3 +49,6 @@

RecaptchaPlugin({
provider: { id: '2captcha', token: 'XXXXXXX' },
provider: {
id: '2captcha',
token: 'XXXXXXX' // REPLACE THIS WITH YOUR OWN 2CAPTCHA API KEY ⚡
},
visualFeedback: true // colorize reCAPTCHAs (violet = detected, green = solved)

@@ -62,2 +75,45 @@ })

<details>
<summary><strong>TypeScript usage</strong></summary>
```ts
import puppeteer from 'puppeteer-extra'
import RecaptchaPlugin from 'puppeteer-extra-plugin-recaptcha'
puppeteer.use(
RecaptchaPlugin({
provider: {
id: '2captcha',
token: 'ENTER_YOUR_2CAPTCHA_API_KEY_HERE'
}
})
)
// Puppeteer usage as normal (headless is "false" just for this demo)
puppeteer.launch({ headless: false }).then(async browser => {
const page = await browser.newPage()
await page.goto('https://www.google.com/recaptcha/api2/demo')
// Even this page mod is fully type safe 🎉
await page.solveRecaptchas()
await Promise.all([
page.waitForNavigation(),
page.click(`#recaptcha-demo-submit`)
])
await page.screenshot({ path: 'response.png', fullPage: true })
await browser.close()
})
```
</details>
<br>
If you'd like to see debug output just run your script like so:
```bash
DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node myscript.js
```
_**Tip:** The recaptcha plugin works really well together with the [stealth plugin](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth)._

@@ -64,0 +120,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc