A minimal Node.js example that scrapes Yelp business listings by calling the Yelp Business Scraper Apify actor. You don't build a scraper from scratch here — the actor handles the crawling, parsing, and anti-blocking, and you just call it and read the results.
- Calls the
piotrv1001/yelp-business-scraperApify actor - Passes a search input (a search term and location)
- Waits for the run to finish
- Fetches the results from the run's dataset
- Prints each business listing to the console
- Node.js 18 or newer
- An Apify account (free tier works)
- Your Apify API token — find it in the Apify Console
npm installCopy the example env file and add your Apify API token:
cp .env.example .envThen edit .env:
APIFY_TOKEN=your_apify_token_herenpm startimport { ApifyClient } from 'apify-client';
import 'dotenv/config';
// Initialize the ApifyClient with your Apify API token
// Set APIFY_TOKEN in your .env file (copy .env.example to get started)
const client = new ApifyClient({
token: process.env.APIFY_TOKEN,
});
// Prepare Actor input
const input = {
"search": "Sushi",
"location": "New York, NY"
};
// Run the Actor and wait for it to finish
const run = await client.actor("piotrv1001/yelp-business-scraper").call(input);
// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
console.dir(item);
});
// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docsSee sample-output.json for a full example of what the actor returns. Each business listing includes key fields such as:
name,alias,url— business identity and Yelp pagerating,reviewCount,reviewCountText— review metricspriceRange,categories,neighborhood— classificationreviewSnippet,thumbnail— a preview review and imagephone,address,website— contact detailsrank,scrapedAt— result position and timestamp
- Build a local restaurant or business directory
- Generate sales leads from businesses in a target city
- Monitor ratings and review counts of competitors
- Enrich a CRM with phone numbers, addresses, and websites
- Power market research on a category or neighborhood
Open the Yelp Business Scraper on Apify
- Blog post: How to Scrape Yelp Business Listings
MIT
