Move guts of scrape.js to a module that can be unit tested (lib/scraper)