mirror of
https://github.com/adulau/providence.git
synced 2024-12-22 00:36:00 +00:00
chg: [providence] output JSON
This commit is contained in:
parent
28d5c91f4a
commit
a8ac67cf00
1 changed files with 12 additions and 2 deletions
|
@ -4,6 +4,7 @@ import argparse
|
|||
from pathlib import Path
|
||||
import os
|
||||
import re
|
||||
import orjson
|
||||
|
||||
import requests
|
||||
|
||||
|
@ -20,6 +21,7 @@ parser.add_argument(
|
|||
type=str,
|
||||
help="Limit to a specific TLD (if not, all known TLDs are tested)",
|
||||
)
|
||||
#parser.add_argument("","")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -65,15 +67,23 @@ results = set()
|
|||
if re.search(r' {1,}', args.name):
|
||||
# replace with -
|
||||
name = args.name
|
||||
reversed_name = " ".join(args.name.split(" ")[::-1])
|
||||
p = name.replace(" ", "-")
|
||||
results.update(guess_name(name=p, tlds=tlds))
|
||||
# combined
|
||||
p = reversed_name.replace(" ", "-")
|
||||
results.update(guess_name(name=p, tlds=tlds))
|
||||
p = name.replace(" ", "")
|
||||
results.update(guess_name(name=p, tlds=tlds))
|
||||
p = reversed_name.replace(" ", "")
|
||||
results.update(guess_name(name=p, tlds=tlds))
|
||||
# try with removal of word
|
||||
for word in args.name.split(" "):
|
||||
results.update(guess_name(name=word, tlds=tlds))
|
||||
else:
|
||||
results.update(guess_name(name=args.name, tlds=tlds))
|
||||
|
||||
print(results)
|
||||
output = {}
|
||||
output['results'] = list(results)
|
||||
j = orjson.dumps(output).decode()
|
||||
|
||||
print(j)
|
||||
|
|
Loading…
Reference in a new issue