# Scrape Yelp

**URL:** <https://forum.seocontentmachine.com/t/scrape-yelp/281>\
**Category:** workflow\
**Tags:** dynamic-scraper\
**Created:** [May 21, 2024, 10:22am UTC](https://forum.seocontentmachine.com/t/scrape-yelp/281 "2024-05-21T10:22:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://forum.seocontentmachine.com/user_avatar/forum.seocontentmachine.com/tim/32/486_2.png) [@Tim](https://forum.seocontentmachine.com/u/Tim)\
**Post date:** [May 21, 2024, 10:22am UTC](https://forum.seocontentmachine.com/t/scrape-yelp/281/1 "2024-05-21T10:22:35Z")

</div>

## 1. Create Dynamic Scraper

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/40403f712b391358f5941ee816a60bbce1d30be4.png)

## 2. Load Yelp

Click picker

Hover over items you want to scrape

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/41a46279a4a63e9c040c476fe305cf3dc507c871.png)

## 3. Find parent

Find the parent selector

Select the element that contains the elements we want to scrape

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/7c6e4b6ccedbb58ffa29c468218be250c5657996.png)

For yelp the parent class selector = **.y-css-1lqhm3w**

Visually we can see green box containing the details of one result

Notice also the count of items is 10, matching results per page

Add this selection as ‘%parent%’ so we can keep track of it

## 4. Add details

Capture the details of each result

Eg: Result name

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/58a103feb57348ae913aa72e93a994338f2a5084.png)

The class = **.y-css-12ly5yx**

Click Add

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/782c6bfee0634f317927f2f3606e00ae81286534.png)

Data count is 12

It should be 10 per page

Copy and paste parent = **.y-css-1lqhm3w**

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/f51173215a57e9b8df043600ff6e30278d23a5f1.png)

Data count is correct at 10

Click Data to verify content

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/4d92736849f8413a6bd36fac4cdeb3a728b7f9b6.png)

Name the item something meaningful eg %name%

Switch Export to CSV

You can see a preview of CSV table data

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/c997c59bd94a4d1257c5f0fe30d53d7c5449e745.png)

Repeat to find rest of items

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/49445e0baba84fc825821ffd1dc0ab8524cf8126.png)

**Why use parent selectors?**

Notice how not all results have a rating

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/d41f737db4c2380f6913a3e57570903d6852a58d.png)

If we don’t use parent to contain results it looks like this

- 

- Selectors find extraneous data eg: ‘Yelp for Business’ in rating column

- Unable to correctly match review score with proper result eg ‘Munster Construction’ has 5.0 rating, but in reality result has no rating. 

Always find the parent element containing the data we want to scrape

This will even work for finding data in tables

The parent selector can be as simple as ‘table’

## 5. Paging results

Click ‘Add current page’

Current yelp page is added to target list

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/a82057f387225d9f494bdf8de2d6334c6d178582.png)

Disable the picker

Now we can interact with the page

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/218b6619bd23bde9d0a78b32dba4bc489b937b32.png)

Scroll down to find the ‘Next’ page button

Click on it

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/ce7c97b1059e4f335fab4f043b0f05dacb08c305.png)

Notice the url bar changed

There is now a start=10 in the url

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/db825278a97b1a07995aa3116abc75edfc826305.png)

Click next page again

Notice its start=20

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/f5c8d341cf1b6ffdf7b37fdcbcbd7a9663fcfb5a.png)

We can extrapolate to create list of urls with start=10,20,30,etc

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/c988d3bdd3d7d229b18ee21bba7558471b60e7c3.png)

## Sample

 ![image](https://forum.seocontentmachine.com/uploads/default/original/1X/c995506bb27997be9715917eee045e9d09191f7e.png)

## Project

[Yelp.zip](https://forum.seocontentmachine.com/uploads/short-url/nGQGSXkC01trIztvdvgeWEGsnL8.zip) (1.4 KB)
