Yelp is full to the brim with customer reviews.
These help businesses understand the performance of their business as it is perceived by their customers.
The data behind these reviews can also be used for competitor research.
Today, we will go over how to scrape customer reviews from Yelp.
Yelp and Web Scraping
A web scraper will allow you to choose the specific business and reviews you’d like to scrape from Yelp. You can then download these as an Excel or JSON file for further analysis.
For this example, we will use ParseHub, a free and powerful web scraper that can scrape any website.
Make sure to download and install ParseHub for free before getting started.
How to scrape Yelp reviews
It’s now time to get scraping. For this example, we will scrape reviews from a Panera Bread location.
- Boot up ParseHub, click on New Project and enter the URL you will be scraping data from. ParseHub will now render the page inside the app and let you make your first selection.
- Scroll down to the reviews section of the page and click on the name of the first user. It will be highlighted in green to indicate it has been selected.
- The rest of the names on the pages will be highlighted in yellow. Click on the second one on the list to select them all.
- In the left sidebar, rename your selection to user.
- Click on the PLUS (+) sign next to your user selection and choose the Relative Select command.
- Using the Relative Command, click on the name of the first user on the list and then on their location. In the left sidebar, rename your selection to location.
- Repeat steps 5-6 to add other data such as data of the review and the content of the review. Rename your selections accordingly.
- When adding the rating score, you will notice ParseHub does not extract any data by default. To solve this, select your rating relative select and expand it by clicking the icon next to it.
- Click on your rating extraction and on the extract drop-down select aria-label Attribute. ParseHub will now pull the rating data for every review.
- After adding all other elements your project should look like this:
Adding Pagination
ParseHub is now pulling all reviews and data from the first page of reviews.
We will know set it up to scrape additional pages.
- Click on the PLUS (+) sign next to the page selection and choose the select command.
- Scroll all the way down to the bottom of the page and select the “next page” arrow at the bottom of the page. Rename your selection to next.
- Expand your next selection and delete the extraction under it.
- Click on the PLUS (+) next to your next selection and select the click command.
- A pop-up will appear asking you if this a next page button. Click on “yes” and enter the number of times you’d like to repeat this process. In this case, we will repeat it 3 times.
Running your scrape
It is now time to run your scrape. To do this, click on the green Get Data button on the left sidebar.
You will now be able to either Test, Run or Schedule your scraping project. In this case, we will run it right away.
ParseHub will now go and extract the data you’ve requested from Yelp’s website. Once the scrape is complete, you will be able to download your data set as an Excel or JSON file.
Closing Thoughts
You know now how to scrape and extract reviews from Yelp.
However, you might be interested in downloading additional data from Yelp, such as business addresses and phone numbers.
To do this, check out our in-depth guide on how to scrape Yelp data including phone numbers, addresses and more.
Happy Chatting!