changing detail downloads to prefiltering first. Making the progress bar more accurate and frontloading
This commit is contained in:
parent
b16fee0648
commit
5305451fe8
1 changed files with 7 additions and 7 deletions
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue