In our periodic effort to keep track of Walmart.com's progress towards world eCommerce domination compared to Amazon, here is the data from the Top 10 product categories sold on Walmart.com. This is similar to the Top 10 product categories for…
In this article, we will show you how to scrape product details and pricing data from Walmart.com category pages, using a Chrome extension called Web Scraper.
What data are we extracting from Walmart?
For this tutorial we will only extract the following fields from the product listing page:
- Product Name
- Number of Reviews
Below is an annotated screenshot of the data fields we will be extracting:
- Google Chrome Browser – You will need to download the Chrome browser. The extension requires Chrome 49+.
- Web Scraper Chrome Extension – The Web Scraper extension can be downloaded from the Chrome Web Store. After downloading the extension you will see a spider icon in your browser toolbar.
Import Walmart Scraper
Using the extension, you can create a sitemap that shows how the website should be traversed and what data should be extracted. With the sitemaps, you can navigate the site any way you want and the data can be later exported as a CSV.
We have configured the scraper already, you can get it below. The setup process is fairly simple, you can follow some of our other Web Scraper Extension tutorials or Documentation if you need to know more.
After you have installed the extension right-click anywhere on a page, go to ‘Inspect’ and the Developer Tools console will pop up. Click on the tab ‘Web Scraper’ and go on to the ‘Create new sitemap’ button and click on the ‘Import sitemap’ option. Now paste the JSON (given in the gist link below) in the Sitemap JSON box.
Walmart.com displays the product data by category. We are going to extract the product data in the link – https://www.walmart.com/browse/?cat_id=0&facet=special_offers%3AClearance. This will be our start URL.
This scraper can also work for sub-categories links such as:
You can scrape other URLs by editing the metadata. The GIF below shows you how:
In the Web Scraper toolbar, click on the Sitemap button (which would have changed to sitemap ‘your sitemap name’ now) and select the “Edit metadata’ option and paste the URL of the category page you would like to scrape.
Run the Scraper
To start scraping, go to the Sitemap and click ‘Scrape’ from the drop down. A new instance of Chrome will launch, enabling the extension to scroll and grab the data. Once the scrape is complete, the browser will close automatically and send a notification.
Download the Data
To download the scraped data, go to the Sitemap drop down > Export as CSV > Download Now. A CSV file will be downloaded with all the scraped data.
We can help with your data or automation needs
Turn the Internet into meaningful, structured and usable data
Disclaimer: Any code provided in our tutorials is for illustration and learning purposes only. We are not responsible for how it is used and assume no liability for any detrimental usage of the source code. The mere presence of this code on our site does not imply that we encourage scraping or scrape the websites referenced in the code and accompanying tutorial. The tutorials only help illustrate the technique of programming web scrapers for popular internet websites. We are not obligated to provide any support for the code, however, if you add your questions in the comments section, we may periodically address them.