danesparza / domainname-parser Goto Github PK
View Code? Open in Web Editor NEW:department_store: .NET domain name parsing library (uses publicsuffix.org)
License: MIT License
:department_store: .NET domain name parsing library (uses publicsuffix.org)
License: MIT License
using DomainParser.Library;
DomainName.TryParse("carrd.co", out var result);
The result being null while carrd.co is a valid domain
Obviously this can be done in PowerShell and windows task scheduler but having an auto-download/clear cache would be a good method to include. It could be called from whatever service is validating email addresses however the devs want to write it.
What is the license on this code?
Please can you add .net standard support?
hi,
I just tried to use the library in a WebApi project, but cannot get it running for more than 4 hours.
The problem is simply, that the result is always null. I believe, it is because the txt-file is somehow not loaded/available.
I tried without specifying any Application variables. Doesn´t work.
I tried with a hardcoded path (as application variable) in the IIS folder. Doesn´t work.
Make sure, full rights are applied to the folder. Nothing changed.
A small testproject (Webapi), that only invokes the TryParse once would be great. Because even that doesnot work for me. I have choosen some empty asp.net project and included only references for WebApi.
Thank you in advance!
Best
Andreas
If you have "russian.cntv.cn" for parsing in line:
tldIndex = domainString.IndexOf("." + MatchingRule.Name, StringComparison.InvariantCultureIgnoreCase);
https://github.com/danesparza/domainname-parser/blob/master/DomainName.Library/DomainName.cs#L145
you will get:
tempSudomainAndDomain = "russian"
TLD = "cntv.cn"
Is this error?
I like the library and it seems it does the job pretty well, thanks for it. But one thing is quite annoying. I can not use DomainName class without specifying full namespace prefix as below.
DomainName.Library.DomainName domain;
if (DomainName.Library.DomainName.TryParse("http://www.domain.com", out domain))
return domain;
My suggestion is rename DomainName.Library as DomainParser and i also suggest rename DomainName as Domain.
Thanks
Domain parser is parsing this url ladymoriartyinparis.blogspot.com.tr as below
Domain = ladymoriartyinparis
TLD = blogspot.com.tr
Why it couldnt parse it correctly for this domain ?
First off - thank you very much for posting this app. And excuse if asking this question is not appropriate!
Bottom line is your app will be perfect for my needs but I just cannot get it to parse a domain name. I am in Visual Studio 2012; installed via NuGet without issue. downloaded the publicsuffix.org ruleset and pointed to it in app.config. Below is my sample test code in VB.net. So my question is how can I debug the failure? As an example is the app happy with the publicsuffix.org file - either format wise or? Since no errors it would seem like that maybe is the issue? Can I declare the source file directly in the code rather than in app.config? Any other idea's for me to troubleshoot? Again - thank you.
Imports System.Windows.Forms
Module Module1
Sub Main()
Dim outDomain As DomainName.Library.DomainName = Nothing
' Try parsing a 'wildcard' domain
If DomainName.Library.DomainName.TryParse("photos.verybritish.co.uk", outDomain) Then
' The domain should be parsed as 'verybritish'
MessageBox.Show("Domain = " & outDomain.Domain.ToString)
' The TLD is 'co.uk'
MessageBox.Show("TLD = " & outDomain.TLD.ToString) 'Assert.AreEqual("co.uk", outDomain.TLD)
' The SLD is just an alias for 'Domain':
MessageBox.Show("SLD = " & outDomain.SLD.ToString)
' The subdomain is everything else to the left of the domain:
MessageBox.Show("subdomain = " & outDomain.SubDomain.ToString)
Else
MessageBox.Show("Apparently, we couldn't parse photos.verybritish.co.uk")
End If
End Sub
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.