puppeteer-afp
Advanced tools
Comparing version 1.1.1 to 1.1.3
{ | ||
"name": "puppeteer-afp", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"description": "Stop website fingerprinting techniques", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,3 @@ # puppeteer-afp | ||
This covers: | ||
Canvas Fingerprinting | ||
WebGL Fingerprinting | ||
AudioContext Fingerprinting | ||
Font Fingerprinting | ||
Canvas Fingerprinting, WebGL Fingerprinting, AudioContext Fingerprinting, Font Fingerprinting | ||
@@ -22,3 +19,6 @@ ## Installation | ||
const puppeteer = require('puppeteer'); | ||
const puppeteerAfp = require('puppeteer-afp'); | ||
const { | ||
protectPage, | ||
protectedBrowser, | ||
} = require('puppeteer-afp'); | ||
@@ -28,3 +28,4 @@ const browser = await puppeteer.launch(); | ||
const pageToProtect = (await browser.pages())[0]; | ||
// For these options, all are optional, and you dont have to use them, these are used just if you want to reuse a fingerprint | ||
// For these options, all are optional, and you dont have to use them, | ||
// these are used just if you want to reuse a fingerprint | ||
const options = { | ||
@@ -74,5 +75,12 @@ canvasRgba: [0, 0, 0, 0], //all these numbers can be from -5 to 5 | ||
}; | ||
// run this function on any page you want to protect, so pages loaded on this page after this is done will be protected | ||
await puppeteerAfp(pageToProtect, options); | ||
// run this function on any page you want to protect, so pages loaded on | ||
// this page after this is done will be protected | ||
await protectPage(pageToProtect, options); | ||
//Another way of using it is to protect automatically a new tab, | ||
//and if you want the fingerprint to change, just remove the options parameter: | ||
const protectedChromium = await protectedBrowser(browser, options); | ||
//and then we use the following command: | ||
const protectedPage = protectedChromium.newProtectedPage() | ||
``` | ||
@@ -79,0 +87,0 @@ |
@@ -7,3 +7,3 @@ 'use strict'; | ||
*/ | ||
module.exports = function (page, options = {}) { | ||
const protectPage = (page, options = {}) => { | ||
@@ -317,2 +317,17 @@ page.evaluateOnNewDocument( | ||
return page; | ||
}; | ||
const protectedBrowser = async (browser, options = {}) => { | ||
const protectedBrowser = browser; | ||
protectedBrowser.newProtectedPage = async () => { | ||
const page = await browser.newPage(); | ||
await protectPage(page, options); | ||
return page; | ||
}; | ||
return protectedBrowser; | ||
}; | ||
module.exports = { | ||
protectPage, | ||
protectedBrowser, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28739
287
94