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

Wrong indices when the domain name contains the same TLD twice #109

Closed
tkrissuu opened this issue Dec 16, 2021 · 3 comments · Fixed by #110
Closed

Wrong indices when the domain name contains the same TLD twice #109

tkrissuu opened this issue Dec 16, 2021 · 3 comments · Fixed by #110

Comments

@tkrissuu
Copy link

I am seeing a strange behaviour when finding URLs with indices. It is triggered when the TLD is also present earlier in the domain name. In the example below ".com" appears twice. But it will also fail with e.g. "www.dk-hostmaster.dk".

To reproduce:

from urlextract import URLExtract
extractor = URLExtract()
urls = extractor.find_urls("www.company.com", get_indices=True)
print(urls[0])

Output is:
('www.company.com', (8, 23))

I would have expected:
('www.company.com', (0, 15))

@lipoja
Copy link
Owner

lipoja commented Dec 20, 2021

@tkrissuu Thank you for reporting this issue. Nice catch!
I know what is the issue here and I will send fix soon.

@lipoja
Copy link
Owner

lipoja commented Dec 22, 2021

@tkrissuu It should be fixed in v1.5.0.
Thanks!

@tkrissuu
Copy link
Author

@lipoja Awesome. Thanks! That was quick.

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

Successfully merging a pull request may close this issue.

2 participants