Wynn Netherland changelog.com/posts

A pair of gems to create and expand goo.gl URLs

Now that Google has released an API for its goo.gl URL shortening service, command line geeks have a couple of options to create short URLs without opening a browser.

google_url_shortener

Developed by Josh Nesbitt at Stac, google_url_shortener is a handy command line utility to create and expand goo.gl URLs.

Install via Rubygems

gem install google_url_shortener

… and configure your API key

googl install supercalifragilisticexpialidocious

Now you can shorten URLS with

$ googl shorten https://changelog.com                                         
--> http://goo.gl/qWxv

The built-in help shows the full usage:

~ » googl --help                                                                 
Google URL Shortener

Examples:

  googl install myapikey
  googl {shorten,s} http://example.com
  googl {expand,e} http://goo.gl/1234
  googl expand http://goo.gl/1234 -a

Options:
  --analytics, -a:   Show analytics when expanding a URL
    --version, -v:   Print version and exit
       --help, -h:   Show this message

Be sure and check out the Stac blog post for tips on setting up copy-to-the-clipboard Bash aliases and such.

Get Shortly

If, like us here at The Changelog, your needs for URL shortening go beyond goo.gl, you might check out Shortly from Bagwan Pankaj. In addition to goo.gl, Shortly also supports bit.ly, is.gd, and tinyurl.com.

If someone wanted to beat me to it and fork the project to add ShortSwitch support for our lg.gd domain, you just might get some ink on this here blog…

[google_url_shortener on GitHub] [shortly on GitHub]


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00