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

Invalid tuple for second-level TLD as input #95

Open
elceef opened this issue Dec 3, 2020 · 6 comments
Open

Invalid tuple for second-level TLD as input #95

elceef opened this issue Dec 3, 2020 · 6 comments

Comments

@elceef
Copy link

elceef commented Dec 3, 2020

>>> tld.__version__
'0.12.3'
>>> parse_tld('co.uk', fix_protocol=True)
('co.uk', 'co.uk', '')
# desired: ('uk', 'co', '')
>>> parse_tld('gov.pl', fix_protocol=True)
('gov.pl', 'gov.pl', '')
# desired: ('pl', 'gov', '')
@barseghyanartur
Copy link
Owner

@elceef
Copy link
Author

elceef commented Jan 12, 2021

Please note that:

  • pl starts BEFORE gov.pl at line 5590
  • uk starts BEFORE co.uk at line 6419

@barseghyanartur
Copy link
Owner

barseghyanartur commented Jan 12, 2021

@elceef:

I think you don't understand the concept behind the TLD list. Since co.uk is in the list, it is considered a TLD. The only thing we separate here is public and private TLDs.

from tld import parse_tld                                                                                                                                   

parse_tld('co.uk', fix_protocol=True)                                                                                                                       
# ('co.uk', 'co.uk', '')

parse_tld('hey.uk', fix_protocol=True)                                                                                                                      
# ('uk', 'hey', '')

@elceef
Copy link
Author

elceef commented Jan 12, 2021

Respectfully, I think you miss the point being that both uk and co.uk are TLD, both are present in the list and uk precedes co.uk.

@barseghyanartur
Copy link
Owner

@elceef:

Your views slightly clash with an issue reported (and fixed) earlier #51

tld version 0.9.6 did behave as you now wish it would.

Let's discuss this further.

@elceef
Copy link
Author

elceef commented Jan 12, 2021

Input is inconsistent with the output:

>>> '.'.join(parse_tld('co.uk', fix_protocol=True))
'co.uk.co.uk.'

In this case and similar uk should have higher priority over co.uk and other second-level domains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants