Git Product home page Git Product logo

clearurls's Introduction

clearurls

GitHub Actions Workflow Status Crate Docs

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(())
}

Crate Features

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.

Acknowledgements

data.minify.json was downloaded from https://github.com/ClearURLs/Rules

License

data.minify.json file is from https://github.com/ClearURLs/Rules Testcases are from

clearurls's People

Contributors

jendrikw avatar dullbananas avatar

Stargazers

Dessalines avatar

Watchers

 avatar

clearurls's Issues

Allow strings (not just urls) as input, and remove tracking params on all given links.

It'd be hugely helpful to either add, or alter the existing function to be fn clear_urls(input: &str), and step through any number of urls, while ignoring other text.

IE say there's a comment with multiple links, and some other text:

test(
  "This is a [markdown link](http://example.com/?&&&&), and another: http://example.com/?&&&&",
  "This is a [markdown link](http://example.com/), and another http://example.com/",
);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.