hrequests icon indicating copy to clipboard operation
hrequests copied to clipboard

Browser version selection not showing in request Header

Open VCoves opened this issue 1 year ago • 2 comments

How to reproduce issue: session = hrequests.Session(browser='chrome', version=112) resp = session.get("https://httpbin.org/headers") print(resp.json()) It will show a different version in Chrome/114.0.5731.1, Instead of expected Chrome/112.X.X.X

VCoves avatar Nov 13 '23 10:11 VCoves

Also tried it and can confirm it doesn't respect the version setting.

rhoekman avatar Nov 24 '23 18:11 rhoekman

Hello, this was a decision I chose to make a while back. I explained it a little here.

At the moment, the version parameter only sets the TLS fingerprint version, not the header. Due to there being much more User-Agents than TLS finerprints avaliable, I needed to cut down a lot of potential unique headers to make the user agents match their TLS finerprint version. Websites rarely compare the User-Agent to the browser's TLS fingerprint, so I didn't think the sacrifice of potential User-Agents was worth it, especially for larger scale scraping where requests need to look as unique as possible.

However, I could definitely make Chrome's User-Agent adhere to its TLS profile since there are so many different versions for each major release. But I can't for Firefox since it does not have many potential User-Agents per release. I'm not sure though, I'll need some more thoughts on this

daijro avatar Feb 04 '24 12:02 daijro