Skip to content

.onion TLD #401

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

Closed
davidt99 opened this issue Sep 10, 2024 · 3 comments · Fixed by #402
Closed

.onion TLD #401

davidt99 opened this issue Sep 10, 2024 · 3 comments · Fixed by #402
Labels
bug Issue: Works not as designed

Comments

@davidt99
Copy link
Contributor

When validating URLs with TLD enabled, .onion comes up as not validated. Since .onion URLs (TOR) are kinda unique, I wonder if we should add it to the TLD list or add a separate flag.
I can open a PR for both solutions, I just wonder what the best way is.
For context, tldextract accepts .onion.

@yozachar
Copy link
Collaborator

Hi @davidt99, are onion URLs validated by this library? Can you show me an example? AFAIK they are not in tests.

@davidt99
Copy link
Contributor Author

It's not validated when the consider_tld flag is on since .onion is not in the TLD list.

@yozachar
Copy link
Collaborator

Okay, instead of adding it to _tld.txt, we could append it to _popular_cache in domain.py.

_popular_cache = {"COM", "ORG", "RU", "DE", "NET", "BR", "UK", "JP", "FR", "IT"}
_popular_cache.add("ONION")

@yozachar yozachar added the bug Issue: Works not as designed label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue: Works not as designed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants