️ Add time and change file path

This commit is contained in:
Johnshall
2022-05-23 17:48:52 +08:00
parent ca6eab410f
commit d0c1e82cfd

View File

@@ -10,19 +10,22 @@ import time
import threading import threading
import csv import csv
now_time = time.strftime("%Y-%m-%d %H:%M:%S")
url = 'https://moz.com/top-500/download/?table=top500Domains' url = 'https://moz.com/top-500/download/?table=top500Domains'
r = requests.get(url) r = requests.get(url)
with open("top500Domains.csv", "wb") as code: with open("resultant/top500Domains.csv", "wb") as raw:
code.write(r.content) raw.write(r.content)
with open('top500Domains.csv','r') as csvfile: with open('resultant/top500Domains.csv','r') as csvfile:
reader = csv.reader(csvfile) reader = csv.reader(csvfile)
with open("resultant/top500_manual.list", "w") as file_domain_in: with open("resultant/top500_manual.list", "w") as file_domain_in:
file_domain_in.write('# top500 proxy list update time: ' + now_time + '\n')
for domain_i,rows in enumerate(reader): for domain_i,rows in enumerate(reader):
if domain_i != 1: if domain_i != 1:
for domain_n in reader: for domain_n in reader:
file_domain_in.write(domain_n[1] + '\n') file_domain_in.write(domain_n[1] + '\n')
print('Get top500 list successfully...\n\n')
# Read top500 # Read top500
domains = [] domains = []
@@ -75,7 +78,7 @@ print('top500 Script Starting...\n\n')
# Start Thread # Start Thread
scaner_thread_num = 0 scaner_thread_num = 0
for i in range(5): for i in range(10):
DomainScaner().start() DomainScaner().start()
scaner_thread_num += 1 scaner_thread_num += 1
@@ -88,7 +91,6 @@ while scaner_thread_num:
file_proxy = open('resultant/top500_proxy.list', 'w', encoding='utf-8') file_proxy = open('resultant/top500_proxy.list', 'w', encoding='utf-8')
file_direct = open('resultant/top500_direct.list', 'w', encoding='utf-8') file_direct = open('resultant/top500_direct.list', 'w', encoding='utf-8')
now_time = time.strftime("%Y-%m-%d %H:%M:%S")
file_proxy.write('# top500 proxy list update time: ' + now_time + '\n') file_proxy.write('# top500 proxy list update time: ' + now_time + '\n')
file_direct.write('# top500 direct list update time: ' + now_time + '\n') file_direct.write('# top500 direct list update time: ' + now_time + '\n')