Small changes to output

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

13
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):
if max_len != None:
retList = [] retList = []
for x in my_list: for x in my_list:
if len(x) == (max_len + 3): if len(x) == (max_len + 3):
retList.append(x) retList.append(x)
return retList 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)
if len(the_list) > 0:
out = cmd.Cmd() out = cmd.Cmd()
if len(the_list) > 0:
if max_len != None:
the_list = sorted(the_list, key=len, reverse=False)
out.columnize(the_list, displaywidth=80) 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!")