# Fast Phone Number Extractor | Bulk, Any Website & Low Cost (`muzafferkadir/fast-phone-number-extractor`) Actor

Fast Phone Number Extractor efficiently extracts phone numbers from static websites at high speed while keeping usage costs low. It detects various number formats, supports country code filtering. Ideal for cost-effective web scraping projects.

- **URL**: https://apify.com/muzafferkadir/fast-phone-number-extractor.md
- **Developed by:** [Muzaffer Kadir YILMAZ](https://apify.com/muzafferkadir) (community)
- **Categories:** E-commerce, Lead generation, Social media
- **Stats:** 78 total users, 2 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 page processeds

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

## Fast Phone Number Extractor

Extract phone numbers from any website in bulk. Give it one or more URLs and it returns every valid phone number found on each page, correctly parsed and formatted. It fetches pages through a managed browser-and-proxy backend, so you can choose a fast plain-HTTP mode or a full browser mode that renders JavaScript and bypasses anti-bot protection (Cloudflare and similar).

Use this actor to:

- **Lead generation** — collect contact numbers from a list of business websites
- **Directory building** — enrich a company list with phone numbers
- **Data verification** — check that a phone number listed elsewhere actually appears on a business's site
- **Contact discovery** — quickly find the phone number on any single page

### Features

- Two fetch modes: **fast request** (cheap, no JavaScript) and **browser** (JavaScript rendering + anti-bot bypass)
- Multi-source extraction: `tel:`/`sms:` links, WhatsApp links, JSON-LD structured data, microdata, and page text
- Country-aware validation and national/international formatting via `libphonenumber-js`
- Per-page deduplication with the source of each number, original text, and match position
- Run statistics: finished/failed requests, pages with numbers, and unique-number events

### How it works

1. The actor fetches each start URL in the selected mode.
2. It follows same-site links up to `maxRequestsPerCrawl`.
3. For every page it collects phone numbers from `tel:`/`sms:` links, WhatsApp links, JSON-LD, microdata, and visible text, then validates each with the selected country as a local-number hint.
4. It writes one dataset item per page and a `STATS` record for the run.

### Request modes

| Mode | JavaScript | Anti-bot bypass | Speed | Relative cost | Use when |
|---|---|---|---|---|---|
| `request` (default) | No | No | Fast | Low | The number is in the static HTML — most contact pages |
| `browser` | Yes | Yes | Slower | Higher | The page renders numbers with JavaScript or is protected by Cloudflare / a bot wall |

Start with `request`. Switch to `browser` only for pages that return nothing in `request` mode or that block plain HTTP.

### Getting more results

- Start from a contact or location page when you only need one business's number.
- Increase `maxRequestsPerCrawl` when numbers may live on deeper pages.
- Set the correct `phoneCountryCode` for local numbers without a `+` country prefix.
- Use `browser` mode for JavaScript-heavy or bot-protected sites.
- Results reflect phone numbers actually exposed by the website. Numbers embedded only in images are not read.

### What data you get

Each page you crawl returns:

| Field | Description |
|---|---|
| `url` | The page that was crawled (final URL after redirects) |
| `title` | The page's title |
| `mode` | The fetch mode used (`request` or `browser`) |
| `httpStatus` | The HTTP status reported for the page |
| `phoneNumbers` | Array of phone numbers found (see below) |

Each entry in `phoneNumbers` includes:

| Field | Description |
|---|---|
| `number` | Number in E.164 international format, e.g. `+12125550198` |
| `nationalNumber` | National significant number, e.g. `2125550198` |
| `formattedNumber` | Number formatted for its country, e.g. `(212) 555-0198` |
| `country` | Detected country code, e.g. `US` |
| `source` | Where it was found: `tel`, `whatsapp`, `json-ld`, `microdata`, or `text` |
| `text` | The exact text or value the number was found in |
| `position` | Start/end offsets in the page text (only for `text` matches) |

### Input

| Field | Type | Description |
|---|---|---|
| `startUrls` | `array` | Pages to extract phone numbers from |
| `mode` | `string` | Fetch mode: `request` (fast HTTP, no JavaScript) or `browser` (JavaScript + anti-bot bypass). Required, default `request` |
| `maxRequestsPerCrawl` | `number` | Maximum number of pages to visit, including links found on the start pages (default: 1) |
| `phoneCountryCode` | `string` | Country hint for parsing numbers that aren't already in international format, e.g. `US`, `TR`, `GB` (default: `US`) |

### Examples

#### One contact page (fast mode)

```json
{
  "startUrls": [{ "url": "https://example-business.com/contact" }],
  "mode": "request",
  "maxRequestsPerCrawl": 1,
  "phoneCountryCode": "US"
}
```

#### JavaScript-rendered or bot-protected site (browser mode)

```json
{
  "startUrls": [{ "url": "https://example.com/iletisim" }],
  "mode": "browser",
  "maxRequestsPerCrawl": 1,
  "phoneCountryCode": "TR"
}
```

#### Crawl several pages from multiple sites

```json
{
  "startUrls": [
    { "url": "https://example.com" },
    { "url": "https://example.org/contact" }
  ],
  "mode": "request",
  "maxRequestsPerCrawl": 20,
  "phoneCountryCode": "GB"
}
```

### Output sample

```json
{
  "url": "https://example-business.com/contact",
  "title": "Contact Us",
  "mode": "request",
  "httpStatus": 200,
  "phoneNumbers": [
    {
      "number": "+12125550198",
      "nationalNumber": "2125550198",
      "formattedNumber": "(212) 555-0198",
      "country": "US",
      "source": "tel",
      "text": "(212) 555-0198"
    }
  ]
}
```

### Notes

- `phoneCountryCode` only affects numbers written in a local (non-international) format. Numbers already written with a country code, e.g. `+1 212 555 0198`, are parsed correctly regardless.
- When the same number is found by more than one source, the highest-confidence source wins: `tel`/`whatsapp` links and structured data (`json-ld`, `microdata`) take precedence over free `text`.
- The default key-value store contains a `STATS` record with the mode used, finished/failed requests, pages with numbers, and unique-number events. `uniqueNumbersFound` is the sum of per-page unique numbers; the same number on two pages is counted twice.

### License

ISC

# Actor input Schema

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

URLs to extract phone numbers from.

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

How each page is fetched. "Fast request" uses a plain HTTP request (cheapest, no JavaScript). "Browser" runs a full browser with JavaScript rendering and anti-bot bypass (Cloudflare and similar) — slower and more expensive, but reaches protected or JavaScript-rendered pages.

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of pages to visit (including links discovered on start URLs).

## `phoneCountryCode` (type: `string`):

Country code hint used to parse phone numbers that aren't in international format, e.g. US, TR, GB.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.apple.com/contact/"
    },
    {
      "url": "https://www.w3.org/contact/"
    }
  ],
  "mode": "request",
  "maxRequestsPerCrawl": 2,
  "phoneCountryCode": "US"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `stats` (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 = {
    "startUrls": [
        {
            "url": "https://www.apple.com/contact/"
        },
        {
            "url": "https://www.w3.org/contact/"
        }
    ],
    "mode": "request",
    "maxRequestsPerCrawl": 2,
    "phoneCountryCode": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("muzafferkadir/fast-phone-number-extractor").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 = {
    "startUrls": [
        { "url": "https://www.apple.com/contact/" },
        { "url": "https://www.w3.org/contact/" },
    ],
    "mode": "request",
    "maxRequestsPerCrawl": 2,
    "phoneCountryCode": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("muzafferkadir/fast-phone-number-extractor").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 '{
  "startUrls": [
    {
      "url": "https://www.apple.com/contact/"
    },
    {
      "url": "https://www.w3.org/contact/"
    }
  ],
  "mode": "request",
  "maxRequestsPerCrawl": 2,
  "phoneCountryCode": "US"
}' |
apify call muzafferkadir/fast-phone-number-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muzafferkadir/fast-phone-number-extractor"
        }
    }
}
```

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/PbQ6GwRj98FPXT0FH/builds/PLLSOk3F7gR7JtWJ5/openapi.json
