Skip to content
Advertisement

Scraping search results off of Sportchek with Beautiful Soup 4 to find prices

So I’m trying to web scrape search results from Sportchek with BS4, specifically this link “https://www.sportchek.ca/categories/men/footwear/basketball-shoes.html?page=1”. I want to get the prices off of the shoes here and put them all into a system to sort it, however, to do this I need to get the prices first and I cannot find a way to do that. In the HTML, the class is product-price-text but I can’t glean anything off of it. At this point, getting even the price of only 1 shoe would be fine. I just need help on scraping anything class-related on BS4 because none of it works. I’ve tried

print(soup.find_all("span", class_="product-price-text"))

and even that won’t work so please help.

Advertisement

Answer

The data is loaded dynamically via JavaScript. You can use the requests module to load it:

JavaScript

Prints:

JavaScript

EDIT: To extract the API Url:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement