puppeteer-extra-plugin-recaptcha
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -24,2 +24,4 @@ import * as types from './types'; | ||
private getVisibleIframesIds; | ||
private getInvisibleIframesIds; | ||
private getIframesIds; | ||
private getResponseInputById; | ||
@@ -26,0 +28,0 @@ private getClientById; |
@@ -128,3 +128,3 @@ "use strict"; | ||
getVisibleIframesIds() { | ||
// Find all visible recaptcha boxes through their iframes | ||
// Find all regular visible recaptcha boxes through their iframes | ||
return this._findVisibleIframeNodes() | ||
@@ -139,2 +139,21 @@ .filter(($f) => this._isVisible($f)) | ||
} | ||
getInvisibleIframesIds() { | ||
// Find all invisible recaptcha boxes through their iframes (only the ones with an active challenge window) | ||
return this._findVisibleIframeNodes() | ||
.filter(($f) => $f && $f.getAttribute('name')) | ||
.map(($f) => $f.getAttribute('name') || '') // a-841543e13666 | ||
.map((rawId) => rawId.split('-').slice(-1)[0] // a-841543e13666 => 841543e13666 | ||
) | ||
.filter((id) => id) | ||
.filter((id) => document.querySelectorAll(`iframe[src^='https://www.google.com/recaptcha/api2/bframe'][name^="c-${id || ''}"]`).length); | ||
} | ||
getIframesIds() { | ||
// Find all recaptcha boxes through their iframes, check for invisible ones as fallback | ||
const results = [ | ||
...this.getVisibleIframesIds(), | ||
...this.getInvisibleIframesIds(), | ||
]; | ||
// Deduplicate results by using the unique id as key | ||
return [...new Map(results.map((x) => [x.id, x])).values()]; | ||
} | ||
getResponseInputById(id) { | ||
@@ -206,3 +225,3 @@ if (!id) | ||
return result; | ||
result.captchas = this.getVisibleIframesIds() | ||
result.captchas = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -242,3 +261,3 @@ .map((client) => this.extractInfoFromClient(client)) | ||
} | ||
result.solved = this.getVisibleIframesIds() | ||
result.solved = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -245,0 +264,0 @@ .map((client) => { |
/*! | ||
* puppeteer-extra-plugin-recaptcha v3.1.19 by berstend | ||
* puppeteer-extra-plugin-recaptcha v3.2.0 by berstend | ||
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-recaptcha | ||
@@ -139,3 +139,3 @@ * @license MIT | ||
getVisibleIframesIds() { | ||
// Find all visible recaptcha boxes through their iframes | ||
// Find all regular visible recaptcha boxes through their iframes | ||
return this._findVisibleIframeNodes() | ||
@@ -150,2 +150,21 @@ .filter(($f) => this._isVisible($f)) | ||
} | ||
getInvisibleIframesIds() { | ||
// Find all invisible recaptcha boxes through their iframes (only the ones with an active challenge window) | ||
return this._findVisibleIframeNodes() | ||
.filter(($f) => $f && $f.getAttribute('name')) | ||
.map(($f) => $f.getAttribute('name') || '') // a-841543e13666 | ||
.map((rawId) => rawId.split('-').slice(-1)[0] // a-841543e13666 => 841543e13666 | ||
) | ||
.filter((id) => id) | ||
.filter((id) => document.querySelectorAll(`iframe[src^='https://www.google.com/recaptcha/api2/bframe'][name^="c-${id || ''}"]`).length); | ||
} | ||
getIframesIds() { | ||
// Find all recaptcha boxes through their iframes, check for invisible ones as fallback | ||
const results = [ | ||
...this.getVisibleIframesIds(), | ||
...this.getInvisibleIframesIds(), | ||
]; | ||
// Deduplicate results by using the unique id as key | ||
return [...new Map(results.map((x) => [x.id, x])).values()]; | ||
} | ||
getResponseInputById(id) { | ||
@@ -217,3 +236,3 @@ if (!id) | ||
return result; | ||
result.captchas = this.getVisibleIframesIds() | ||
result.captchas = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -253,3 +272,3 @@ .map((client) => this.extractInfoFromClient(client)) | ||
} | ||
result.solved = this.getVisibleIframesIds() | ||
result.solved = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -256,0 +275,0 @@ .map((client) => { |
/*! | ||
* puppeteer-extra-plugin-recaptcha v3.1.19 by berstend | ||
* puppeteer-extra-plugin-recaptcha v3.2.0 by berstend | ||
* https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-recaptcha | ||
@@ -133,3 +133,3 @@ * @license MIT | ||
getVisibleIframesIds() { | ||
// Find all visible recaptcha boxes through their iframes | ||
// Find all regular visible recaptcha boxes through their iframes | ||
return this._findVisibleIframeNodes() | ||
@@ -144,2 +144,21 @@ .filter(($f) => this._isVisible($f)) | ||
} | ||
getInvisibleIframesIds() { | ||
// Find all invisible recaptcha boxes through their iframes (only the ones with an active challenge window) | ||
return this._findVisibleIframeNodes() | ||
.filter(($f) => $f && $f.getAttribute('name')) | ||
.map(($f) => $f.getAttribute('name') || '') // a-841543e13666 | ||
.map((rawId) => rawId.split('-').slice(-1)[0] // a-841543e13666 => 841543e13666 | ||
) | ||
.filter((id) => id) | ||
.filter((id) => document.querySelectorAll(`iframe[src^='https://www.google.com/recaptcha/api2/bframe'][name^="c-${id || ''}"]`).length); | ||
} | ||
getIframesIds() { | ||
// Find all recaptcha boxes through their iframes, check for invisible ones as fallback | ||
const results = [ | ||
...this.getVisibleIframesIds(), | ||
...this.getInvisibleIframesIds(), | ||
]; | ||
// Deduplicate results by using the unique id as key | ||
return [...new Map(results.map((x) => [x.id, x])).values()]; | ||
} | ||
getResponseInputById(id) { | ||
@@ -211,3 +230,3 @@ if (!id) | ||
return result; | ||
result.captchas = this.getVisibleIframesIds() | ||
result.captchas = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -247,3 +266,3 @@ .map((client) => this.extractInfoFromClient(client)) | ||
} | ||
result.solved = this.getVisibleIframesIds() | ||
result.solved = this.getIframesIds() | ||
.map((id) => this.getClientById(id)) | ||
@@ -250,0 +269,0 @@ .map((client) => { |
@@ -34,3 +34,19 @@ "use strict"; | ||
}); | ||
ava_1.default('will not throw when no captchas are found', async (t) => { | ||
const puppeteer = puppeteer_extra_1.addExtra(require('puppeteer')); | ||
const recaptchaPlugin = index_1.default(); | ||
puppeteer.use(recaptchaPlugin); | ||
const browser = await puppeteer.launch({ | ||
args: PUPPETEER_ARGS, | ||
headless: true, | ||
}); | ||
const page = await browser.newPage(); | ||
const url = 'https://www.example.com'; | ||
await page.goto(url, { waitUntil: 'networkidle0' }); | ||
const { captchas, error } = await page.findRecaptchas(); | ||
t.is(error, null); | ||
t.is(captchas.length, 0); | ||
await browser.close(); | ||
}); | ||
// TODO: test/mock the rest | ||
//# sourceMappingURL=index.test.js.map |
{ | ||
"name": "puppeteer-extra-plugin-recaptcha", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A puppeteer-extra plugin to solve reCAPTCHAs automatically.", | ||
@@ -73,3 +73,3 @@ "main": "dist/index.cjs.js", | ||
}, | ||
"gitHead": "08b00f7c59c28f3fed379ded93d1391f68e1489d" | ||
"gitHead": "caba9458527f44f181819d69dcce37ac40efe521" | ||
} |
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
245906
2593