I’m trying to make my scraper stealthy.
The last hurdle for me is the browser language, in fact I can’t modify it no matter what the parameters are.
screenshot of the browserscan.net
I can modify the HTTP header for the language, but not the browser language, I searched in the system files of the playwirght browser but there is no parameter for that.
Here is a minimal part of my code :
const { firefox } = require('playwright-extra');
const stealth = require('puppeteer-extra-plugin-stealth')();
firefox.use(stealth);
firefox.launch({
headless: false,
args: ['--lang=fr-FR'],
}).then(async browser => {
const context = await browser.newContext({
locale: 'fr-FR',
timezoneId: 'Europe/Paris',
geolocation: { latitude: 48.8566, longitude: 2.3522 },
});
const page = await context.newPage();
await page.setExtraHTTPHeaders({
'Accept-Language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7',
});
console.log('Navigating to test browser language settings...');
const url = 'https://www.browserscan.net/';
await page.goto(url, { waitUntil: 'networkidle0' });
await page.screenshot({ path: 'browser-language.png', fullPage: true });
console.log('Done! Check browser-language.png for results.');
await browser.close();
})
Does anyone have a clue?