Crates.io | bitly-urlshortener |
lib.rs | bitly-urlshortener |
version | 0.1.1 |
source | src |
created_at | 2022-08-06 07:18:58.941587 |
updated_at | 2022-08-06 07:58:03.140178 |
description | A URL shortener command-line app. using bit.ly API v4. |
homepage | |
repository | https://github.com/jabbalaci/UrlShortener-rs |
max_upload_size | |
id | 639737 |
size | 42,293 |
A URL shortener command-line app. for bit.ly. Implemented in Rust, using bit.ly's API v4.
It was tested under Linux and Windows.
You can use it in interactive and non-interactive modes. In interactive mode, you have the possibility to copy the shortened URL to the clipboard.
$ urlshortener
Long URL: https://google.com
https://bit.ly/2R9zFOR
# expanded from shortened URL: https://google.com (matches)
Copy shortened URL to clipboard [Yn]? y
# copied
$ urlshortener https://google.com
https://bit.ly/2R9zFOR
# expanded from shortened URL: https://google.com (matches)
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.
If you have the Rust compiler, you can install it directly
from crates.io using the command cargo
:
$ cargo install bitly-urlshortener
I used pyshorteners to figure out how to call bit.ly's API v4.
I have a Nim implementation but that one uses an older API of bit.ly (v3).
I have a C# implementation too, which uses the newer API of bit.ly (v4).