Open no1robino opened 1 year ago
There has a pip module could solve this only when you are using native webdriver, because uc has overwrite agent action(only del the headless tag, not hide others), so if your direct use the module it will not work, but I had fixed and banded them together and pull request to uc owner.
If the owner accepted my request, you just could use uc totally hide your real agent.
I had tested by your https://whatsmyos.com/ through my pull version code and it worked fine.
This is the pull request details: https://github.com/ultrafunkamsterdam/undetected-chromedriver/pull/1053
Uc is a good base open source project, maybe in the few days I will created a derivative open source with my div version base uc, then also upload it to the pypi.org be a install module.
Hi, I would like to run undetected-chromedriver on Linux, but I want it to appear as though I'm using Windows 10 or 11, because it's a more common/generic OS. Is there any way of doing this? https://whatsmyos.com/ Thanks
You can't completely fake it. Some bot detectors can retrieve your real OS in other ways than the UA and they can see the mismatch. Maybe the websites you are visiting doesn't use those detection methods but it's not a good thing adding a random useragent option to this project. This should be personal, so you can just scrape some useragents (maybe selecting the most used, filtering them by Windows and desktop UA), otherwise you can use some libraries that have already collected those data.
Thanks. Yeah, I had a feeling that would be the case. I think that the websites I'm using don't have such advanced bot detection methods, but they may record the OS that you used to log in with for example. How would I go about changing the user agent/platform in undetected chromedriver to pass a basic test such as this one - https://whatsmyos.com/? Or would I have to use the standard selenium library?
Thanks. Yeah, I had a feeling that would be the case. I think that the websites I'm using don't have such advanced bot detection methods, but they may record the OS that you used to log in with for example. How would I go about changing the user agent/platform in undetected chromedriver to pass a basic test such as this one - https://whatsmyos.com/? Or would I have to use the standard selenium library?
You can see what @stevenhubhub did here: https://github.com/ultrafunkamsterdam/undetected-chromedriver/pull/1053/files
Instead of modifying directly UC you should just:
Here is an example:
from undetected_chromedriver import Chrome, ChromeOptions
from fake_useragent import UserAgent
useragent = UserAgent().random
options = ChromeOptions()
options.add_argument(f"--user-agent={useragent}")
browser = Chrome(options=options)
cmd_args = {"userAgent": useragent}
browser.execute_cdp_cmd(cmd="Emulation.setUserAgentOverride", cmd_args=cmd_args)
browser.execute_cdp_cmd(cmd="Network.setUserAgentOverride", cmd_args=cmd_args)
Remember that UA strings are old and will be removed soon. Chromium based browsers and websites have already started using Client Hints.
@ultrafunkamsterdam I think this issue and the relative PR can be closed.
Only overwriting the useragent will likely make you detected because of inconsistencies with some Objects of Navigator.
Maybe Selenium-Profiles helps you. Fonts fingerprinting still won't pass tho
Hi, I would like to run undetected-chromedriver on Linux, but I want it to appear as though I'm using Windows 10 or 11, because it's a more common/generic OS. Is there any way of doing this? https://whatsmyos.com/ Thanks