Update client.ImpersonateXXX methods #407
Merged
+11
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit fb51d5b changed the
client.ImpersonateXXX
methods to always use the latest TLS fingerprint provided by uTLS for the relevant browser (utls.HelloXXX_Auto
). Unfortunately this creates a mismatch between the TLS fingerprint and the other browser settings (such asUser-Agent
headers) since the latter are not changed automatically with every uTLS version upgrade. It's quite easy for bot detection tools to detect this mismatch, with a pretty low chance of false positives. I suggest sticking with fixed version TLS fingerprints instead and manually updating theuTLS.ClientHelloId
alongside other browser settings whenever new uTLS fingerprints become available.I've used Chrome 120, Firefox 120 and Safari 16.6 on a fresh MacOS 13 installation to check for relevant
commonHeaders
changes. My findings are:User-Agent
doesn't appear to change on minor version upgrades (e.g. 16 -> 16.6). Likely no changes necessary except on major version upgrades.User-Agent
changed, all other headers remained unchanged.User-Agent
,Sec-CH-UA
andAccept
headers changed when comparing v113 to v120.Sec-CH-UA
header needs to be manually checked every time a new Chrome version is used.Going forward, I believe it makes sense to manually check all three browser for header changes every time a new browser version is used.
I've also noticed that
client.ImpersonateChrome()
had a rather uncommonAccept-Language
header value of"zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7,it;q=0.6"
(i.e. Chinese, English, Italian). To minimize fingerprinting opportunities, I suggest sticking with theAccept-Language
value used on a fresh browser install when the system language is set toChinese (Simplified)
. For Chrome 120, that'szh-CN,zh;q=0.9
.