# Yellowpage Scraper (`dainty_screw/yellowpage-scraper`) Actor

Yellowpages Scraper is a robust tool designed to scrape business information from Yellowpages. It efficiently extracts essential details such as business names, addresses, phone numbers, categories, and more.

- **URL**: https://apify.com/dainty_screw/yellowpage-scraper.md
- **Developed by:** [codemaster devops](https://apify.com/dainty_screw) (community)
- **Categories:** Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 141 total users, 1 monthly users, 81.3% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.50 / 1,000 results

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

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Yellow Pages Scraper

Extract public **yellowpages.com (US)** business listings: name, phone, address, website, categories, rating, review count and public review snippet when present. Rows include source URL, fetch time, extraction method and deduplication key. Missing source fields are omitted.

### Quick start

```json
{
  "runMode": "compliant",
  "startUrls": [{ "url": "https://www.yellowpages.com/los-angeles-ca/dentists" }],
  "maxItems": 10,
  "maxPages": 4,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "US"
  }
}
```

Fresh inputs use compliant mode, the category-page example, 10 results, 4 page attempts, and US residential proxies. API input `{}` uses the same runtime defaults. Explicit custom URLs/searches replace the sample; explicit proxy choices are preserved. Residential traffic is billable. To opt out deliberately, set `proxyConfiguration` to `{ "useApifyProxy": false }`.

After rebuilding from this branch, use **Reset input** in the Apify Input form to load its current prefilled example. A build does not overwrite previously saved Actor inputs, task inputs, or an earlier run's input. Replace any old authorized-mode sample unless you intend to supply your real legal-basis reference. The `run_start` log reports proxy mode, groups and country; `channel: "http"` describes the crawler, not proxy usage.

The `compliant` label describes a URL guard, not a legal determination. It blocks `/search`, including pagination into that path. Review the site's terms and your intended use. Search/location requires `runMode: "authorized"` and your actual uppercase PREFIX-IDENTIFIER `legalBasisReference`. A reference does not grant permission.

HTTP, credentials in URLs, custom ports, and domains outside yellowpages.com are rejected. `allowedHosts` narrows supported hosts; it does not enable unrelated sites. HTTP redirects are disabled. Browser resources use the same policy, which may reduce rendered coverage. DNS answers are not pinned; trusted Yellow Pages DNS/proxy resolution remains a boundary.

### Output and diagnostics

Observed sample from private verification run `fLh6m60K0kOeGd7rg`:

```json
{
  "name": "Jose T. Sauz D.d.s",
  "phone": "(213) 483-8754",
  "website": "http://josetsauzdds.localsearch.com/",
  "sourceUrl": "https://www.yellowpages.com/los-angeles-ca/dentists",
  "channel": "http"
}
```

Export the default dataset as JSON, CSV or Excel. `confidence` identifies extraction method, not verification. `reviewSnippet` is an excerpt, not full review history. Phone normalization removes non-digits, including extension separators; it is not E.164 validation.

The Output tab links to listings and `RUN_SUMMARY`. Summary fields include parsed rows, pages, attempted requests, duplicates, failures, stop reason, and per-run failure dataset ID. Technical errors are kept out of business rows. All-failed runs fail visibly; mixed outcomes retain a partial summary. Unknown markup is an error; an explicit `.no-results` marker indicates an expected empty page.

### Limits and reliability

- `maxItems` caps rows. `maxPages` caps combined HTTP/browser navigation attempts including retries. Browser resources/proxy traffic are additional work. Small page budgets may leave no attempt for fallback.
- HTTP runs first; blocked responses are then processed with Playwright. Fallback is best effort and cannot guarantee access through challenges.
- Pagination follows next-page links with URL/compliance checks. Retries and concurrency are bounded.
- State includes counters and emitted keys. Use fresh storage when upgrading from counters-only checkpoints. Dataset writes and checkpoints are not a cross-store transaction: abrupt crashes can produce duplicates on resurrection. Consumers should deduplicate by `dedupKey`.
- Abort/migration handlers persist diagnostics and request teardown. Hosted cancellation verification is tracked separately in `audit/STATUS.md`.

### Coverage and limitations

Supports US listing markup and business JSON-LD, including nested graph/item-list structures. Detail pages without supported JSON-LD may fail. Ghana, Nigeria, Kenya, Uganda and Canada are not implemented in the active runtime. Legacy regional configuration is not connected to the crawler.

No email discovery, mailbox verification, full review collection, geocoding, or paid enrichment. `withCoordinatesPlaceholder` emits null coordinates; `withTimestamp` adds a timestamp. Neither performs enrichment. No HTTP server or Standby interface.

Public pages need no login. Optional proxy credentials belong in proxy configuration, never start URLs. Code does not call `Actor.charge` or add per-result billing events. Charges depend on live Apify pricing and compute/proxy usage, even for zero rows. Begin with small budgets. No enrichment provider is called.

### Development and support

Use Node 22 or 24. Run `npm ci`, `npm test`, `npm run lint`, `apify validate-schema`, then `apify run --input-file audit/sample-input.json`. Set `APIFY_LOCAL_STORAGE_DIR` to isolated task storage to preserve evidence. CI verifies without deploying production.

For challenges or zero rows, inspect RUN_SUMMARY, failure dataset and logs. Proxies cannot guarantee access. Avoid unchanged retries of deterministic errors. Report sanitized input, run ID and summary in [GitHub issues](https://github.com/QuickLifeSolutions/Yellowpages_Scraper/issues), without tokens or proxy passwords.

# Changelog

This Actor's version history is a separate document: https://apify.com/dainty_screw/yellowpage-scraper/changelog.md

# Actor input Schema

## `runMode` (type: `string`):

Compliant mode blocks Yellowpages /search requests. Use Authorized mode only when you have a contractual or legal basis for scraping these endpoints.

## `legalBasisReference` (type: `string`):

Required in authorized mode. Must match PREFIX-IDENTIFIER (uppercase). Examples: CONTRACT-1234, TICKET-ABC-42.

## `search` (type: `string`):

Business category or search term. Must be paired with location. Only used in Authorized mode for /search endpoints.

## `location` (type: `string`):

Geographic location string (city, state, or ZIP). Must be paired with search term.

## `startUrls` (type: `array`):

Public yellowpages.com category/listing URLs. The example works with compliant mode. With no sources supplied, the runtime uses this example; an explicitly empty list requires search/location.

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

Hard cap on parsed records written to the default dataset.

## `maxConcurrency` (type: `integer`):

Maximum parallel requests for the HTTP (Cheerio) crawler.

## `maxRequestsPerMinute` (type: `integer`):

Global HTTP rate cap to reduce blocking.

## `browserMaxConcurrency` (type: `integer`):

Maximum parallel browser (Playwright) fallback requests.

## `browserMaxRequestsPerMinute` (type: `integer`):

Rate cap for the browser fallback crawler.

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

Per-request timeout before retry/failure handling.

## `useBrowserFallback` (type: `boolean`):

Process blocked HTTP requests with Playwright after the HTTP phase. Browser resources are restricted to allowed Yellow Pages hosts.

## `maxFallbackDepth` (type: `integer`):

Maximum HTTP-to-browser fallback hops per URL.

## `httpMaxRetries` (type: `integer`):

Retry attempts for HTTP crawler requests.

## `browserMaxRetries` (type: `integer`):

Retry attempts for browser crawler requests.

## `proxyConfiguration` (type: `object`):

US residential Apify Proxy is enabled by default for HTTP and browser requests. Proxy traffic is billable. Explicit direct connections and custom proxy URLs are supported.

## `extendOutputPreset` (type: `string`):

Optional output enrichment preset applied to each parsed listing.

## `failedDatasetName` (type: `string`):

Named dataset for failed requests (replay / debugging).

## `allowedHosts` (type: `array`):

Allowed yellowpages.com hosts. Other domains, HTTP, credentials, and custom ports are rejected. HTTP redirects are not followed.

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

Shared HTTP and browser navigation-attempt budget, including retries. Separate from maxItems.

## Actor input object example

```json
{
  "runMode": "compliant",
  "startUrls": [
    {
      "url": "https://www.yellowpages.com/los-angeles-ca/dentists"
    }
  ],
  "maxItems": 10,
  "maxConcurrency": 10,
  "maxRequestsPerMinute": 120,
  "browserMaxConcurrency": 4,
  "browserMaxRequestsPerMinute": 60,
  "requestTimeoutSecs": 30,
  "useBrowserFallback": true,
  "maxFallbackDepth": 1,
  "httpMaxRetries": 2,
  "browserMaxRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "extendOutputPreset": "none",
  "failedDatasetName": "FAILED_REQUESTS",
  "allowedHosts": [
    "www.yellowpages.com"
  ],
  "maxPages": 4
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "runMode": "compliant",
    "startUrls": [
        {
            "url": "https://www.yellowpages.com/los-angeles-ca/dentists"
        }
    ],
    "maxItems": 10,
    "maxConcurrency": 10,
    "maxRequestsPerMinute": 120,
    "browserMaxConcurrency": 4,
    "browserMaxRequestsPerMinute": 60,
    "requestTimeoutSecs": 30,
    "useBrowserFallback": true,
    "maxFallbackDepth": 1,
    "httpMaxRetries": 2,
    "browserMaxRetries": 1,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    },
    "extendOutputPreset": "none",
    "failedDatasetName": "FAILED_REQUESTS",
    "allowedHosts": [
        "www.yellowpages.com"
    ],
    "maxPages": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("dainty_screw/yellowpage-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 = {
    "runMode": "compliant",
    "startUrls": [{ "url": "https://www.yellowpages.com/los-angeles-ca/dentists" }],
    "maxItems": 10,
    "maxConcurrency": 10,
    "maxRequestsPerMinute": 120,
    "browserMaxConcurrency": 4,
    "browserMaxRequestsPerMinute": 60,
    "requestTimeoutSecs": 30,
    "useBrowserFallback": True,
    "maxFallbackDepth": 1,
    "httpMaxRetries": 2,
    "browserMaxRetries": 1,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
    "extendOutputPreset": "none",
    "failedDatasetName": "FAILED_REQUESTS",
    "allowedHosts": ["www.yellowpages.com"],
    "maxPages": 4,
}

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

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

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

```

## CLI example

```bash
echo '{
  "runMode": "compliant",
  "startUrls": [
    {
      "url": "https://www.yellowpages.com/los-angeles-ca/dentists"
    }
  ],
  "maxItems": 10,
  "maxConcurrency": 10,
  "maxRequestsPerMinute": 120,
  "browserMaxConcurrency": 4,
  "browserMaxRequestsPerMinute": 60,
  "requestTimeoutSecs": 30,
  "useBrowserFallback": true,
  "maxFallbackDepth": 1,
  "httpMaxRetries": 2,
  "browserMaxRetries": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "extendOutputPreset": "none",
  "failedDatasetName": "FAILED_REQUESTS",
  "allowedHosts": [
    "www.yellowpages.com"
  ],
  "maxPages": 4
}' |
apify call dainty_screw/yellowpage-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dainty_screw/yellowpage-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WY7Te6MZqaO5pUMkK/builds/Wns9BxMkZNxgKwURg/openapi.json
