changing detail downloads to prefiltering first. Making the progress bar more accurate and frontloading

This commit is contained in:
Kadir 2024-04-01 20:28:37 +02:00
parent b16fee0648
commit 5305451fe8

View file

@ -4,11 +4,13 @@ from tqdm import tqdm
from data_access import Listing
counter = 0
for listing in tqdm(Listing.get_all_listings()):
if listing.path_detail_json().exists():
continue
counter+=1
listings = Listing.get_all_listings()
filtered_listings = []
for listing in listings:
if not listing.path_detail_json().exists():
filtered_listings.append(listing)
for listing in tqdm(filtered_listings):
try:
d = detail_query(listing.identifier)
with open(listing.path_detail_json(), "w") as f:
@ -16,5 +18,3 @@ for listing in tqdm(Listing.get_all_listings()):
except:
print("Failed at: ", listing.identifier)
raise
print('crawled new: ', counter)