Hi @vladkens first off, thanks for maintaining this library. It’s a super useful tool and I think it could be made even more resilient against Twitter’s anti-bot protections with a few enhancements
Suggested Improvements
-
TLS Fingerprint Spoofing via httpx-curl-cffi
- Twitter (relies on Cloudflare) relies heavily on TLS fingerprint checks (JA3, SNI patterns, etc.) for bot detection
httpx-curl-cffi (https://github.com/vgavro/httpx-curl-cffi) provides a drop-in transport for httpx with cURL-level TLS fingerprint spoofing
- Replacing the default
httpx transport with this would make requests look much closer to a real browser session
-
HTTP/2 and HTTP/3 Support
- Twitter endpoints seem to default to HTTP/2 (and in some cases HTTP/3)
- Currently
twscrape requests appear to be forced through HTTP/1.1, which is a detectable
- Upgrading to use h2/h3 via the transport layer (e.g. with
httpx-curl-cffi or hyper/h3 libraries) would improve stealth and performance
-
Account Unlocking Flow
- Many accounts fail to provide a
ct0 cookie simply because they’re in a "locked" state
- With Cloudflare checks bypassed via
httpx-curl-cffi, it should be possible to implement the same flow browsers do to “unlock” accounts (completing the initial challenge)
Hi @vladkens first off, thanks for maintaining this library. It’s a super useful tool and I think it could be made even more resilient against Twitter’s anti-bot protections with a few enhancements
Suggested Improvements
TLS Fingerprint Spoofing via
httpx-curl-cffihttpx-curl-cffi(https://github.com/vgavro/httpx-curl-cffi) provides a drop-in transport forhttpxwith cURL-level TLS fingerprint spoofinghttpxtransport with this would make requests look much closer to a real browser sessionHTTP/2 and HTTP/3 Support
twscraperequests appear to be forced through HTTP/1.1, which is a detectablehttpx-curl-cffior hyper/h3 libraries) would improve stealth and performanceAccount Unlocking Flow
ct0cookie simply because they’re in a "locked" statehttpx-curl-cffi, it should be possible to implement the same flow browsers do to “unlock” accounts (completing the initial challenge)