# Naked Domains Analyzer (`jancurn/analyze-domains`) Actor

Crawls and downloads web pages running on a list of provided naked domains e.g. "example.com". The actor stores HTML snapshot, screenshot, text body, and HTTP response headers of all the pages. It also extracts email addresses, phones, social handles for Facebook, Twitter, LinkedIn, and Instagram.

- **URL**: https://apify.com/jancurn/analyze-domains.md
- **Developed by:** [Jan Čurn](https://apify.com/jancurn) (community)
- **Categories:** Developer tools, Open source
- **Features:** Full permissions
- **Stats:** 355 total users, 0 monthly users, 100.0% runs succeeded, 6 bookmarks
- **User rating**: 2.00 out of 5 stars

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

The actor performs a crawl of web pages from a provided list of naked domain names using headless Chrome.
For each web page visited, the crawler extracts and saves the following information:

- Page data:
  - Page title
  - List of all links
  - [JSON+LD](https://en.wikipedia.org/wiki/JSON-LD) linked data
- Social handles
  - Emails
  - Phone numbers
  - Facebook profiles
  - LinkedIn profiles
  - Twitter profiles
  - Instagram profiles
- Screenshot (if `saveScreenshot` setting is `true`). The screenshots are stored in JPEG format to save disk space.
  Note that taking screenshots is quite resource intensive and will slow your crawler down.
- HTML content (if `saveHtml` setting is `true`)
- Text body of the page (if `saveText` setting is `true`)
- HTTP response headers
- Information about SSL/TLS certificate

For each domain (e.g. `example.com`) from the input, the actor tries to load the following pages:

- `http://example.com`
- `https://example.com` (only if `crawlHttpsVersion` setting is `true`)
- `http://www.example.com` (only if `crawlWwwSubdomain` setting is `true`)
- `https://www.example.com` (only if both `crawlHttpsVersion` and `crawlWwwSubdomain` settings are `true`)

Additionally, if the `crawlLinkCount` setting is greater than zero, for each domain
the crawler tries to open `crawlLinkCount` pages linked from the main page and analyze them too.
The crawler prefers the links that contains the `/contact` text, to increase the chance it will find
more emails, phone numbers and other social handles.

The results of the crawler are stored into a dataset. For each web page crawled
there is one record. The optional screenshots and HTML snapshots of web pages are stored
into separate records into the key-value store.

For example, for the web page `https://example.com` the resulting record in the dataset will look as follows (in JSON format):

```
{
  "domain": "example.com",
  "url": "http://example.com",
  "response": {
    "url": "http://example.com/",
    "status": 200,
    "remoteAddress": {
      "ip": "93.184.216.34",
      "port": 80
    },
    "headers": {
      "content-encoding": "gzip",
      "cache-control": "max-age=604800",
      "content-type": "text/html; charset=UTF-8",
      "date": "Sat, 24 Nov 2018 22:04:40 GMT",
      "etag": "\"1541025663+gzip\"",
      "expires": "Sat, 01 Dec 2018 22:04:40 GMT",
      "last-modified": "Fri, 09 Aug 2013 23:54:35 GMT",
      "server": "ECS (dca/24D5)",
      "vary": "Accept-Encoding",
      "x-cache": "HIT",
      "content-length": "606"
    },
    "securityDetails": null
  },
  "page": {
    "title": "Example Domain",
    "linkUrls": [
      "http://www.iana.org/domains/example"
    ],
    "linkedDataObjects": []
  },
  "social": {
    "emails": [],
    "phones": [],
    "phonesUncertain": [],
    "linkedIns": [],
    "twitters": [],
    "instagrams": [],
    "facebooks": []
  },
  "screenshot": {
    "url": "https://api.apify.com/v2/key-value-stores/<actor_run_id>/records/screenshot-example.com-00.jpg",
    "length": 18572
  },
  "html": {
    "url": "https://api.apify.com/v2/key-value-stores/<actor_run_id>/records/content-example.com-00.html",
    "length": 1262
  },
  "text": " EXAMPLE DOMAIN\nThis domain is established to be used for illustrative examples in documents.\nYou may use this domain in examples without prior coordination or asking for\npermission.\n\nMore information..."
}
```

If the web page cannot be loaded for any reason, the record contains the information about the error:

```
{
  "domain": "non-existent-domain.net",
  "url": "http://non-existent-domain.net",
  "errorMessage": "Error: net::ERR_NAME_NOT_RESOLVED at http://non-existent-domain.net\n    at navigate (/Users/jan/Projects/actor-analyze-domains/node_modules/puppeteer/lib/FrameManager.js:103:37)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)\n  -- ASYNC --\n    at Frame.<anonymous> (/Users/jan/Projects/actor-analyse-domains/node_modules/puppeteer/lib/helper.js:144:27)\n    at Page.goto (/Users/jan/Projects/actor-analyse-domains/node_modules/puppeteer/lib/Page.js:587:49)\n    at Page.<anonymous> (/Users/jan/Projects/actor-analyse-domains/node_modules/puppeteer/lib/helper.js:145:23)\n    at PuppeteerCrawler.gotoFunction (/Users/jan/Projects/actor-analyse-domains/node_modules/apify/build/puppeteer_crawler.js:30:53)\n    at PuppeteerCrawler._handleRequestFunction (/Users/jan/Projects/actor-analyse-domains/node_modules/apify/build/puppeteer_crawler.js:322:48)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)"
}
```

# Actor input Schema

## `domains` (type: `string`):

List of domains to crawl. The domains must be naked, i.e. specified without a protocol and sub-domains (e.g. <code>example.com</code>).

## `domainsFileUrl` (type: `string`):

URL of a text file that contains the list of domains to crawl. The domains must be naked, i.e. specified without a protocol and sub-domains (e.g. <code>example.com</code>).<br><br>This field is useful if you have a large number of domains.

## `domainsFileOffset` (type: `integer`):

Indicates how many domains from the file should be skipped in the beginning. This is useful if you only want to crawl a portion of the domains.

## `domainsFileCount` (type: `integer`):

Indicates how many domains from the file should be crawled, starting from the offset. This is useful if you only want to crawl a portion of the domains. Leave empty to crawl all domains.

## `useChrome` (type: `boolean`):

If checked, the actor uses Chrome instead of Puppeteer's Chromium for the crawling. This might help to prevent blocking of some pages.

## `useApifyProxy` (type: `boolean`):

If checked, the actor uses Apify Proxy to access the target pages. This might help to prevent blocking of some pages.

## `maxRequestRetries` (type: `integer`):

Indicates how many times shall the crawler retry to load a page on error.

## `crawlLinkCount` (type: `integer`):

Indicates how many links from the main page going to the same domain shall also be crawled.

## `crawlHttpsVersion` (type: `boolean`):

If checked, the actor attempts to crawl HTTPs version of the website (e.g. <code>https://example.com</code> for domain <code>example.com</code>).

## `crawlWwwSubdomain` (type: `boolean`):

If checked, the actor attempts to crawl <code>www.</code> sub-domain of the website (e.g. <code>http://www.example.com</code> for domain <code>example.com</code>).

## `saveScreenshot` (type: `boolean`):

If checked, the actor stores screenshots of all loaded pages into the key-value store.

## `saveHtml` (type: `boolean`):

If checked, the actor stores HTML content of all loaded pages into the key-value store.

## `saveText` (type: `boolean`):

If checked, the actor stores text content of all loaded pages into the dataset results.

## `considerChildFrames` (type: `boolean`):

If checked, the actor searches for social handles even in the content of the first-level child frames. The 'page.text' also contains the combined text of the main frame and direct child frames.

## Actor input object example

```json
{
  "domains": "example.com\niana.org\napify.com",
  "domainsFileOffset": 0,
  "useChrome": false,
  "useApifyProxy": false,
  "maxRequestRetries": 2,
  "crawlLinkCount": 5,
  "crawlHttpsVersion": true,
  "crawlWwwSubdomain": true,
  "saveScreenshot": true,
  "saveHtml": true,
  "saveText": true,
  "considerChildFrames": 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 = {
    "domains": `example.com
iana.org
apify.com`,
    "maxRequestRetries": 2,
    "crawlLinkCount": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("jancurn/analyze-domains").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 = {
    "domains": """example.com
iana.org
apify.com""",
    "maxRequestRetries": 2,
    "crawlLinkCount": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("jancurn/analyze-domains").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 '{
  "domains": "example.com\\niana.org\\napify.com",
  "maxRequestRetries": 2,
  "crawlLinkCount": 5
}' |
apify call jancurn/analyze-domains --silent --output-dataset

```

## MCP server setup

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

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/qC2F3t4RhNwBntopa/builds/BxeBtcniyEt7jOnAp/openapi.json
