FastPSL is a high-performance domain parser for Python, implemented in Rust and exposed via [PyO3]. It extracts a URL’s subdomain, registered domain, and public suffix in full compliance with the Public Suffix List (PSL).
On first use, the PSL data is automatically downloaded and cached in a cross-platform location (public_suffix_list.dat). No manual setup required.
Benchmarked against tldextract, FastPSL is approximately 4× faster under typical workloads. See test/benchmark.py for details.
pip install fastpsl>>> import fastpsl
>>> fastpsl.extract("api.example.com")
ExtractResult(subdomain='api', domain='example', suffix='com', is_private=false)
>>> fastpsl.extract("https://sub.domain.example.com:8000/path?query=123")
ExtractResult(subdomain='sub.domain', domain='example', suffix='com', is_private=false)This project is actively being developed, and all forms of participation are welcome.
MIT License