nager / Nager.PublicSuffix

.NET public suffix domain parser
MIT License
155 stars 22 forks source link

ParseException - Domain is a TLD according publicsuffix #46

Closed emugerman closed 8 months ago

emugerman commented 4 years ago

Hi,

When try to parse the following URL:

string url = "http://instahuddle.en.aptoide.com";
var domainParser = new DomainParser(new WebTldRuleProvider());
var domainName = domainParser.Get(url);
var domain = domainName.RegistrableDomain;

The following exception in thrown:

((Nager.PublicSuffix.ParseException)ex).ErrorMessage
Domain is a TLD according publicsuffix

The url http://instahuddle.en.aptoide.com is fine and it should give for RegistrableDomain just aptoide.com

tinohager commented 4 years ago

If you check the domain with the http:// ?

emugerman commented 4 years ago

You meant without the http://, and yes, it is working, i didn't know that it fails because of the protocol. (the exception should be more clear).

But why not support that code-wise? instead of manually remove the protocol?

tinohager commented 8 months ago

I am about to release a new version of the library. There are now fewer exceptions thrown and there is better support for dependency injection.