|
@@ -48,7 +48,8 @@ def store_into_database(reviews, location):
|
|
|
def populate_yelp_reviews():
|
|
|
yelp_locations = YelpLocation.objects.all()
|
|
|
for yl in yelp_locations:
|
|
|
- reviews = scrape_reviews(location_url=yl.url, n_pages=2)
|
|
|
- store_into_database(reviews, yl)
|
|
|
+ reviews = scrape_reviews(location_url=yl.url, n_pages=1)
|
|
|
+ if reviews:
|
|
|
+ store_into_database(reviews, yl)
|
|
|
# pause for 30-60 sec to make request more human-like.
|
|
|
sleep(random.randint(30, 60))
|