0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GoでGoogle URL Shortener APIで短縮されたURLをデコードするライブラリ

Posted at

とある理由があって
google の URL Shortener API を使って短縮されたURLを
デコードするライブラリを作りました。

go-goo.gl-parser です。

$ go get -u github.com/smith-30/go-goo.gl-parser

使い方例

package main

import (
	"fmt"

	parser "github.com/smith-30/go-goo.gl-parser"
)

func main() {
	p := parser.NewParser("")
	d, err := p.DecodeURL("https://goo.gl/kMxDaw")
	if err != nil {
		fmt.Printf("%v\n", err)
	}

	fmt.Println(d) // https://github.com/smith-30/go-goo.gl-parser
}

注意

console.developers.google.comからURL Shortener APIを有効にして
api tokenを取得してライブラリに渡してあげてください。

くれぐれもトークンはリポジトリにあげないように。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?