Skip to content

masylum/tldextract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tldextract

Accurately separates the gTLD or ccTLD (generic or country code top-level domain) from the registered domain and subdomains of a URL.

How does it work?

var tldextract = require('tldextract');

tldextract('http://forums.news.cnn.com/', function (err, obj) {
  // obj: {subdomain: 'forums.news', domain: 'cnn', tld: 'com'}
});

tldextract('http://ye.ye.ye.ye/', function (err, obj) {
  // obj: {subdomain: 'ye', domain: 'ye', tld: 'ye.ye'}
});

tests

make

Disclaimer

This module is a port of the python module tldextract.

About

Extract domain, subdomain and tld from a url

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published