Skip to content

bribeiro/node-googl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Installation

npm install -g goo.gl

Command-line Usage

$ goo.gl www.google.com
http://www.google.com -> http://goo.gl/fbsS

$ goo.gl http://goo.gl/fbsS
http://goo.gl/fbsS -> http://www.google.com/

$ goo.gl www.google.com http://goo.gl/fbsS nba.com
http://goo.gl/fbsS -> http://www.google.com/
http://www.google.com -> http://goo.gl/fbsS
http://nba.com -> http://goo.gl/d1T8

$ goo.gl --key aBcDeFGhIjKLMnOPqRsT www.spotify.com
http://www.spotify.com/ -> http://goo.gl/cJFAL

It'll shorten and/or expand one or more URLs at a time.

Module Usage

Methods return promises.

var googl = require('goo.gl');

// Shorten a long url and output the result
googl.shorten('http://www.google.com/')
    .then(function (shortUrl) {
        console.log(shortUrl);
    }).
    .catch(function (err) {
        console.error(err.message);
    });


// Set a developer key (see http://goo.gl/4DvFk for more info.)
googl.setKey('aBcDeFGhIjKLMnOPqRsT');

// Get currently set developer key
googl.getKey();

// Expand a goo.gl url and output the result
googl.expand('http://goo.gl/fbsS')
    .then(function (longUrl) {
        console.log(shortUrl);
    })
    .catch(function (err) {
        console.error(err.message);
    });
});

About

A Node.js url shortener and expander powered by Google

Resources

Stars

Watchers

Forks

Packages

No packages published