Small changes to output

This commit is contained in:
rune 2024-07-04 08:26:27 +02:00
parent c93920f4c5
commit 19c6ac5c46

25
app.py Normal file → Executable file
View File

@ -10,15 +10,18 @@ from bs4 import BeautifulSoup
try:
max_len = int(sys.argv[1])
except IndexError:
max_len = 255
max_len = None
def cleanlist(my_list):
retList = []
for x in my_list:
if len(x) == (max_len + 3):
retList.append(x)
return retList
if max_len != None:
retList = []
for x in my_list:
if len(x) == (max_len + 3):
retList.append(x)
return retList
else:
return my_list
def fetch():
@ -36,10 +39,14 @@ def parse():
final_list = [s.replace("xn--", "") for s in final_list] # remove all the 8s
the_list = cleanlist(final_list)
final_list = the_list.sort() # sorts normally by alphabetical order
the_list = sorted(the_list, key=len, reverse=False)
out = cmd.Cmd()
if len(the_list) > 0:
out = cmd.Cmd()
out.columnize(the_list, displaywidth=80)
if max_len != None:
the_list = sorted(the_list, key=len, reverse=False)
out.columnize(the_list, displaywidth=80)
else:
the_list = sorted(the_list, reverse=False)
out.columnize(the_list, displaywidth=140)
else:
print("No expired domains with the length citeria you wanted!")