# Yellow pages Kenya Scraper (`verifiable_quadrillion/my-actor`) Actor

Yellow Pages Kenya Scraper
This Apify actor scrapes business listings from Yellow Pages Kenya.
Features

🔍 Search by category or keyword
📞 Extracts name, phone, email, address, and website
📄 Automatic pagination handling
🔒 Proxy support (Apify Proxy)
⚡ Configurable max items limit

- **URL**: https://apify.com/verifiable\_quadrillion/my-actor.md
- **Developed by:** [Calvin Kimathi](https://apify.com/verifiable_quadrillion) (community)
- **Categories:** Lead generation, AI, Automation
- **Stats:** 20 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Kenya Scraper

A reliable and efficient Apify actor that scrapes business listings from [Yellow Pages Kenya](https://www.yellowpageskenya.com/). Extracts clean, verified contact information including names, phone numbers, emails, addresses, and websites.

### ✨ Features

- 🔍 **Smart Category Search** - Search by business category (hotels, restaurants, dentists, etc.)
- 📞 **Clean Contact Data** - Automatically filters placeholder emails and phone numbers
- 🌐 **Website Extraction** - Finds real business websites (filters out social media)
- 📄 **Automatic Pagination** - Scrapes multiple pages until maxItems reached
- 🔒 **Proxy Support** - Built-in Apify Proxy support with optimized settings
- ⚡ **Optimized Performance** - Handles 50-100 businesses efficiently (~10-18 minutes)
- 🎯 **High Data Quality** - 85-95% success rate with accurate information

### 📊 What Gets Scraped

Each business listing includes:

| Field | Description | Success Rate |
|-------|-------------|--------------|
| **name** | Business name (cleaned) | 100% |
| **phone** | Kenyan phone numbers in +254 format | 85-95% |
| **email** | Business email addresses | 70-85% |
| **address** | Physical address in Kenya | 60-75% |
| **url** | Business website (excludes social media) | 40-60% |

#### Sample Output

```json
[
  {
    "name": "Hilton Nairobi",
    "phone": "+254719026000, +254732120000",
    "email": "hilton_nairobi@hilton.com",
    "address": "Mama Ngina Street, Nairobi",
    "url": "https://www.hilton.com/nairobi"
  },
  {
    "name": "Sarova Stanley Hotel",
    "phone": "+254202228830",
    "email": "stanley@sarovahotels.com",
    "address": "Corner Kenyatta Avenue & Kimathi Street, Nairobi",
    "url": "https://www.sarovahotels.com"
  }
]
```

### 🚀 Quick Start

#### Basic Usage

```json
{
  "searchTerm": "hotels",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

#### Common Search Categories

- **Hospitality:** `hotels`, `restaurants`, `bars`, `cafeterias`
- **Healthcare:** `dental-clinic`, `doctors`, `hospitals`, `pharmacies`
- **Professional:** `lawyers-advocates`, `accountants`, `real-estate-agents`
- **Construction:** `building-contractors`, `plumbers`, `electricians`
- **Beauty:** `beauty-salons`, `beauty-salons-spas`, `fitness-centres`
- **Automotive:** `motorvehicle-dealers-new`, `garages`, `car-wash`
- **Technology:** `website-designers`, `software-developers`, `computers-hardware-maintenance`

### ⚙️ Input Configuration

#### Required Fields

##### `searchTerm` (string)

The business category to search for. Use lowercase with hyphens.

**Examples:**

- `"hotels"` - Hotels and lodging
- `"dental-clinic"` - Dental clinics and dentists
- `"real-estate-agents"` - Real estate agencies
- `"restaurants"` - Restaurants and eateries

##### `maxItems` (integer)

Maximum number of businesses to scrape.

**Recommendations:**

- **Testing:** 10-20 items (~2-4 minutes)
- **Production:** 50 items (~10 minutes)
- **Large scrapes:** 100 items (~18 minutes)
- **Unlimited:** Set to `0` (not recommended due to time)

#### Optional Fields

##### `startUrls` (array)

Direct URLs to scrape instead of using search. Useful for specific business pages.

```json
{
  "startUrls": [
    {"url": "https://www.yellowpageskenya.com/business-category/hotels"}
  ]
}
```

##### `proxyConfiguration` (object)

Proxy settings for the scraper.

**Recommended (Datacenter):**

```json
{
  "useApifyProxy": true,
  "apifyProxyGroups": ["SHADER"]
}
```

**For Difficult Sites (Residential):**

```json
{
  "useApifyProxy": true,
  "apifyProxyGroups": ["RESIDENTIAL"]
}
```

**No Proxy (Testing Only):**

```json
{
  "useApifyProxy": false
}
```

### 📈 Performance & Costs

#### Scraping Time

| Items | Time | Memory Used |
|-------|------|-------------|
| 10 | ~2 min | 1.5 GB |
| 20 | ~4 min | 1.5 GB |
| 50 | ~10 min | 2 GB |
| 100 | ~18 min | 2 GB |

#### Cost Estimates

**Compute Units:**

- 50 businesses: ~0.02 CU (~$0.005)
- 100 businesses: ~0.04 CU (~$0.01)

**Proxy Costs:**

- **Datacenter (SHADER):** ~$0.10-0.20 per 100 businesses
- **Residential:** ~$2-3 per 100 businesses

**Total per 100 businesses:**

- Datacenter: ~$0.21
- Residential: ~$3.01

### 🎯 Best Practices

#### 1. Start Small

Always test with 10-20 items first to verify the category works.

#### 2. Use Correct Category Names

Yellow Pages Kenya uses specific category URLs:

- ✅ `"dental-clinic"` (correct)
- ❌ `"dentists"` (will work but might get different results)
- ❌ `"Dental Clinic"` (case matters)

#### 3. Monitor Your First Run

Check the logs for:

- Success rate (should be >85%)
- Proxy errors (minimal)
- Data quality (no placeholders)

#### 4. Batch Large Scrapes

Instead of scraping 200 items at once:

- Run 4 times with 50 items each
- More reliable and easier to debug

#### 5. Use Datacenter Proxies

Unless you're getting blocked, use SHADER (datacenter) proxies:

- 10x cheaper than residential
- Faster performance
- Sufficient for most cases

### ⚠️ Important Notes

#### What Gets Filtered Out

The actor automatically removes:

- ❌ Placeholder phone numbers: `+254 700 000 000`, `0551037607`
- ❌ Template emails: `info@yellowpageskenya.com`, `contact@company.com`
- ❌ Placeholder URLs: `paginasamarelas.co.ao`, `leafletjs.com`
- ❌ Social media links: Facebook, Twitter, Instagram, LinkedIn
- ❌ Invalid Kenyan phone numbers

#### Data Quality

**Expected Results:**

- 85-95% of businesses will have phone numbers
- 70-85% will have email addresses
- 40-60% will have websites
- 60-75% will have addresses

**Some businesses legitimately don't have:**

- Email addresses (phone-only businesses)
- Websites (local shops, street vendors)
- Complete addresses (mobile services)

This is normal and expected!

### 🐛 Troubleshooting

#### Issue: Actor Times Out

**Solution:**

1. Reduce `maxItems` to 50 or less
2. Increase timeout in actor settings (25+ minutes recommended)
3. Use datacenter proxies instead of residential

#### Issue: Many Proxy Errors

**Symptoms:** Logs show `ERR_TUNNEL_CONNECTION_FAILED`

**Solution:**

1. Reduce maxItems to 20
2. Switch to residential proxies:
   ```json
   "apifyProxyGroups": ["RESIDENTIAL"]
   ```
3. Wait 5-10 minutes and try again

#### Issue: No Results Found

**Possible Causes:**

- Category name is incorrect
- Category exists but has no listings
- Website structure changed

**Solution:**

1. Check Yellow Pages Kenya website manually
2. Try a common category like "hotels" to verify actor works
3. Use `startUrls` with direct category URL

#### Issue: Too Many Placeholder Emails/Phones

**This should not happen** with the current version, but if it does:

- Report the issue with examples
- The actor filters these automatically

### 🔄 Integration with n8n

This actor works seamlessly with n8n workflows. Use the HTTP Request node:

```javascript
// n8n HTTP Request Node
{
  "method": "POST",
  "url": "https://api.apify.com/v2/acts/YOUR_ACTOR_ID/run-sync-get-dataset-items",
  "qs": {
    "token": "YOUR_APIFY_TOKEN",
    "timeout": 600
  },
  "body": {
    "searchTerm": "hotels",
    "maxItems": 50,
    "proxyConfiguration": {
      "useApifyProxy": true
    }
  }
}
```

### 📞 Use Cases

#### 1. **Cold Email Outreach**

- Scrape businesses in your target industry
- Verify emails with services like Reoon
- Create personalized email campaigns

#### 2. **Lead Generation**

- Build prospect lists for B2B sales
- Export to CRM systems
- Enrich with additional data sources

#### 3. **Market Research**

- Analyze business density by category
- Identify competitors in specific regions
- Track industry trends

#### 4. **Data Enrichment**

- Complete existing business databases
- Verify contact information
- Update outdated records

### 🛠️ Advanced Configuration

#### Custom Category URL

If you know the exact Yellow Pages category URL:

```json
{
  "startUrls": [
    {
      "url": "https://www.yellowpageskenya.com/business-category/hotels"
    }
  ],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

#### Multiple Categories

Run the actor multiple times with different categories, or create a workflow that loops through categories.

### 📜 Changelog

#### Version 1.0.1 (Current)

- ✅ Fixed proxy timeout issues
- ✅ Optimized concurrency (5→2) for reliability
- ✅ Added rate limiting (30 requests/min)
- ✅ Improved session management
- ✅ Reduced wait times for faster scraping
- ✅ Better error handling and logging
- ✅ Default memory: 2048 MB
- ✅ Default timeout: 25 minutes

#### Version 1.0.0

- Initial release
- Basic scraping functionality
- Proxy support

### 📝 Notes

- **Data Freshness:** Data is scraped in real-time from Yellow Pages Kenya
- **Legal:** Scraping publicly available business information for legitimate purposes
- **Rate Limits:** Actor respects website resources with built-in rate limiting
- **Support:** For issues, contact via Apify Console

### 🎓 Tips for Success

1. **Test First:** Always run with 10-20 items before large scrapes
2. **Check Logs:** Monitor for errors and adjust settings accordingly
3. **Batch Processing:** Split large scrapes into smaller runs
4. **Data Validation:** Use email verification services for best results
5. **Stay Updated:** Yellow Pages Kenya may update their website structure

### 🌟 Happy Scraping!

This actor is optimized for reliability and data quality. For best results:

- Start with small batches
- Use datacenter proxies
- Monitor your first run
- Adjust based on results

**Need help?** Check the troubleshooting section or contact support via Apify Console.

***

**License:** Apache-2.0\
**Author:** Apify Community\
**Maintained:** Yes ✅\
**Last Updated:** October 2025

# Actor input Schema

## `searchTerm` (type: `string`):

Category or keyword to search for (e.g., 'hotels', 'restaurants', 'lawyers')

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

Maximum number of business listings to scrape. The scraper will automatically paginate through results. Recommended: 20-50 for 5-minute runs, 100+ for longer runs.

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

Optional: Direct URLs to scrape. If provided, searchTerm will be ignored.

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

Proxy settings for the scraper

## Actor input object example

```json
{
  "searchTerm": "hotels",
  "maxItems": 50,
  "startUrls": [],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "searchTerm": "hotels",
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("verifiable_quadrillion/my-actor").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 = {
    "searchTerm": "hotels",
    "maxItems": 50,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("verifiable_quadrillion/my-actor").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 '{
  "searchTerm": "hotels",
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call verifiable_quadrillion/my-actor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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