URL Toolbelt
A set of libraries to extract specific metrics, states and data about a URL.
Installation
npm install urlext
Usage
var urlext = require('urlext');
Then get url metrics for www.cnn.com
by calling (the port identifier :80
is optional, but shown here for completeness):
urlext.extract('www.cnn.com:80', function (err, res) { console.log(JSON.stringify(res));});
or
urlext.extract('http://www.cnn.com:80', function (err, res) { console.log(JSON.stringify(res));});
Will provide following output:
TLDs
The tld
, domain
and subdomain
fields in the result are extracted based on the tld list provided by PublixSuffix.org.
Test
To run the test-suite execute:
npm test