Skip to content

LinuxUser255/url-sanitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

url-sanitizer

sanitize-your-youtube-links-scaled-image.jpg


url-sanitizer is a Rust command-line tool designed to process and sanitize URLs, removing unwanted parameters or formatting them for safe use. This tool is lightweight, fast, and built for reliability.

Features

  • Sanitizes URLs (e.g., removes tracking parameters or normalizes formats).
  • Fast execution with Rust's performance.
  • Portable, statically linked binary for easy distribution.

Prerequisites - be Sure to have musl-tools

To build and install url-sanitizer on a Debian system, ensure the following are installed:

  • Rust and Cargo: The Rust toolchain.
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source $HOME/.cargo/env
  • musl-tools: For static linking with the musl target.
    sudo apt update
    sudo apt install musl-tools
  • Git: To clone the repository (optional if you have the local codebase).
    sudo apt install git

Verify installations:

rustc --version && cargo --version && git --version

Building a Standalone Binary

Follow these steps to build a statically linked binary, which can run on any x86_64 Linux system without external library dependencies.

  1. Clone the repository:
 # http git clone
 git clone https://github.com/LinuxUser255/url-sanitizer.git

 cd url-sanitizer

  1. Add the musl Target:
    rustup target add x86_64-unknown-linux-musl

  1. Build the Static Binary: Compile in release mode for an optimized, standalone binary:
    cargo build --release --target x86_64-unknown-linux-musl
    The binary will be at target/x86_64-unknown-linux-musl/release/url-sanitizer.

  1. Verify Static Linking: Ensure the binary has no dynamic dependencies:
    ldd target/x86_64-unknown-linux-musl/release/url-sanitizer
    Expected output: statically linked or not a dynamic executable.

  1. Optional: Strip the Binary: Reduce binary size by removing debug symbols:
    strip target/x86_64-unknown-linux-musl/release/url-sanitizer

  1. Install Globally: Move the binary to /usr/local/bin for system-wide access:
    sudo mv target/x86_64-unknown-linux-musl/release/url-sanitizer /usr/local/bin/
    Verify it’s accessible:
    which url-sanitizer

  1. Test the Binary: Run the tool to ensure it works:
    url-sanitizer --help
    (Replace --help with appropriate arguments if your CLI requires them.)

Usage

~ url-sanitizer -h
Usage: url-sanitizer --url <URL>

Options:
  -u, --url <URL>
  -h, --help       Print help
  -V, --version    Print version

Example:

url-sanitizer --url https://youtu.be/gW464nWLdAs\?si\=TAZ3qCA1503uB__t
Sanitized URL: https://youtu.be/gW464nWLdAs

About

A CLI tool in Rust to sanitize your YouTube links. Removes user device tracking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages