Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/f321x/untrack-rs
Rust crate to parse and remove tracking tokens from URLs contained in arbitrary text input
https://github.com/f321x/untrack-rs
advertising crate links nostr parsing privacy rust tracking urls
Last synced: about 3 hours ago
JSON representation
Rust crate to parse and remove tracking tokens from URLs contained in arbitrary text input
- Host: GitHub
- URL: https://github.com/f321x/untrack-rs
- Owner: f321x
- License: mit
- Created: 2024-07-23T15:23:29.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T11:43:18.000Z (4 months ago)
- Last Synced: 2024-10-06T06:53:35.043Z (about 1 month ago)
- Topics: advertising, crate, links, nostr, parsing, privacy, rust, tracking, urls
- Language: Rust
- Homepage: https://crates.io/crates/untrack
- Size: 12.5 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# untrack crate
This crate is intended to remove tracking tokens from URLs contained in any text input. The crate can either substitute the URLs in place or return a Vec of cleaned urls to a given text input.## Usecase
Removing tracking tokens can improve the privacy of the user sharing the link containing the tokens and the consumer opening the shared link.## Supported tracking tokens
The crate currently supports Twitter, X, YouTube, Instagram, Substack and Spotify tracking tokens. The exact tokens can be found in ```src/parsing_params.rs```.## Example usage
### fn clean_urls_from_any_text(input: &String) -> Option>
```
let input =
String::from("Twitter link: https://twitter.com/user/status/123?utm_source=test&s=1234");let expected = vec!["https://twitter.com/user/status/123".to_string()];
assert_eq!(clean_urls_from_any_text(&input), Some(expected));
```### fn replace_urls_in_place(input: &mut String) -> Option<&mut String>
```
let mut input = String::from("Multiple URLs: https://twitter.com/user/status/123?s=12 and https://www.youtube.com/watch?v=abc&feature=share");let result = replace_urls_in_place(&mut input);
assert!(result.is_some());
assert_eq!(input, "Multiple URLs: https://twitter.com/user/status/123 and https://www.youtube.com/watch?v=abc");
```