You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-19Lines changed: 36 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,16 @@
6
6
7
7
public_suffix is a dart library for identifying the public suffixes (or TLDs), root domains and registrable parts of URLs.
8
8
9
+
## Main features
10
+
- Identify suffix, root domain, registrable domain (root + suffix) and subdomain from URLs.
11
+
- Provide your own list of suffix rules to keep up to date with the rules you need.
12
+
- Get results from matching with only ICANN/IANA rules or also include private ones.
13
+
- For example, a private rule can see the full `github.io` as suffix while ICANN only recognises the `io` part.
14
+
- Parse punycode encoded URLs and get both encoded and decoded results.
15
+
- Check if URLs are subdomains, have valid domain parts, or end with known suffixes.
16
+
9
17
## Usage
10
-
1) Import `public_suffix`:
18
+
1) Import public_suffix:
11
19
-`public_suffix.dart`: If you prefer loading suffix lists on your own.
12
20
-`public_suffix_io.dart`: For helper methods to load suffix lists from URIs using `dart:io`.
13
21
-`public_suffix_browser.dart`: For helper methods to load suffix lists from URIs using `dart:html`.
@@ -17,31 +25,40 @@ public_suffix is a dart library for identifying the public suffixes (or TLDs), r
17
25
18
26
**Note:** Don't overload publicsuffix.org's servers by repeatedly retrieving the suffix list from them. Cache a copy somewhere instead, and update that copy only when the master copy is updated.
Several utility functions can be found in the `DomainUtils` class (imported from `public_suffix.dart`). These currently include:
56
+
-`isSubdomainOf`: Checks if a given URL is a subdomain of another domain.
57
+
-`isSubdomain`: Checks if a given URL has a subdomain part.
58
+
-`isKnownSuffix`: Checks if a given suffix (e.g. `co.uk`) is listed in the suffix rule list.
59
+
-`hasValidDomain`: Checks if a given URL contains a registrable domain part.
60
+
61
+
Most of these create PublicSuffix objects internally. If you are already working with PublicSuffix objects, there are similar methods you can call directly on those to avoid creating new ones.
62
+
46
63
## License
47
64
public_suffix is licensed under the MIT license. See [LICENSE](https://github.com/Komposten/public_suffix/blob/master/LICENSE) for the full license text.
0 commit comments