Skip to content

A URL shortener command-line app. for bit.ly; implemented in Go.

License

Notifications You must be signed in to change notification settings

jabbalaci/UrlShortener-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URL Shortener (Go)

A URL shortener command-line app. for bit.ly. Implemented in Go, using bit.ly's API v4.

You can use it in interactive mode only.

Installation

$ go install github.com/jabbalaci/UrlShortener-go/cmd/urlshortener@latest

It was tested under Linux and Windows.

Pre-requisite

For this to work, you need an access token from bit.ly. Don't worry, it's free. After registration you can generate one for yourself. Then, add it as an environment variable called BITLY_ACCESS_TOKEN. For instance, under Linux add the following line to the end of your ~/.bashrc file:

export BITLY_ACCESS_TOKEN="..."

Under Linux, the copy to clipboard functionality requires the Linux command xsel. You can install it via your package manager.

Usage

$ urlshortener
Long URL: https://github.com/jabbalaci/UrlShortener-go

https://bit.ly/41dBYWh

# expanded from shortened URL: https://github.com/jabbalaci/UrlShortener-go (matches)

Copy shortened URL to clipboard [Yn]? y
# copied ✓
Zoom into this short URL [yN]? y
# yes ✓
# written to /tmp/urlshortener-1795634551.html

Provide the long URL, and it'll give you back the shortened bit.ly URL.

If you want, you can copy the short URL to the clipboard.

If you want, you can create a local HTML file that shows the short URL using large fonts. This is useful if you do a presentation / lecture and you quickly want to share a link with your audience.

Screenshot of the local HTML page:

screenshot

The characters in the funny ID are also pronounced to avoid confusion between similar characters like o, O, 0, etc.

In addition, there's also a QR code pointing on your URL.

About

A URL shortener command-line app. for bit.ly; implemented in Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published