Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work for third level domains #6

Closed
ojurkiewicz opened this issue Apr 10, 2020 · 6 comments
Closed

Does not work for third level domains #6

ojurkiewicz opened this issue Apr 10, 2020 · 6 comments

Comments

@ojurkiewicz
Copy link

ojurkiewicz commented Apr 10, 2020

Example:
extractDomain('https://www.argos.co.uk/');

Expected result:
argos.co.uk
Current result:
co.uk

Possible solution:
Check against some good TLD list. For example: https://publicsuffix.org/list/public_suffix_list.dat

@bjarneo
Copy link
Owner

bjarneo commented Apr 10, 2020

Hi. Thanks for the issue. One does already exist, can be found at #1.

I've though about what you mentioned, but that will increase the size for this library drastically. However, one thought is to create a separate lib to support both.

@ojurkiewicz
Copy link
Author

So sorry, should've read that before posting. It will increase the size (but i would argue if drastically 😉) but as far as i'm concerned this is the only way to get 100% accurate results.

@bjarneo
Copy link
Owner

bjarneo commented Apr 15, 2020

No need for sorry :)

Regarding the size, this file is 215K large 😄: https://publicsuffix.org/list/public_suffix_list.dat

Could of course do some magic to fetch only when needed

@sadortun
Copy link

sadortun commented May 7, 2020

@bjarneo You could also strip the file down as part of the build process and reduce it to a nested array. where the top level indices match TLD names ex: {"ac": { 'com', ' 'edu','gov' }}

@madeindjs
Copy link
Contributor

I think you could use psl librairy. The minified size is "only" 127kb.

@bjarneo
Copy link
Owner

bjarneo commented Apr 28, 2021

@madeindjs I caved in and used the psl lib. Here are the details: #7

@bjarneo bjarneo closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants