Skip to content

Extra small node.js lib that expands virtually all existing shorturl services.

Notifications You must be signed in to change notification settings

landeiro/Simple-URL-Expander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

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"

About

Extra small node.js lib that expands virtually all existing shorturl services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published