Bringing the power of the ClearURLs rules to Rust. Easily remove tracking parameters and other nuisance from URLs with a simple API:
use clearurls::UrlCleaner;
fn main() -> Result<(), clearurls::Error> {
let cleaner = UrlCleaner::from_embedded_rules()?;
let res = cleaner.clear_url("https://example.com/test?utm_source=abc")?;
assert_eq!(res, "https://example.com/test");
Ok(())
}
There is a std
feature (enabled by default) to include utility functions to read from files,
but the core logic doesn't depend on that and the crate is perfectly usable without std
.
data.minify.json
was downloaded from https://github.com/ClearURLs/Rules
data.minify.json file is from https://github.com/ClearURLs/Rules Testcases are from