{"id":17224860,"url":"https://github.com/pseudomuto/publicsuffix-net","last_synced_at":"2025-03-25T16:44:49.554Z","repository":{"id":29793379,"uuid":"33337616","full_name":"pseudomuto/publicsuffix-net","owner":"pseudomuto","description":"Domain parser based on the Public Suffix List.  https://publicsuffix.org/","archived":false,"fork":false,"pushed_at":"2015-04-06T00:25:35.000Z","size":712,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T14:52:45.079Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pseudomuto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-02T23:59:04.000Z","updated_at":"2015-04-06T00:25:35.000Z","dependencies_parsed_at":"2022-09-06T19:31:28.869Z","dependency_job_id":null,"html_url":"https://github.com/pseudomuto/publicsuffix-net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudomuto%2Fpublicsuffix-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudomuto%2Fpublicsuffix-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudomuto%2Fpublicsuffix-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pseudomuto%2Fpublicsuffix-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pseudomuto","download_url":"https://codeload.github.com/pseudomuto/publicsuffix-net/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245503513,"owners_count":20626180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T04:12:12.716Z","updated_at":"2025-03-25T16:44:49.530Z","avatar_url":"https://github.com/pseudomuto.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PublicSuffix\n\nPublicSuffix is a .NET domain name parser based on the [Public Suffix List].\n\n[![Build\nStatus](https://travis-ci.org/pseudomuto/publicsuffix-net.svg?branch=master)](https://travis-ci.org/pseudomuto/publicsuffix-net)\n\n[Public Suffix List]: https://publicsuffix.org/\n\n## What is the Public Suffix List?\n\nThe Public Suffix List is a cross-vendor initiative to provide an accurate list of domain name\nsuffixes.\n\nThe Public Suffix List is an initiative of the Mozilla Project, but is maintained as a community\nresource. It is available for use in any software, but was originally created to meet the needs of\nbrowser manufacturers.\n\nA \"public suffix\" is one under which Internet users can directly register names. Some examples of\npublic suffixes are \".com\", \".co.uk\" and \"pvt.k12.wy.us\". The Public Suffix List is a list of all\nknown public suffixes.\n\nSource: \u003chttp://publicsuffix.org\u003e\n\n## Requirements\n\nCurrently `.NET 4.5` is required. Very likely the code here would work for previous versions. If\nthere is any interest, I'd love to see a PR for supporting earlier versions.\n\n## Getting Started\n\nPublicSuffix(List) is available on NuGet.\n\n`Install-Package PublicSuffixList`\n\nIn Xamarin Studio you can find this option under the project's context menu: `Add | Add\nNuGet Packages...*.`\n\n## Usage\n\n### Parsing Domains\n\nDomains can easily be broken down into their top level, second level and sub domains.\n`PublicSuffixList#Parse` will respect registry policies (as defined by the list).\n\n```csharp\n// without subdomain\nvar domain = PublicSuffixList.Parse(\"google.com\");\nConsole.WriteLine(domain.TopLevelDomain)\n# com\nConsole.WriteLine(domain.SecondLevelDomain);\n# google\n\n// with subdomain\ndomain = PublicSuffixList.Parse(\"www.pseudomuto.co.uk\");\nConsole.WriteLine(domain.TopLevelDomain)\n# co.uk\nConsole.WriteLine(domain.SecondLevelDomain);\n# pseudomuto\nConsole.WriteLine(domain.SubDomain);\n# www\n```\n\n### Validating Domains\n\nDomains that are parsed with `PublicSuffix.Parse` are implicitly valid. However, if you're not \ninterested in the details, you can simply call `PublicSuffix.IsValid` and get a quick response as to \nwhether or not the domain is valid.\n\n```csharp\nif (PublicSuffixList.IsValid(\"www.google.com\")) {\n  // this code will run...\n}\n\nif (PublicSuffixList.IsValid(\"somedomain.ke\")) {\n  // this will not..\n}\n```\n\n### Using Your Own List\n\nBoth `Parse` and `IsValid` support overloads that take a `List` object to be used. When not\nspecified, `List.DefaultList` is used.\n\nWhile you can pass a list, it is recommended that you grab an updated copy of [the list](http://publicsuffix.org) regularly and\nset `List.DefaultDataFile` to point to it. This will make `List.DefaultList` use the specified file\nrather than the version bundled with this project.\n\n```csharp\nList.DefaultDataFile = \u003cpath to your file\u003e;\n```\n\n### Support for Private Domains\n\nSetting `List.AllowPrivateDomains` will cause the list to be reloaded with (or without) support for\nprivate (non-ICANN) domains. It is `true` by default.\n\n```csharp\nConsole.WriteLine(PublicSuffixList.Parse(\"muto.blogspot.com\").TopLevelDomain);\n# blogspot.com\n\nList.AllowPrivateDomains = false\nConsole.WriteLine(PublicSuffixList.Parse(\"muto.blogspot.com\").TopLevelDomain);\n# com\n```\n\n## License\n\nCopyright (c) 2015 PseudoMuto. This is free software distributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseudomuto%2Fpublicsuffix-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpseudomuto%2Fpublicsuffix-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpseudomuto%2Fpublicsuffix-net/lists"}