# Paginegialle B2B (`data2b/paginegialle-b2b`) Actor

Extract precise Italian business data from paginegialle.it. This  Actor uses an optimized API to fetch Multisearch JSON, capturing names, addresses, phones, websites, emails, social links, ratings, & categories. With pagination, rate limiting, & unique ID deduplication, it ensures reliable data.

- **URL**: https://apify.com/data2b/paginegialle-b2b.md
- **Developed by:** [DATA2B](https://apify.com/data2b) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 4 total users, 0 monthly users, 96.2% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

## PagineGialle B2B

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com)
[![Python Version](https://img.shields.io/badge/Python-3.12-blue)](https://www.python.org/downloads/release/python-3120/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A powerful and robust Apify actor for extracting detailed business data from the Italian Yellow Pages website, PagineGialle.it. It is designed to bypass anti-scraping measures, automatically handle full pagination, and provide structured data for business analysis, marketing, or lead generation.

### Key Features

- **Multi-Category & Multi-City Scraping**: Launch complex searches for multiple business categories across several cities in a single run.
- **Smart Automatic Pagination**: The actor automatically detects the total number of result pages for each search and scrapes all of them, ensuring comprehensive data collection.
- **Residential Proxy Support**: Seamlessly integrates with Apify's residential proxies (`useProxy`) to avoid blocks and bypass anti-scraping measures, which is **essential** for getting complete results from PagineGialle.
- **Results Filtering**: Refine your data collection by choosing to keep only businesses that have an email address or a phone number listed.
- **High Concurrency**: Configure the number of parallel requests (`maxConcurrency`) to optimize scraping speed according to your needs.
- **Rich, Structured Data**: Extracts a wide range of data fields, including contact information, GPS coordinates, social media links, user ratings, and more.
- **Stable Environment**: Built on a stable version of Python (3.12) to ensure reliability and compatibility.

### How to Use

1. **Go to the Actor** on the Apify platform.
2. Click the **"Start"** button.
3. **Configure your search** in the "Input" tab.
   - Add the desired categories (e.g., `ristoranti`, `hotel`).
   - Add the desired cities (e.g., `roma`, `milano`).
4. **Enable Proxies**: For complete results, it is highly recommended to leave the `useProxy` option checked (`true`). Without it, the website will likely only return the first page of results.
5. **Run the Actor** and wait for the run to finish.
6. **Retrieve your data** from the dataset's "Output" tab.

### Input Configuration

The actor accepts the following parameters:

| Parameter | Type | Description | Default Value |
| :--- | :--- | :--- | :--- |
| `categories` | Array | A list of business categories to search for. | `["ristoranti"]` |
| `cities` | Array | A list of cities in which to perform the searches. | `["roma"]` |
| `useProxy` | Boolean | **Recommended.** Uses Apify's residential proxies to avoid being blocked. | `true` |
| `maxConcurrency`| Integer | The number of simultaneous requests to speed up scraping. | `5` |
| `filterByEmail`| Boolean | If checked, only results containing an email address will be kept. | `false` |
| `filterByPhone`| Boolean | If checked, only results containing a phone number will be kept. | `false` |

### Output Schema

Each record in the output dataset will represent a single business and will have the following structure:

| Field | Type | Description |
| :--- | :--- | :--- |
| `businessName` | String | The common name of the business. |
| `address` | String | The full street address of the business. |
| `phoneNumber` | String | The primary contact phone number. |
| `website` | String | The URL of the business's official website. |
| `email` | String | The contact email address. |
| `rating` | Number | The average user rating (out of 5). |
| `reviews_count` | Integer| The total number of user reviews. |
| `whatsapp` | String | The WhatsApp business number, if available. |
| `facebook` | String | The URL of the official Facebook page. |
| `instagram` | String | The URL of the official Instagram profile. |
| `twitter` | String | The URL of the official Twitter profile. |
| `latitude` | String | The geographic latitude. |
| `longitude` | String | The geographic longitude. |
| `zip_code` | String | The postal code. |
| `city` | String | The city where the business is located. |
| `province` | String | The province (e.g., RM for Rome). |
| `opening_hours`| String | A JSON string representing the opening hours schedule. |
| `description` | String | A short description of the business activity. |
| `category` | String | The category term used for the search. |
| `scraped_city` | String | The city term used for the search. |
| `unique_id` | String | A unique identifier for the business listing. |
| `timestamp` | String | The UTC timestamp of when the data was scraped. |

### License

This project is licensed under the MIT License.

# Actor input Schema

## `categories` (type: `array`):

Enter one or more categories to search for (e.g., ristoranti, hotel).

## `cities` (type: `array`):

Enter one or more cities to search in (e.g., roma, milano).

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

The maximum number of pages to scrape for each search. The scraper will stop if it runs out of results before reaching this limit.

## `useProxy` (type: `boolean`):

Recommended. Use Apify Proxy to avoid being blocked and to scrape all pages.

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

The maximum number of requests to run in parallel.

## `filterByEmail` (type: `boolean`):

If checked, only results containing an email address will be returned.

## `filterByPhone` (type: `boolean`):

If checked, only results containing a phone number will be returned.

## Actor input object example

```json
{
  "categories": [
    "ristoranti"
  ],
  "cities": [
    "roma"
  ],
  "maxPages": 8,
  "useProxy": true,
  "maxConcurrency": 5,
  "filterByEmail": false,
  "filterByPhone": false
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("data2b/paginegialle-b2b").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("data2b/paginegialle-b2b").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 '{}' |
apify call data2b/paginegialle-b2b --silent --output-dataset

```

## MCP server setup

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

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/7evDUNodmsxNEDhCy/builds/jRZR9lcXFTEskc8c9/openapi.json
