Open Pic2490 opened 8 months ago
Not sure this is still maintained given no updates for a long time. You can manually change it.
find the file ...\node_modules\puppeteer-extra-plugin-stealth\evasions\webgl.vendor\index.js and modify it as you wish
// UNMASKED_VENDOR_WEBGL if (param === 37445) { return opts.vendor || 'Google Inc. (NVIDIA)' // default in headless: Google Inc. } // UNMASKED_RENDERER_WEBGL if (param === 37446) { return opts.renderer || 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2080 TI Direct3D11 vs_5_0 ps_5_0, D3D11-27.21.14.6079)' // default in headless: Google SwiftShader }
Not sure this is still maintained given no updates for a long time. You can manually change it.
find the file ...\node_modules\puppeteer-extra-plugin-stealth\evasions\webgl.vendor\index.js and modify it as you wish
// UNMASKED_VENDOR_WEBGL if (param === 37445) { return opts.vendor || 'Google Inc. (NVIDIA)' // default in headless: Google Inc. } // UNMASKED_RENDERER_WEBGL if (param === 37446) { return opts.renderer || 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2080 TI Direct3D11 vs_5_0 ps_5_0, D3D11-27.21.14.6079)' // default in headless: Google SwiftShader }
Appreciate the swift response, I'm aware of changing it manually but do you know if there's a way to change it programmatically?
Not sure this is still maintained given no updates for a long time. You can manually change it. find the file ...\node_modules\puppeteer-extra-plugin-stealth\evasions\webgl.vendor\index.js and modify it as you wish // UNMASKED_VENDOR_WEBGL if (param === 37445) { return opts.vendor || 'Google Inc. (NVIDIA)' // default in headless: Google Inc. } // UNMASKED_RENDERER_WEBGL if (param === 37446) { return opts.renderer || 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2080 TI Direct3D11 vs_5_0 ps_5_0, D3D11-27.21.14.6079)' // default in headless: Google SwiftShader }
Appreciate the swift response, I'm aware of changing it manually but do you know if there's a way to change it programmatically?
Looking at the codes, I do not think there is such function
You can pass in opts
if you new up the plugin yourself - I was able to do the following:
import pxe from "playwright-extra";
import stealth from "puppeteer-extra-plugin-stealth";
import WebGlVendorPlugin from "puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js";
pxe.chromium.use(stealth({
"enabledEvasions": new Set([
// all from https://github.com/berstend/puppeteer-extra/blob/master/packages/puppeteer-extra-plugin-stealth/index.js#L82
"chrome.app",
"chrome.csi",
"chrome.loadTimes",
"chrome.runtime",
"defaultArgs",
"iframe.contentWindow",
"media.codecs",
"navigator.hardwareConcurrency",
"navigator.languages",
"navigator.permissions",
"navigator.plugins",
"navigator.webdriver",
"sourceurl",
"user-agent-override",
// "webgl.vendor",
"window.outerdimensions"
])
})).use(new WebGlVendorPlugin({
vendor: "please no more captchas",
renderer: "i'm begging you"
}));
@fxyoge Can we do it using Puppeteer only or how can we do it manually
It certainly possibile, try something like this, of course it could be simpler.
const StealthPlugin = PuppeteerStealth(); StealthPlugin.enabledEvasions.delete('webgl.vendor'); let customGpu = require('puppeteer-extra-plugin-stealth/evasions/webgl.vendor')({ vendor: gpu.vendor, renderer: gpu.renderer }) Puppeteer.use(customGpu);
const StealthPlugin = PuppeteerStealth(); StealthPlugin.enabledEvasions.delete('webgl.vendor'); let customGpu = require('puppeteer-extra-plugin-stealth/evasions/webgl.vendor')({ vendor: gpu.vendor, renderer: gpu.renderer }) Puppeteer.use(customGpu);
Does it even work at all?
const StealthPlugin = PuppeteerStealth(); StealthPlugin.enabledEvasions.delete('webgl.vendor'); let customGpu = require('puppeteer-extra-plugin-stealth/evasions/webgl.vendor')({ vendor: gpu.vendor, renderer: gpu.renderer }) Puppeteer.use(customGpu);
I'm checking it out on https://browserleaks.com/webgl
And I see the values of vendor and renderer have NOT changed in any way
I'm checking it out on https://browserleaks.com/webgl
Below is a method that works fine for me
await page.evaluateOnNewDocument(() => { WebGLRenderingContext.prototype.getParameter = function(origFn) { const paramMap = {}; paramMap[0x9245] = "ARM"; // UNMASKED_VENDOR_WEBGL paramMap[0x9246] = "Mali-G71"; // UNMASKED_RENDERER_WEBGL return function(parameter) { return paramMap[parameter] || origFn.call(this, parameter); }; }(WebGLRenderingContext.prototype.getParameter); WebGL2RenderingContext.prototype.getParameter = function(origFn) { const paramMap = {}; paramMap[0x9245] = "ARM"; // UNMASKED_VENDOR_WEBGL paramMap[0x9246] = "Mali-G71"; // UNMASKED_RENDERER_WEBGL return function(parameter) { return paramMap[parameter] || origFn.call(this, parameter); }; }(WebGL2RenderingContext.prototype.getParameter); });
^ This is easily detectable
WebGLRenderingContext.prototype.getParameter.toString()
^ This is easily detectable
WebGLRenderingContext.prototype.getParameter.toString()
Well what solution can you offer to solve it?
^ This is easily detectable
WebGLRenderingContext.prototype.getParameter.toString()
Well what solution can you offer to solve it?
No mind the guy joor. your solution was perfect. any suggestions for broken Image dimension ?
Feature request I think it would be essential if someone could change out the hardcoded values in WebGl Renderer and Vendor like the way one can .setUserAgent() on Start Up