https://github.com/willf/publicsuffix
Simple CLI command that prints domain information using the [Public Suffix List](https://publicsuffix.org/).
https://github.com/willf/publicsuffix
Last synced: about 1 year ago
JSON representation
Simple CLI command that prints domain information using the [Public Suffix List](https://publicsuffix.org/).
- Host: GitHub
- URL: https://github.com/willf/publicsuffix
- Owner: willf
- Created: 2023-09-04T14:05:02.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-03T18:31:25.000Z (over 2 years ago)
- Last Synced: 2025-03-24T12:52:25.799Z (about 1 year ago)
- Language: Go
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

#Public Suffix
Simple Go command that prints domain information using the [Public Suffix List](https://publicsuffix.org/).
## Installation
Assuming you have Go installed and your `$GOPATH` set:
1. Clone the repository
2. Run `go install`
## Usage
Standard input is used to read the domain name. The output is a JSON object with the following fields:
- `input`: The input
- `tld`: The top level domain
- `sld`: The second level domain
- `trd`: The third level domain
- `base`: The base domain
- `error`: Any error that occurred
Input can be a full URL or just a domain name. If a URL is provided, the scheme and path are ignored.
```
$ echo 'www.example.com' | publicsuffix
{"input":"www.example.com","tld":"com","sld":"example","trd":"www","base":"example.com","error":null}
$ echo 'https://www.example.com' | publicsuffix
{"input":"www.example.com","tld":"com","sld":"example","trd":"www","base":"example.com","error":null}
$ cat domains.txt | publicsuffix > domains.json
```