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