我使用 pyppeteer。但是当我访问https://ipleak.net时,它会检测到我的真实操作系统。我尝试加载这个 scrypt
async with aiofiles.open(os.path.join(BASEDIR, 'preload.js'), mode='r') as f:
preloadFile = await f.read()
# code for opening browser and page
# .......
await page.evaluateOnNewDocument(preloadFile)
preload.js
var fakePlatformGetter = function () {
return "Linux armv8l";
};
if (Object.defineProperty) {
Object.defineProperty(navigator, "platform", {
get: fakePlatformGetter
});
} else if (Object.prototype.__defineGetter__) {
navigator.__defineGetter__("platform", fakePlatformGetter);
}
但它不起作用。我能做些什么来隐藏我的真实操作系统?