Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a8775dfc9 | ||
|
|
015eebd6ed |
+11
-8
@@ -1,16 +1,15 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from cool_domain import PKG_NAME, PKG_VERSION
|
||||||
|
from cool_domain.cache import Cache
|
||||||
|
from cool_domain.constants import LANGS
|
||||||
|
from cool_domain.factory import Factory
|
||||||
|
from cool_domain.logs import setup_logs
|
||||||
|
from cool_domain.params import parse_parameters
|
||||||
|
from cool_domain.tld_list import TLDList
|
||||||
from cool_domain.word_list import WordList
|
from cool_domain.word_list import WordList
|
||||||
|
|
||||||
from . import PKG_NAME, PKG_VERSION
|
|
||||||
from .cache import Cache
|
|
||||||
from .constants import LANGS
|
|
||||||
from .factory import Factory
|
|
||||||
from .logs import setup_logs
|
|
||||||
from .params import parse_parameters
|
|
||||||
from .tld_list import TLDList
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
def main() -> int:
|
||||||
params = parse_parameters(sys.argv[1:])
|
params = parse_parameters(sys.argv[1:])
|
||||||
@@ -33,3 +32,7 @@ def main() -> int:
|
|||||||
else:
|
else:
|
||||||
logging.getLogger().info(factory.random_domain())
|
logging.getLogger().info(factory.random_domain())
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|||||||
+1290
-1
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,8 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from .tld_list import TLDList
|
from cool_domain.tld_list import TLDList
|
||||||
from .word_list import WordList
|
from cool_domain.word_list import WordList
|
||||||
|
|
||||||
|
|
||||||
class FactoryError(Exception):
|
class FactoryError(Exception):
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import enum
|
|||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from .params import Parameters
|
from cool_domain.params import Parameters
|
||||||
|
|
||||||
|
|
||||||
class TermColor(enum.StrEnum):
|
class TermColor(enum.StrEnum):
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import pathlib
|
|||||||
import tempfile
|
import tempfile
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from . import PKG_NAME
|
from cool_domain import PKG_NAME
|
||||||
from .constants import LANGS
|
from cool_domain.constants import LANGS
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True, slots=True)
|
@dataclasses.dataclass(frozen=True, slots=True)
|
||||||
@@ -19,7 +19,7 @@ class Parameters:
|
|||||||
dig: bool = True
|
dig: bool = True
|
||||||
lang: str = "english"
|
lang: str = "english"
|
||||||
cache_file: str = str(pathlib.Path(tempfile.gettempdir()) / ".cool-domain-cache")
|
cache_file: str = str(pathlib.Path(tempfile.gettempdir()) / ".cool-domain-cache")
|
||||||
tld_list_uri: str = "https://publicsuffix.org/list/public_suffix_list.dat"
|
tld_list_uri: str = "https://data.iana.org/TLD/tlds-alpha-by-domain.txt"
|
||||||
custom_words: str = "words.txt"
|
custom_words: str = "words.txt"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
+8
-10
@@ -5,7 +5,8 @@ import typing
|
|||||||
import requests
|
import requests
|
||||||
import unidecode
|
import unidecode
|
||||||
|
|
||||||
from .cache import Cache
|
from cool_domain.cache import Cache
|
||||||
|
from cool_domain.constants import BLACKLIST
|
||||||
|
|
||||||
|
|
||||||
class TLDError(Exception):
|
class TLDError(Exception):
|
||||||
@@ -29,21 +30,18 @@ class TLDList:
|
|||||||
raw_lines = response.content.decode().split("\n")
|
raw_lines = response.content.decode().split("\n")
|
||||||
out_lines = []
|
out_lines = []
|
||||||
for line in raw_lines:
|
for line in raw_lines:
|
||||||
stripped_line = line.strip()
|
stripped_line = line.strip().lower()
|
||||||
if (
|
if (
|
||||||
len(stripped_line)
|
len(stripped_line)
|
||||||
and not stripped_line.startswith("//")
|
and not stripped_line.startswith("//")
|
||||||
and not stripped_line.startswith("*")
|
and not stripped_line.startswith("*")
|
||||||
|
and not stripped_line.startswith("#")
|
||||||
|
and not stripped_line.startswith("xn--")
|
||||||
|
and "." not in stripped_line
|
||||||
and unidecode.unidecode(stripped_line) == stripped_line
|
and unidecode.unidecode(stripped_line) == stripped_line
|
||||||
|
and stripped_line not in BLACKLIST
|
||||||
):
|
):
|
||||||
if "." in stripped_line:
|
out_lines += [stripped_line]
|
||||||
for other in out_lines:
|
|
||||||
if stripped_line.endswith(other):
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
out_lines += [stripped_line]
|
|
||||||
else:
|
|
||||||
out_lines += [stripped_line]
|
|
||||||
return out_lines
|
return out_lines
|
||||||
|
|
||||||
def load(self) -> None:
|
def load(self) -> None:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "cool-domain"
|
name = "cool-domain"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cool-domain"
|
name = "cool-domain"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "requests" },
|
{ name = "requests" },
|
||||||
|
|||||||
Reference in New Issue
Block a user