Home
Unlimited sites, servers No source distribution Commercial use allowed Can modify source No support Attribution required Read full license | More Info
Starting from FREE
Short URLs are becoming increasingly prolific on modern social media, but sometimes it's much more appropriate to work with their long versions - for example when matching things to domains.
This library helps you do that. Just throw a URL at it and node-unshortener will tell you what the original URL looks like.
Since the component is a npm package installation is pretty simple:
Npm should correctly install all dependencies but there is currently a known problem with one of them - node-bitly.
You should follow these additional steps to install the latest version of node-bitly.
The free version of this library is open source under the GPL and available on github so head over there if you think you can help in making it awesomer or have any bugs to report.
// expand an URL
var unshortener = require('unshortener');
// you can pass in a url object or string
unshortener.expand('http://t.co/rWP6BP3',
function (url) {
// url is a url object
console.log(url);
});
If you have a handy bitly account you should also pass in an options object to enable the unshortener to use the bitly API directly:
// expand an URL
var unshortener = require('unshortener');
// you can pass in a url object or string
unshortener.expand('http://t.co/rWP6BP3',
{bitly: {username: '',
apikey: ''}},
function (url) {
// url is a url object
console.log(url);
});
node-unshortener aims to be able to unshorten any link possible, so it tries to behave as a browser and simply follows all the redirects. However, to be nice, when at all possible, it tries to use the url shortener's official API.
Services/domains directly supported so far:
Starting from FREE
Questions & Comments
Leave a comment
Log-in now or register for a free account.