How to scrape product data from Walmart.com

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:

  1. Product Name
  2. Price
  3. Rating
  4. Number of Reviews
  5. Image
  6. Shipping

Below is an annotated screenshot of the data fields we will be extracting:

walmart-data-fields-to-extract

Prerequisites

  • 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.

https://gist.github.com/scrapehero/f9eafcf27e794fb2bf43fd34403ad270
importing-the-sitemap-walmart-scraper

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:

editing-metadata-walmart-web-scraper-extension

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

running-the-scraper-walmart-web-scraper-extension

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.

 

download-the-data-walmart-web-extension

We can help with your data or automation needs

Turn the Internet into meaningful, structured and usable data


Please DO NOT contact us for any help with our Tutorials and Code using this form or by calling us, instead please add a comment to the bottom of the tutorial page for help

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.

 

Posted in:   Web Scraping Tutorials

Comments or Questions?

Turn the Internet into meaningful, structured and usable data   

Enjoying our Tutorials?

Subscribe to our weekly updates on the latest tutorials in Web Scraping and Data Extraction

ScrapeHero Logo

Can we help you get some data?