0

我使用 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);
}

但它不起作用。我能做些什么来隐藏我的真实操作系统?

4

1 回答 1

0
client = await page.target.createCDPSession()
client.send('Network.setUserAgentOverride', {'userAgent': 'Mozilla/5.0 (Linux; Android 10; MI 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.96 Mobile Safari/537.36', 'platform': 'Linux armv8l'})
于 2020-06-28T11:20:25.747 回答