node-tldtools icon indicating copy to clipboard operation
node-tldtools copied to clipboard

The tld is not been parsed correctly

Open jpalanco opened this issue 10 years ago • 1 comments

Code:

var tldtools = require('tldtools').init();

console.log(tldtools.extract('http://bob:[email protected]:1234/?go=abc&123'));

Result:

{ subdomain: 'wagga.wagga.funkjazz.gov',
  domain: 'au',
  tld: '',
  url_tokens: 
   { protocol: 'http:',
     slashes: true,
     auth: 'bob:funk',
     host: 'wagga.wagga.funkjazz.gov.au:1234',
     port: '1234',
     hostname: 'wagga.wagga.funkjazz.gov.au',
     hash: null,
     search: '?go=abc&123',
     query: 'go=abc&123',
     pathname: '/',
     path: '/?go=abc&123',
     href: 'http://bob:[email protected]:1234/?go=abc&123' },
  inspect: { useful: [Function], getDomain: [Function] } }
TLD Cache is UP

Expected result:

{ subdomain: 'wagga.wagga',
  domain: 'funkjazz',
  tld: 'gov.au',
  url_tokens:
   { protocol: 'http:',
     slashes: true,
     auth: 'bob:funk',
     host: 'bob:[email protected]:1234',
     port: '1234',
     hostname: 'wagga.wagga.funkjazz.gov.au',
     href: 'http://bob:[email protected]:1234/?go=abc&123',
     search: '?go=abc&123',
     query: 'go=abc&123',
     pathname: '/' },
  inspect: { useful: [Function], getDomain: [Function] } }

tldtools version : "0.0.19"

nodejs version: v0.10.25

jpalanco avatar Nov 05 '14 10:11 jpalanco

Also have this problem?

eNzyOfficial avatar Sep 04 '18 04:09 eNzyOfficial