refactored scraper.py so there's less code and it uses less memory