Walgreens was first founded in 1901 in Chicago, originally as a family-owned grocery store. It has since grown to become USA’s second-largest pharmacy, right after CVS. There are over 9,000 Walgreens locations, serving over 10 million customers daily. Although Walgreens is a pharmacy, they also sell a large variety of products in-store and on their website. These products include over-the-counter drugs, vitamins, supplements, and even household goods, electronics and toys.

In this guide, we will show you how to scrape Walgreens products, with ParseHub, our free web scraper. You can use the same steps to scrape Walgreens locations and other data on their website.

Let’s start scraping!

Scraping Products

  1. Start by opening ParseHub on your PC, Mac or Linux system.
  2. Create a new project by clicking on the “New Project” button.
  3. Enter the Walgreens URL you would like to scrape from, we will be scraping multivitamins with this URL: https://www.walgreens.com/store/c/productlist/N=360567-4294815983-4294896499
  4. Once the page loads, you should see the products populate in the embedded browser.
  5. Click the first product’s name to extract it.
  6. Click the next product’s name to train the ParseHub algorithm.
  7. All products on the first page will now be extracted, as seen in the data preview below.
  8. Rename this extraction on the left to “product”.

Scraping Prices

Using ParseHub’s Relative Select tool, we can extract additional data from each product.

  1. First, click the PLUS(+) button next to your “product” extraction from the last step.
  2. Click “Relative Select” and click the first product’s name.
  3. Move the arrow to the price, and click to extract it.
  4. Redo this process on the next product to train the algorithm.
  5. Rename this selection to “price” on the left.
  6. Expand the selection and remove the URL extraction as the data is redundant.

Scraping Ratings

  1. Ratings are scraped similarly to prices but have an extra step. Start with the “Relative Select” tool again on your product selection.
  2. Click the first product name and then the star ratings, it should be an IMG tag.
  3. Click the next product name and its star ratings to train the algorithm.
  4. Rename this selection on the left to “rating”.
  5. Expand the selection and remove the redundant URL extraction.
  6. You may notice the ratings are gif files and not the star ratings out of 5, click the Extract rating tab and under the Extract drop down, choose title Attribute.
  7. Finally, your product ratings should be shown in the live preview, out of 5!

Pagination

To scrape products from multiple or all product pages, we need to use ParseHub’s pagination.

  1. Begin by navigating to the bottom of the webpage until the page navigation is visible.
  2. Click the PLUS(+) button next to the “page” tab, not to be confused with the earlier “product” tab.
  3. Click “Select” and click the next page button.
  4. Rename this selection to “pagination” and expand it to delete the empty extraction.
  5. Now click the PLUS(+) button next to your “pagination” selection and choose “Click”.
  6. On the popup, click “Yes” as this is a next page button.
  7. You can choose how many additional pages you wish to scrape, if you put 1, then 2 pages will be scraped in total.

Begin Scraping

At the time of this guide, there are no blocks when scraping Walgreens. If you end up with empty results, you may be getting blocked. You can fix this with ParseHub’s IP Rotation, a paid plan feature.

If you followed along, you should now have extracted products, their prices and their ratings using the Relative Select tool. Pagination is also set up, allowing you to scrape large amounts of data, beyond the first page!

To begin scraping, click the green “Get Data” button. You may test, schedule or run your scrape.

Your data should look like this if you followed along correctly:

If your data is looking different, is empty or you’re running into issues, reach out to our live chat support, at ParseHub.com, our expert web scrapers will help you out!

Happy Scraping!