24 lines
678 B
Python
24 lines
678 B
Python
from scrape import scrape_id
|
|
import csv, sys, datetime
|
|
|
|
if len(sys.argv) < 3:
|
|
print("Usage: update_list.py <list.txt> <update_file.csv>")
|
|
sys.exit(0)
|
|
|
|
list_filename = sys.argv[1]
|
|
update_filename = sys.argv[2]
|
|
|
|
update_file = open(update_filename, "a+")
|
|
update_file_writer = csv.writer(update_file)
|
|
|
|
current_time_string = "{0:%Y-%m-%d %H:%M:%S}".format(datetime.datetime.now())
|
|
|
|
with open(list_filename) as list_file:
|
|
for id_str in list_file:
|
|
id = id_str.strip()
|
|
|
|
result = scrape_id(id)
|
|
|
|
update_file_writer.writerow([ id, current_time_string, result["extension"], result["no_of_extensions"], result["possible_extensions"]])
|
|
|
|
update_file.close() |