Small tools: Command line script to shorten URLs using tinyurl
You know what sucks about URLs? They are too damn long nowadays, even the ones on this very blog. Why does this suck? For various reason.
- They might contain characters which are considered to be special, such as parentheses.
- They are longer so that they don’t fit in your posting, be it an SMS or on IRC
- They make my eyes bleed.
I needed a small shell script which accepts a longish URL as a parameter and gives me the shortened URL. First relevant hit on DuckDuckGo showed this simple Python script on Geeks for Geeks.
Works like charm:
$ tinyurl
'https://www.heise.de/meinung/Kommentar-Chaos-und-Resilienz-bei-Kritischen-Infra
strukturen-7158825.html'
http://tinyurl.com/2b2to4g8
One can certainly argue if using URL shortening services at all, as they are free, have no SLAs and may simply cease to exists at any time. But if the URL-target in question is really valuable, use the Web Archive.