Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set locale (Avoiding BrowserScan language mismatch) #16

Closed
satanmp opened this issue Sep 23, 2024 · 6 comments
Closed

How to set locale (Avoiding BrowserScan language mismatch) #16

satanmp opened this issue Sep 23, 2024 · 6 comments

Comments

@satanmp
Copy link

satanmp commented Sep 23, 2024

I have set language, languages, and screen, but I still can’t pass the test.can you help me? thanks
code:
config["navigator.language"] = 'zh-CN'
config["navigator.languages"] = ['zh-CN', 'zh', 'zh-TW', 'zh-HK', 'en-US', 'en']
config["headers.User-Agent"] = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0'
config["headers.Accept-Language"] = "zh-CN,zh;q=0.9"
config["headers.Accept-Encoding"] = "gzip, deflate, br"
config["screen.height"] = 900
config["screen.width"] = 1440
image

@daijro
Copy link
Owner

daijro commented Sep 23, 2024

Hello, to set your browser locale, set the intl.accept_languages preference to zh-CN, zh:

from camoufox.sync_api import Camoufox

with Camoufox(firefox_user_prefs={"intl.accept_languages": "zh-CN, zh"}) as browser:
    page = browser.new_page()
    page.goto("https://www.browserscan.net/")

@daijro daijro changed the title cannot pass browserscan.net How to set locale Sep 23, 2024
@daijro daijro changed the title How to set locale How to set locale (Avoiding BrowserScan language mismatch) Sep 23, 2024
@daijro daijro closed this as completed Sep 23, 2024
@daijro
Copy link
Owner

daijro commented Sep 23, 2024

Sorry if it was difficult to find, I'll add a parameter to the Python interface to make it easier to set all the locale properties.

@satanmp
Copy link
Author

satanmp commented Sep 23, 2024

Sorry if it was difficult to find, I'll add a parameter to the Python interface to make it easier to set all the locale properties.

There is no documentation, it is really not easy to set up, thank you

@daijro daijro reopened this Sep 23, 2024
@daijro
Copy link
Owner

daijro commented Sep 23, 2024

Reopening because there seems to sometimes be a mismatch between the system locale & browser locale.

To anyone looking through this issue, the solution I shared above works temporarily if your system is using the same locale as the one you're setting to intl.accept_languages, but it will leak if your system locale is different.

This is a simple fix and should be out in beta.8 by tomorrow.

Update:

System locale spoofing has been added in my local changes, but I'm having some issues with Intl api leaks. Going to be taking a break for 2 days to study for midterms.

@tobwen
Copy link

tobwen commented Sep 24, 2024

Going to be taking a break for 2 days to study for midterms.

I wish you all the best for this.

daijro added a commit that referenced this issue Sep 28, 2024
Spoof the Intl API, headers, and system locale values.
Added the following properties:
- locale:language
- locale:region
- locale:script
daijro added a commit that referenced this issue Sep 29, 2024
- Added `geoip` parameter to automatically find the target IP's longitude, latitude, timezone, country, language/region locale, & spoof the WebRTC IP address. #5
- Added parameter to set the locale #16
- Automatically calculate the locale based on the distribution of speakers in the target geoip region.
- Added allow_webgl option #17
- By default, use the current version of Camoufox instead of Browserforge's Firefox versions #14.
@daijro
Copy link
Owner

daijro commented Sep 29, 2024

Hello,

Locale spoofing has been added in v130.0.1-beta.8, and the latest Python library update 👍

@daijro daijro closed this as completed Sep 29, 2024
daijro added a commit that referenced this issue Sep 29, 2024
- Added `geoip` parameter to automatically find the target IP's longitude, latitude, timezone, country, language/region locale, & spoof the WebRTC IP address. #5
- Added parameter to set the locale #16
- Automatically calculate the locale based on the distribution of speakers in the target geoip region.
- Added allow_webgl option #17
- By default, use the current version of Camoufox instead of Browserforge's Firefox versions #14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants