# Yellow Pages Ghana Scraper - Ghana Business Directory (`crawlerbros/ghana-yello-scraper`) Actor

Scrape Yellow Pages Ghana, a free business directory covering 34,000+ Ghanaian businesses. Search by keyword and/or location, or fetch profiles by URL. Get names, addresses, categories, and source links.

- **URL**: https://apify.com/crawlerbros/ghana-yello-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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/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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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 Ghana Scraper - Ghana Business Directory

Scrape **Yellow Pages Ghana** (yellowpages.com.gh) — a free business directory covering 34,000+ Ghanaian businesses. Search by keyword and/or location, or fetch full business profiles by direct URL, and get names, addresses, categories, and source links. No login, no cookies, no API key required.

### Data Source & Usage Notes

**Read this before running a large job.**

- **No login required for search.** The source is a modern server-rendered directory with no account wall on search or business profile pages.
- **Phone numbers are not included.** Yellow Pages Ghana gates real phone numbers behind an interactive "Show phone numbers" challenge (a Cloudflare Turnstile CAPTCHA) on both search-result cards and business profile pages — only a masked placeholder (e.g. `026 XXX XXXX`) is ever present in the page's HTML. This is not something a zero-cost automated scraper can solve, so the field is omitted rather than emitted as a fake/masked value. If you need a specific business's phone number, visit its `sourceUrl` directly and click "Show number" yourself.
- **Conservative by design.** The actor only ever uses Apify's free datacenter (AUTO) proxy group — never a paid residential proxy.
- **Not affiliated with Yellow Pages Ghana.** This is an independent third-party tool using the source's own public, no-login search.

### What this actor does

- **Two modes:** `search` (keyword and/or location) and `detail` (direct business profile URLs)
- **Combine keyword + location** for precise local searches (e.g. "restaurant" in "Accra"), or search either alone
- **Sort by** relevance (the site's own order) or name (A-Z)
- **Full business profiles** (`fetchDetails: true` or `mode: "detail"`) — confirmed address and the full category list for a business, both parsed from the profile page
- **Empty fields are omitted** — you only ever see fields that were actually found for a business

### Output per business

- `businessId`, `name`, `sourceUrl` — canonical Yellow Pages Ghana profile URL
- `category` — primary category, `categories[]` — full category list (profile fetched only)
- `website` — the business's own website domain, when the listing shows one (search results only)
- `searchQuery`, `searchLocation` — the search parameters used
- `address`, `city`, `country` (always `"Ghana"`)
- `recordType: "business"`, `scrapedAt`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `search` | `search` or `detail` |
| `query` | string | `restaurant` | mode=search — business type/keyword/name |
| `location` | string | `Accra` | mode=search — city/town, optional |
| `sortBy` | string | `relevance` | `relevance` / `name` |
| `fetchDetails` | boolean | `false` | Also visit each result's profile page for confirmed address + full category list |
| `businessUrls` | array | – | mode=detail — direct profile URLs |
| `maxItems` | int | `20` | Hard cap (1–1000) |

#### Example: search by keyword and location

```json
{
  "mode": "search",
  "query": "hotel",
  "location": "Kumasi",
  "maxItems": 25
}
````

#### Example: browse a location with no keyword

```json
{
  "mode": "search",
  "query": "",
  "location": "Tema",
  "maxItems": 50
}
```

#### Example: fetch business profiles by URL

```json
{
  "mode": "detail",
  "businessUrls": [
    { "url": "https://yellowpages.com.gh/business/4-aces-restaurant-434568" }
  ]
}
```

### Use cases

- **Market research** — find every business of a given type in a Ghanaian city
- **Lead generation** — build a list of business names, categories, and addresses for outreach (phone lookup done manually per the note above)
- **Company existence verification** — confirm a business is listed and see its stated category and location
- **Local competitor analysis** — see what's already operating in a given city/category

### FAQ

**What's the data source?** Yellow Pages Ghana's own free public business directory at `yellowpages.com.gh`. This actor is an independent third-party tool and is not affiliated with Yellow Pages Ghana.

**Why isn't there a phone number field?** The source gates real phone numbers behind an interactive CAPTCHA challenge on every page that would show one — there's no way to extract a real number without solving that challenge, which this actor does not do (see Data Source & Usage Notes above). Visit the business's `sourceUrl` and click "Show number" to get it manually.

**Why did my run return 0 results?** The query genuinely has no match, or the keyword is too narrow. Try a broader keyword or drop the location filter.

**How fresh is the data?** Real-time — the search reflects the directory's database as of the moment of the search.

# Actor input Schema

## `mode` (type: `string`):

Search by keyword/business type and/or location, or fetch business profiles from direct Yellow Pages Ghana URLs.

## `query` (type: `string`):

Business type, category, or name to search for, e.g. 'restaurant', 'plumber', 'hotel' (mode=search). Combine with Location to narrow results, or leave blank to browse a location only.

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

Filter results to a specific Ghanaian city or town, e.g. 'Accra', 'Kumasi' (mode=search). Optional -- combine with Search keyword, or leave Search keyword blank to browse everything in this location.

## `sortBy` (type: `string`):

How to order search results. The site itself only returns its own relevance order, so 'name' is applied client-side across the fetched batch.

## `fetchDetails` (type: `boolean`):

For each search result, also visit its business profile page to collect the full category list and confirmed address. Slower -- one extra request per result.

## `businessUrls` (type: `array`):

Direct Yellow Pages Ghana business profile URLs to fetch, e.g. https://yellowpages.com.gh/business/4-aces-restaurant-434568. Use the 'sourceUrl' field from search results.

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

Hard cap on the number of business records to return.

## Actor input object example

```json
{
  "mode": "search",
  "query": "restaurant",
  "location": "Accra",
  "sortBy": "relevance",
  "fetchDetails": false,
  "businessUrls": [],
  "maxItems": 20
}
```

# Actor output Schema

## `businesses` (type: `string`):

Dataset containing all scraped Yellow Pages Ghana business listings.

# 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 = {
    "mode": "search",
    "query": "restaurant",
    "location": "Accra",
    "sortBy": "relevance",
    "fetchDetails": false,
    "businessUrls": [],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/ghana-yello-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 = {
    "mode": "search",
    "query": "restaurant",
    "location": "Accra",
    "sortBy": "relevance",
    "fetchDetails": False,
    "businessUrls": [],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/ghana-yello-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 '{
  "mode": "search",
  "query": "restaurant",
  "location": "Accra",
  "sortBy": "relevance",
  "fetchDetails": false,
  "businessUrls": [],
  "maxItems": 20
}' |
apify call crawlerbros/ghana-yello-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Yellow Pages Ghana Scraper - Ghana Business Directory",
        "description": "Scrape Yellow Pages Ghana, a free business directory covering 34,000+ Ghanaian businesses. Search by keyword and/or location, or fetch profiles by URL. Get names, addresses, categories, and source links.",
        "version": "1.0",
        "x-build-id": "pYVkbU2D7nSCajNRv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~ghana-yello-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-ghana-yello-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/crawlerbros~ghana-yello-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-ghana-yello-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/crawlerbros~ghana-yello-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-ghana-yello-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": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "search",
                            "detail"
                        ],
                        "type": "string",
                        "description": "Search by keyword/business type and/or location, or fetch business profiles from direct Yellow Pages Ghana URLs.",
                        "default": "search"
                    },
                    "query": {
                        "title": "Search keyword",
                        "type": "string",
                        "description": "Business type, category, or name to search for, e.g. 'restaurant', 'plumber', 'hotel' (mode=search). Combine with Location to narrow results, or leave blank to browse a location only.",
                        "default": "restaurant"
                    },
                    "location": {
                        "title": "Location",
                        "type": "string",
                        "description": "Filter results to a specific Ghanaian city or town, e.g. 'Accra', 'Kumasi' (mode=search). Optional -- combine with Search keyword, or leave Search keyword blank to browse everything in this location.",
                        "default": "Accra"
                    },
                    "sortBy": {
                        "title": "Sort order",
                        "enum": [
                            "relevance",
                            "name"
                        ],
                        "type": "string",
                        "description": "How to order search results. The site itself only returns its own relevance order, so 'name' is applied client-side across the fetched batch.",
                        "default": "relevance"
                    },
                    "fetchDetails": {
                        "title": "Fetch full business profiles",
                        "type": "boolean",
                        "description": "For each search result, also visit its business profile page to collect the full category list and confirmed address. Slower -- one extra request per result.",
                        "default": false
                    },
                    "businessUrls": {
                        "title": "Business profile URLs (mode=detail)",
                        "type": "array",
                        "description": "Direct Yellow Pages Ghana business profile URLs to fetch, e.g. https://yellowpages.com.gh/business/4-aces-restaurant-434568. Use the 'sourceUrl' field from search results.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "title": "URL",
                                    "type": "string",
                                    "description": "Yellow Pages Ghana business profile URL."
                                }
                            }
                        },
                        "default": []
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Hard cap on the number of business records to return.",
                        "default": 20
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
