Clean URLs

Remove needless parameters from a given URL and correct it to a cleaner one.

About

This script was started as a proof of concept of utilizing the URL API instead of RegEx.

To add a new hash or parameter, simply add it to the respective array.

Enjoy graceful sharing!

Legend and visual examples

  • Discovered URL (l)

    URL found within a parameter

  • Pure link (w)

    URL without parameters (mere pathname)

  • Safe link (g)

    URL with whitelisted parameters

  • Semi-safe link (y)

    URL purged by blacklist

  • Unsafe link (r)

    Original URL (useful in rare cases)

        orderBy orderDir src ref version source url Custom   Visual Example
Link №1 ✓       ✓        ✓   ✓   ✕       ✕      ✕   ✕         (l)(w)(g)(r)
Link №2 ✓       ✓        ✕   ✕   ✓       ✕      ✕   ✕         None
Link №3 ✓       ✓        ✕   ✓   ✓       ✕      ✕   ✕         (w)(g)(r)
Link №4 ✓       ✓        ✕   ✓   ✓       ✓      ✓   /ref=     (l)(l)(w)(g)(y)(r)
Link №5 ✓       ✓        ✓   ✕   ✓       ✕      ✕   465933    (l)(w)(g)(y)(r)
Link №6 ✓       ✓        ✕   ✕   ✓       ✕      ✓   ✕         (l)(w)(g)(y)
Link №7 ✕       ✕        ✕   ✓   ✕       ✕      ✕   slackware (l)(w)(r)
Link №8 ✕       ✕        ✕   ✕   ✕       ✓      ✕             (l)(w)(y)

Resources