sort target domains

This commit is contained in:
JrD
2020-08-21 14:39:41 +08:00
parent 3970d07030
commit f344d7abcc
+4 -3
View File
@@ -112,7 +112,7 @@ def match_main_domain(domain):
def read_target_file(target): def read_target_file(target):
domains = set() domains = list()
with open(target, encoding='utf-8', errors='ignore') as file: with open(target, encoding='utf-8', errors='ignore') as file:
for line in file: for line in file:
domain = match_main_domain(line) domain = match_main_domain(line)
@@ -121,8 +121,9 @@ def read_target_file(target):
domain = get_main_domain(domain) domain = get_main_domain(domain)
if not domain: if not domain:
continue continue
domains.add(domain) domains.append(domain)
return domains sorted_domains = sorted(set(domains), key=domains.index)
return sorted_domains
def get_from_target(target): def get_from_target(target):