Skip to content
Extra small node.js lib that expands virtually all existing shorturl services.
Pull request Compare This branch is even with landeiro:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
README.md
examples.js

README.md

Simple URL Expander

This is an extra small node.js lib that expands virtually all existing shorturl services.

This expansion is only one level deep, it does not expands chained shorturls.

SUE is a working example of this script, can see here: http://landeiro.github.com/expander

Examples

var expand = require("./lib/expander.js");
// Youtube shorturl
expand.longurl("http://youtu.be/btmB-p_0QFg",function (result){
    console.log(result.longurl);
  });

// BBC shorturl
expand.longurl("http://bbc.in/lzCtYL",function (result){
    console.log(result.longurl);
  });

// Bit.ly shorturl
expand.longurl("http://bit.ly/gDjsaP",function (result){
    console.log(result.longurl);
  });

// goo.gl shorturl
expand.longurl("http://goo.gl/QLTa",function (result){
    console.log(result.longurl);
  });

// This url will return the same
expand.longurl("http://edition.cnn.com/US/",function (result){
    console.log(result.longurl);
  });

How-to

Use the function longurl( shorturl-to-expand, callbackfunction)

The result will be in JSON with two properties:

  • shorturl - The original shorturl sent
  • longurl - The expanded url

    {shorturl:"shorturl",longurl:"theExpandedURL"}

If error on request the longurl property will be the string "error"

Something went wrong with that request. Please try again.