How to scrape Yelp
Extract Yelp business names, ratings, categories, addresses and review counts as clean JSON, without fighting obfuscated markup or selector drift.
- Site:
- yelp.com
- Difficulty:
- Medium
- Rendering:
- JavaScript-rendered
- Anti-bot:
- Rate limiting, Bot detection, CAPTCHA
What you can extract from Yelp
These are the fields teams most often pull from yelp.com, and why a hand-written selector for each one tends to break over time.
| Field | Type | Why selectors break |
|---|---|---|
| name | string | The business name renders inside obfuscated, frequently rotated class names, so a hard-coded selector breaks within weeks of being written. |
| rating | number | Yelp shows the rating as a star-image aria-label rather than text, forcing brittle parsing of strings like "4.5 star rating" that change across locales. |
| category | string | Categories are a list of links whose container shifts position depending on which business attributes are present, so a fixed selector grabs the wrong element. |
| review_count | number | Review counts are localized and abbreviated, so the same selector returns "1,234 reviews", "1.234" or "1,2 K" for different visitors. |
| address | string | The address is rendered next to a map widget whose container is reused for hours and directions, so a position-based selector frequently grabs opening hours instead of the street address. |
| price_range | string | Price range is shown as a run of currency symbols rather than text, so a selector has to count glyphs and breaks whenever Yelp changes the icon markup or localizes the symbol. |
The schema-first approach
Instead of maintaining selectors, you hand Extracto a JSON schema describing the shape you want. Here is a schema that works for Yelp:
{
"name": "string",
"rating": "number",
"review_count": "number",
"category": "string",
"address": "string",
"price_range": "string"
} - 1
Describe the Yelp fields you want
Write a small JSON schema listing the fields to pull from yelp.com (for example name, rating, category). No CSS selectors or XPath needed.
- 2
Send the URL and schema to Extracto
POST the Yelp page URL and your schema to the Extracto API. Extracto renders the page in a real browser, handling JavaScript and dynamic content automatically.
- 3
Get schema-validated JSON back
Extracto returns JSON that matches your schema exactly, validated before it leaves the API, so your pipeline never receives broken or partial data.
Common pitfalls when scraping Yelp
- Yelp obfuscates and rotates its class names between releases, so selector-based scrapers need near-constant maintenance just to keep reading the same business fields.
- High-frequency requests trigger CAPTCHAs and IP blocks quickly, so any scraping must be polite and low-volume rather than a tight loop.
- Review text and reviewer names are personal data; collecting them without a legal basis creates compliance risk, so prefer aggregate fields like rating and review count.
Is it legal to scrape Yelp?
Yelp's Terms of Service prohibit scraping, and Yelp offers a Fusion API that is the sanctioned route for business data. Public business attributes such as name, category and rating are facts, but reviewer names and review text are personal data subject to GDPR and CCPA. If you scrape at all, stay on public pages, keep volume low, respect robots.txt, and avoid collecting personal information about reviewers. For production use, the Fusion API is strongly preferred.
Extracto follows robots.txt by default and rate-limits politely. You are responsible for compliance with Yelp's terms and applicable law (GDPR, CCPA) in your use case.