In this guide, you will learn how to web scrape products from the Bath & Body Works website, or any other e-commerce website that has a “load more” button.
Begin by downloading and registering your free account with ParseHub!
Bath & Body Works, LLC. was founded in 1990 in Ohio as a soap, candle, fragrance, lotion and gift retail store. The company now owns over 1,900 stores around the world, and has an e-commerce presence as well, which we will be scraping products from. With this tutorial, you will also be able to scrape other bath, body and beauty product websites.
Since this website has a load more button, rather than a next page button, you will learn how to use ParseHub to scrape e-commerce pages that have load more buttons!
Let’s begin scraping products!
Step 1: Project Setup
- Firstly, open ParseHub and log in.
- Click “New Project” to start a new project.
- Enter the Bath & Body Works URL you wish to scrape from, we will be scraping all candles with this URL: https://www.bathandbodyworks.ca/en/c/home-fragrance/all-candles/
- Hold Shift and click the PLUS(+) button next to the page selection, and choose Extract.
- Rename this Extract to “listingValue”.
- In the contents simply put a “0”, this will be needed later.
Step 2: Selecting Products
- Begin by clicking the PLUS(+) button next to your page selection and choose “Select”.
- Hover over the first product’s container, and click and hold CTR/CMD+1 until the whole div is outlined.
- Redo this step for the next product’s container to train the algorithm.
- Rename this selection to “product” on the left, expand it and delete the “name” extraction.
Step 3: Additional Product Details
- Firstly, click the list icon next to your product selection to see the new entries command.
- Click the PLUS(+) icon next to it and choose “Relative Select”.
- Click the first product container and then its name.
- Rename this selection on the left to “name”.
- Redo these steps for the description and the price, you can expand them as well and delete the URLs if you do not need them.
Step 4: Removing Scraped Products
- Begin by holding shift and clicking the PLUS(+) button next to the product selection.
- Choose “Extract” and rename it to “remove”.
- Under the Extract drop-down, choose “Delete element from page”.
- Click shift again and click the PLUS(+) button next to your product selection.
- Choose “Extract” again and this time name it “listingValue”, just as we did in the setup.
- In the value, put a 1 this time, to notify ParseHub that we have extracted all the products on this page.
Step 5: Pagination
- Begin by holding shift and click the PLUS(+) button next to Select page.
- Choose “Conditional” and in the expression write listingValue, this will check if it’s 1, as in true, and will continue to load the next set of products!
- Click the PLUS(+) button next to conditional and choose “Select”.
- Click the Load More button to extract it, rename it to pagination.
- Expand it and delete the extraction.
- Click the PLUS(+) button next to pagination and choose “Click”.
- Choose “Yes” as this is going to a “new page”.
- Finally keep the number of pages as zero, to scrape every product available, and click “Repeat Current Template”.
Step 6: Begin Bath & Body Works Scraping
We have now successfully created a conditional variable, extracted all products, removed them to load more products, and set up our project to scrape every single product available. We are now ready to scrape on ParseHub’s servers!
Click the green “Get Data” button on the left pane. You can Test, Run or Schedule your scrape. We chose Run to scrape every candle available on the website!
Here is what your data should look like:
Need help scraping a specific website for free? Contact our live chat support!
Happy Scraping! 💻