url-unshorten
v1.0.6
Published
Unshortens shorten urls
Downloads
65
Readme
url-unshorten
Checks urls that might be shorten and returns all the potential redirects until its unshorten.
Installation
npm i url-unshorten
Usage
The url-unshorten
module exports a function that accepts a url and returns a promise that resolves with the array of the potential urls that redirect to the resolved unshorten one. For convenience it also outputs the unshorten url.
Example usage
const unshort = require('url-unshorten');
unshort('https://t.co/wy9S5P0Cd2')
.then(console.log)
.catch(console.log);
The above snippet will output the following:
{
urls: [
'https://t.co/wy9S5P0Cd2',
'https://nyti.ms/2KO3tC7',
'https://trib.al/WeJspBJ',
'https://www.nytimes.com/2018/07/10/sports/world-cup/england-croatia-france-belgium.html?smtyp=cur&smid=tw-nytimes'
],
unshorten:
'https://www.nytimes.com/2018/07/10/sports/world-cup/england-croatia-france-belgium.html?smtyp=cur&smid=tw-nytimes'
}