123456789101112131415161718192021 |
- from .scrapper import scrape_reviews
- from .utils import get_max_date, store_into_database
- from .models import YelpLocation
- def store_yelp_reviews(location, n_pages):
- location_url = location.url
- max_date = get_max_date(location)
- reviews = scrape_reviews(
- location_url=location_url,
- max_date=max_date,
- n_pages=n_pages
- )
- if reviews:
- store_into_database(reviews, location)
- def populate_reviews():
- locations = YelpLocation.objects.all()
- for yl in locations:
- store_yelp_reviews(yl, 1)
|