tld.js icon indicating copy to clipboard operation
tld.js copied to clipboard

can not get domain if domain with underscore (_)

Open henryhuang2013 opened this issue 3 years ago • 1 comments

e.g. http://wt_nbshentong.cn.b2b168.com/ can not get the domain.

{ hostname: 'wt_njxinjiyuan1.cn.b2b168.com', isValid: false, isIp: false, tldExists: false, publicSuffix: null, domain: null, subdomain: null }

do you know why?

henryhuang2013 avatar May 26 '21 10:05 henryhuang2013

Hi @henryhuang2013,

The issue is that unfortunately tld.js is rejecting this hostname as invalid because of the _ (underscore) character it contains. There was some work in the past to add an option to still accept such domains but it was not pursued: https://github.com/oncletom/tld.js/pull/122

Best,

remusao avatar May 26 '21 10:05 remusao