Scraping task code refactoring