初识指纹
遇到一个网站,忽然发现无论如何如何更换UA和代理请求都是403
curl_cffi 可模拟真实浏览器的 TLS | JA3 指纹。
支持JA3/TLS和http2指纹模拟;
比requests/tls_client快分开,和aiohttp/pycurl的速度比肩。
1. 安装库命令
pip install curl_cffi
2. 使用示例
from curl_cffi import requests
# Notice the impersonate parameter
r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome110")
print(r.json())
# output: {..., "ja3n_hash": "aa56c057ad164ec4fdcb7a5a283be9fc", ...}
# the js3n fingerprint should be the same as target browser
# http/socks proxies are supported
proxies = {"https": "http://localhost:3128"}
r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome110", proxies=proxies)
proxies = {"https": "socks://localhost:3128"}
r = requests.get("https://tls.browserleaks.com/json", impersonate="chrome110", proxies=proxies)
# 注意这个 impersonate 参数,指定了模拟哪个浏览器
curl_cffi 项目地址: https://github.com/yifeikong/curl_cffi
公众号:笔记分享社