philiphacks / node-unshortener

Unshorten links from any shortener service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unshortener module for Node.js

node-unshortener provides a link unshortener module for Node.js.

Requirements

You can install node-unshortener from the github package. Dependencies:

Getting started

The unshortener can be used on almost any link shortener service. 'goo.gl', 'dlvr.it', 't.co', 'bit.ly' and 'qr.ae' are supported by default. Read the examples to see its usage.

Setup unshortener

var	u = require('../lib/unshortener'),
	unshortener = new u(['youtu.be']);

The above snippet creates a new unshortener object and specifies youtu.be as an extra shortener service (in addition to the others stated above). This (optional) parameter can be a list of arbitrary length containing shortener services.

Unshorten URL

The following snippet shows an example of the unshortener for the goo.gl shortener service.

unshortener.unshorten('http://goo.gl/FEkwU', function (err, body) {
	if (err) {
		throw err + ' on url \'' + url + '\'';
		return this;
	} else {
		console.log(body);
	}
});

Tests

The test directory contains tests for various URLs.

Contributors

About

Unshorten links from any shortener service

License:Other


Languages

Language:JavaScript 100.0%