# Yellow Pages Scraper (`kawsar/yellow-pages-scraper`) Actor

Yellow Pages scraper that pulls local business listings from yellowpages.com, so sales teams and researchers get business names, phones, addresses, and ratings without the manual work.

- **URL**: https://apify.com/kawsar/yellow-pages-scraper.md
- **Developed by:** [Kawsar](https://apify.com/kawsar) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Yellow Pages Scraper: Extract Local Business Listings from yellowpages.com

Yellow Pages scraper that pulls business listings from yellowpages.com. Give it a search term and a city, and it returns names, phones, addresses, websites, star ratings, and categories in a clean dataset.

Works for any business type: plumbers, dentists, restaurants, lawyers, electricians, contractors. It pages through results automatically and can pull up to 1000 listings per run.

### Use cases

- Sales prospecting: build lead lists of local businesses by industry and city
- Competitor research: count and profile businesses in an area before opening a new location
- Directory building: populate a business database for a specific region and category
- Marketing outreach: collect phone numbers and websites for outreach campaigns
- Data enrichment: add phone, address, and rating data to existing business records

### What data does this actor extract?

Each listing returns:

```json
{
    "businessName": "Ritz Plumbing Heating, Air & Electrical",
    "phoneNumber": "(323) 452-4915",
    "streetAddress": "1355 S La Brea Ave",
    "city": "Los Angeles",
    "stateAbbr": "CA",
    "zipCode": "90019",
    "fullAddress": "1355 S La Brea Ave, Los Angeles, CA 90019",
    "website": "http://www.ritzplumbinginc.org/",
    "categories": ["Plumbers", "Heating Contractors & Specialties", "Air Conditioning Contractors & Systems"],
    "rating": 5.0,
    "reviewCount": 2,
    "yearsInBusiness": 95,
    "listingUrl": "https://www.yellowpages.com/los-angeles-ca/mip/ritz-plumbing-heating-air-electrical-9270807",
    "searchTerms": "plumber",
    "searchLocation": "Los Angeles, CA",
    "scrapedAt": "2025-01-15T09:32:11.452Z",
    "error": null
}
````

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `searchTerms` | string | required | Type of business to search (e.g. plumber, dentist, pizza restaurant) |
| `location` | string | required | City and state (e.g. Los Angeles, CA or Chicago, IL) |
| `maxPages` | integer | 1 | Number of result pages to scrape. Each page has up to 30 listings. |
| `maxItems` | integer | 100 | Maximum number of listings to return per run (up to 1000). |
| `requestTimeoutSecs` | integer | 30 | Per-request timeout in seconds. |

#### Example input

```json
{
    "searchTerms": "plumber",
    "location": "Los Angeles, CA",
    "maxPages": 3,
    "maxItems": 90
}
```

### Output

The actor stores results in an Apify dataset. Each row is one business listing with the fields shown above.

| Field | Type | Description |
|-------|------|-------------|
| `businessName` | string | Business name as listed on Yellow Pages |
| `phoneNumber` | string | Primary phone number |
| `streetAddress` | string | Street address |
| `city` | string | City |
| `stateAbbr` | string | Two-letter state code |
| `zipCode` | string | ZIP code |
| `fullAddress` | string | Complete address string |
| `website` | string | Business website URL |
| `categories` | array | Business categories |
| `rating` | number | Star rating out of 5.0 |
| `reviewCount` | integer | Number of reviews |
| `yearsInBusiness` | integer | Years in business (when listed) |
| `listingUrl` | string | Direct link to the YP listing |
| `searchTerms` | string | Search term from input |
| `searchLocation` | string | Location from input |
| `scrapedAt` | string | ISO 8601 scrape timestamp |
| `error` | string | Error message if parsing failed |

### FAQ

**What search terms can I use?**
Any business category: plumber, dentist, lawyer, pizza, auto repair, electrician, HVAC, and so on. Use the same terms you would type into the Yellow Pages search box.

**How many results are on each page?**
Yellow Pages shows up to 30 listings per page. Set `maxPages` to 3 to get up to 90 listings, or increase `maxItems` to cap the total.

**Will this work for any US city?**
Yes. Enter the city and state in the `location` field (e.g. Chicago, IL or Miami, FL). Yellow Pages covers all US cities and many Canadian locations.

**What if a field is missing for some listings?**
Not every listing has a website, rating, or years-in-business entry. Missing fields return null. The `error` field is only set if the listing failed to parse.

**Can I run multiple searches at once?**
Run the actor multiple times with different search terms and locations. Use the Apify scheduler to run on a recurring basis.

# Actor input Schema

## `searchTerms` (type: `array`):

One or more business types to search (e.g. plumber, dentist, pizza restaurant). Enter one per line.

## `locations` (type: `array`):

One or more cities and states to search in. Enter one per line (e.g. Los Angeles, CA).

## `maxPages` (type: `integer`):

Number of result pages to scrape per search term + location combination. Each page has up to 30 listings.

## `maxItems` (type: `integer`):

Maximum number of listings to collect per search term + location combination. Each combination runs independently up to this limit.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## Actor input object example

```json
{
  "searchTerms": [
    "plumber",
    "electrician"
  ],
  "locations": [
    "Los Angeles, CA",
    "New York, NY"
  ],
  "maxPages": 1,
  "maxItems": 100,
  "requestTimeoutSecs": 30
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "plumber"
    ],
    "locations": [
        "Los Angeles, CA"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kawsar/yellow-pages-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/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["plumber"],
    "locations": ["Los Angeles, CA"],
}

# Run the Actor and wait for it to finish
run = client.actor("kawsar/yellow-pages-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "plumber"
  ],
  "locations": [
    "Los Angeles, CA"
  ]
}' |
apify call kawsar/yellow-pages-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=kawsar/yellow-pages-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Yellow Pages Scraper",
        "description": "Yellow Pages scraper that pulls local business listings from yellowpages.com, so sales teams and researchers get business names, phones, addresses, and ratings without the manual work.",
        "version": "0.0",
        "x-build-id": "wjQebs7qK3zo0DEM2"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/kawsar~yellow-pages-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-kawsar-yellow-pages-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/kawsar~yellow-pages-scraper/runs": {
            "post": {
                "operationId": "runs-sync-kawsar-yellow-pages-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/kawsar~yellow-pages-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-kawsar-yellow-pages-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "searchTerms",
                    "locations"
                ],
                "properties": {
                    "searchTerms": {
                        "title": "Search terms",
                        "type": "array",
                        "description": "One or more business types to search (e.g. plumber, dentist, pizza restaurant). Enter one per line.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "locations": {
                        "title": "Locations",
                        "type": "array",
                        "description": "One or more cities and states to search in. Enter one per line (e.g. Los Angeles, CA).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPages": {
                        "title": "Max pages per search",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Number of result pages to scrape per search term + location combination. Each page has up to 30 listings.",
                        "default": 1
                    },
                    "maxItems": {
                        "title": "Max items total",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of listings to collect per search term + location combination. Each combination runs independently up to this limit.",
                        "default": 100
                    },
                    "requestTimeoutSecs": {
                        "title": "Request timeout (seconds)",
                        "minimum": 5,
                        "maximum": 120,
                        "type": "integer",
                        "description": "Per-request timeout in seconds.",
                        "default": 30
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
