# D\&B Business Directory Scraper - Pay Per Result (`mscraper/dnb-business-directory-scraper`) Actor

Extract company names, locations and profile URLs from D\&B directory listings, with page limits and duplicate detection.

- **URL**: https://apify.com/mscraper/dnb-business-directory-scraper.md
- **Developed by:** [mscraper](https://apify.com/mscraper) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 company 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/actors/running/actors-in-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

## D\&B Business Directory Scraper — Pay Per Result

Extract **company names, locations and D\&B profile URLs** from a Dun & Bradstreet business directory listing. Choose a starting page and a maximum number of pages. Results are available in the dataset for export to JSON, CSV or Excel.

### Input

```json
{
  "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html",
  "startPage": 1,
  "maxPages": 2
}
```

| Field | Meaning | Default |
| --- | --- | --- |
| `listingUrl` | D\&B industry/country, region or city listing URL | Required |
| `startPage` | First page to request, numbered from 1 to 40 | 1 |
| `maxPages` | Maximum pages to fetch **starting from `startPage`** | 1 |

For example, `startPage: 5` and `maxPages: 3` requests pages 5, 6 and 7, unless an earlier stop condition occurs. `startPage` overrides any `?page=` already in the URL.

### Pagination and duplicate protection

Pages are requested sequentially. The Actor stops at the first applicable condition:

- The requested page limit or D\&B's page 40 cap is reached.
- Pagination is absent, the next button is absent, or it is disabled. Valid results from that final page are saved.
- A page contains any company URL already encountered in this run, or duplicates within the page. **That entire page is discarded before any results from it are saved or billed.**
- The run's spending limit is reached.

D\&B normally shows up to 50 companies per page. Its reported total can exceed the number of accessible results, and some high page numbers can return an earlier page's companies even when the counter advances. Reaching page 40 or the reported total is therefore **not guaranteed**. Starting from a later page also cannot establish whether that first page duplicates pages outside the current run.

Request failures, loading screens and unexpected page numbers fail the run rather than being reported as a normal end of results. Previously saved results remain available. The `PAGINATION` record in the run's key-value store contains the stop reason and page counts.

### Output

Each dataset item represents one company:

```json
{
  "type": "COMPANY_LISTING",
  "companyName": "Example Company",
  "url": "https://www.dnb.com/business-directory/company-profiles/example-company.example-id",
  "address": "Example City, Example Region",
  "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html?page=1",
  "salesRevenue": null,
  "page": 1
}
```

The listing provides company names and locations. Revenue is `null` when unavailable. This Actor does not visit individual company profiles or extract emails, telephone numbers or company websites.

### Pricing

Pay per saved company result, without a monthly Actor rental:

| Apify plan tier | Price per 1,000 results |
| --- | ---: |
| Free / Bronze | $10 |
| Silver | $9 |
| Gold / Platinum / Diamond | $8 |

There is also an Actor start event of **$0.00005 per started GB of allocated memory**, with a minimum of one event. Scraping infrastructure is included. No proxy configuration or external API key is needed in the input. The current price is shown in the Actor's pricing tab.

This is a separate listing from the [original D\&B scraper](https://apify.com/mscraper/dun-bradstreet-business-directory-scraper). Existing tasks for that Actor do not switch automatically.

### Support

Use the Issues tab on this Actor and include the run URL, listing URL and expected page range. Only collect and use data you are entitled to access.

# Actor input Schema

## `listingUrl` (type: `string`):

A D\&B directory listing for an industry and country, region or city. Company profile URLs are not supported.

## `startPage` (type: `integer`):

First page to request (1-based). This overrides any page parameter in the URL.

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

Maximum pages to fetch starting from Start from page. Stops earlier at the end of pagination, page 40, or the first page with duplicate companies.

## Actor input object example

```json
{
  "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html",
  "startPage": 1,
  "maxPages": 1
}
```

# Actor output Schema

## `companies` (type: `string`):

Unique company records saved by this run.

## `pagination` (type: `string`):

Requested and accepted page counts, duplicates and the reason the run stopped.

# 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 = {
    "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html",
    "startPage": 1,
    "maxPages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("mscraper/dnb-business-directory-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 = {
    "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html",
    "startPage": 1,
    "maxPages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("mscraper/dnb-business-directory-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 '{
  "listingUrl": "https://www.dnb.com/business-directory/company-information.manufacturing.eg.html",
  "startPage": 1,
  "maxPages": 1
}' |
apify call mscraper/dnb-business-directory-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mscraper/dnb-business-directory-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/cXtIVqdOhj2TzFBWd/builds/s6stkcJ8vuc2imsav/openapi.json
