Files
cool-domain/README.md
T
2026-06-16 10:56:12 +02:00

89 lines
2.6 KiB
Markdown

[![](https://git.klemek.fr/klemek/cool-domain/actions/workflows/lint.yml/badge.svg?branch=main&style=flat-square)](https://git.klemek.fr/klemek/cool-domain/actions?workflow=lint.yml)
# Cool Domain
> Find a cool unclaimed domain names from the terminal
## Quickstart
Run either from python3, [pipx](https://pipx.pypa.io/stable/) or [uvx](https://docs.astral.sh/uv/guides/tools/)
```bash
# install with pip
python3 -m pip install git+https://git.klemek.fr/klemek/cool-domain
python3 -m cool-domain
# run with pipx
pipx run --spec git+https://git.klemek.fr/klemek/cool-domain cool-domain
# run with uvx
uvx --from git+https://git.klemek.fr/klemek/cool-domain cool-domain
```
## Usage
```txt
usage: cool-domain [-h] [--count DOMAIN_COUNT] [--words WORD_COUNT] [--lang {english,french,custom}] [--custom-words CUSTOM_WORDS]
[--dig | --no-dig] [--debug | --no-debug] [--quiet | --no-quiet] [--cache | --no-cache] [--cache-file CACHE_FILE]
[--tld-list-uri TLD_LIST_URI]
options:
-h, --help show this help message and exit
--count DOMAIN_COUNT number of domains to generate (default: 1)
--words WORD_COUNT number of words per domain (default: 1)
--lang {english,french,custom}
word list lang (default: english)
--custom-words CUSTOM_WORDS
custom word list location (default: words.txt)
--dig, --no-dig check availability with dig (default: true)
--debug, --no-debug
--quiet, --no-quiet
--cache, --no-cache use cache (default: true)
--cache-file CACHE_FILE
cache file location (default: /tmp/.cool-domain-cache)
--tld-list-uri TLD_LIST_URI
Top Level Domains list (default: https://publicsuffix.org/list/public_suffix_list.dat)
```
# Development
## Updating `tld.txt`
Go to [tld-list.com](https://tld-list.com) and open console.
```js
async function getValidTlds() {
const delay = (millis) =>
new Promise((resolve, reject) => {
setTimeout((_) => {
resolve();
}, millis);
});
const sourceData = await (
await fetch("https://tld-list.com/tlds-from-a-z")
).text();
const regexp = /href="\/tld\/([\w\.]+)"/gm;
const outTlds = [];
let match;
while ((match = regexp.exec(sourceData)) !== null) {
const tld = match[1];
await delay(100);
console.log(tld);
const resp = await fetch(`https://tld-list.com/tld/${tld}`);
if (resp.status === 200) {
const content = await resp.text();
if (!content.includes("Registrars (0)")) {
outTlds.push(tld);
}
}
}
return outTlds;
}
const tlds = await getValidTlds();
console.log(tlds.join(','));
```