-
Notifications
You must be signed in to change notification settings - Fork 4
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
Comments
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. |
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. |
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 |
@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: |
I think you could use psl librairy. The minified size is "only" 127kb. |
@madeindjs I caved in and used the psl lib. Here are the details: #7 |
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
The text was updated successfully, but these errors were encountered: