Created
August 14, 2024 17:02
-
-
Save s3rgeym/73c6a04a7bf6afdffe8eff93f2012163 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def generate_chrome_useragent() -> str: | |
webkit_version = random.uniform(520.0, 537.36) | |
chrome_version = random.randint(110_000_000_000, 127_000_000_000) | |
platform = random.choice( | |
[ | |
"Windows NT 10.0; Win64; x64", | |
"Macintosh; Intel Mac OS X 10_15_7", | |
"X11; Linux x86_64", | |
] | |
) | |
return ( | |
f"Mozilla/5.0 ({platform}) AppleWebKit/{webkit_version:.2f} " | |
f"(KHTML, like Gecko) Chrome/{chrome_version // 1_000_000_000}." | |
f"{chrome_version // 1_000_000 % 1000}." | |
f"{chrome_version // 1_000 % 1000}." | |
f"{chrome_version % 1000} Safari/{webkit_version:.2f}" | |
) | |
if __name__ == "__main__": | |
print(generate_chrome_useragent()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment