Subosito Shorturl Save Abandoned

Generic implementation for interacting with various URL shortening services in Go.

Project README

ShortURL

Build Status GoDoc

Generic implementation for interacting with various URL shortening services in Go.

Usage

As usual you can install the package by issuing:

$ go get github.com/subosito/shorturl

Features

Shortening URL

ShortURL provides simple API to shorten a long URL, here's how:

// import "github.com/subosito/shorturl"

provider := "tinyurl"
u, err := shorturl.Shorten("http://example.com/", provider)
if err == nil {
	fmt.Println(u)
}

Alternatively, you can initialize desired provider:

// import "github.com/subosito/shorturl/tinyurl"

s := tinyurl.New()
u, err := s.Shorten("http://example.com/")
if err == nil {
	fmt.Println(u)
}

Expanding short URL

ShortURL also provides simple API to expand short URL into its original long URL:

// import "github.com/subosito/shorturl"

u, err := shorturl.Expand("http://bit.ly/13M3JX5")
if err == nil {
	fmt.Println(u)
}

Supported Services

Package Service Enviroment Variables
bitly https://bitly.com/ BITLY_ACCESS_TOKEN
gggg http://gg.gg/ -
gitio https://git.io/ -
isgd https://is.gd/ -
shorl http://shorl.com/ -
tinyurl https://tinyurl.com/ -

Credits

Inspiration comes from Rubygem shorturl by @robbyrussell

Open Source Agenda is not affiliated with "Subosito Shorturl" Project. README Source: subosito/shorturl
Stars
82
Open Issues
2
Last Commit
4 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating