fakebrowser
Version:
🤖 Fake fingerprints to bypass anti-bot systems. Simulate mouse and keyboard operations to make behavior like a real person.
34 lines (27 loc) • 844 B
JavaScript
;
const {PuppeteerExtraPlugin} = require('puppeteer-extra-plugin');
const withUtils = require('../_utils/withUtils');
class Plugin extends PuppeteerExtraPlugin {
constructor(opts = {}) {
super(opts);
}
get name() {
return 'evasions/window.history.length';
}
async onPageCreated(page) {
await withUtils(this, page).evaluateOnNewDocument(
(utils, historyLength) => {
for (let n = 0; n < historyLength; ++n) {
if (window.history.length >= historyLength) {
break;
}
window.history.pushState(null, '');
}
},
this.opts.historyLength,
);
}
}
module.exports = function (pluginConfig) {
return new Plugin(pluginConfig);
};