scraping code for API