# Sitemap Company Page Collector (`eichan/sitemap-company-page-collector`) Actor

- **URL**: https://apify.com/eichan/sitemap-company-page-collector.md
- **Developed by:** [Eichan Jolly](https://apify.com/eichan) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 results

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

## Sitemap Company Page Collector

Find URLs **in public XML sitemaps** that look like company/about/contact pages. It extracts **URLs only**: no page content is visited, parsed, downloaded, or enriched.

### Who should use it?

B2B prospect researchers, company website auditors, and sales-ops teams who already know a business website and want a quick list of likely company-information pages.

### Input

Supply **one** public HTTPS website URL or an explicit sitemap URL. With an ordinary website URL, the Actor requests `/sitemap.xml` on that host. When the URL path includes `sitemap` and ends in `.xml` or `.xml.gz`, it is treated as the explicit sitemap address.

```json
{"url":"https://www.cloudflare.com/sitemap.xml","maxResults":50}
```

The prefill is a real public XML sitemap from Cloudflare's official website, not a placeholder. Contents change as the site is updated.

### Output — one dataset item per unique matching URL

```json
{
  "url":"https://www.cloudflare.com/careers",
  "matched_keyword":"careers",
  "sourceSitemap":"https://www.cloudflare.com/sitemap.xml"
}
```

This URL was observed in the public Cloudflare sitemap when preparing this example; live sitemap contents can change. Your actual `sourceSitemap` field always identifies the XML file from which the URL was extracted. Field names are exactly `url`, `matched_keyword`, `sourceSitemap`. Only URLs already listed inside XML sitemaps are output. The URLs are **not fetched**.

Matches the tokens `about`, `company`, `contact`, `team`, `careers`, `imprint`, `legal` in paths, using simple token boundaries (`/about-us/` matches; `/teamwork/` does not). It does not guess company pages from link text or query strings. A path containing more than one keyword yields one output item using the first textual match. Duplicate URLs are removed. Results preserve sitemap discovery order.

### Supported and not supported

- Supports XML `urlset`, XML `sitemapindex`, nested same-host sitemap indexes, HTTP gzip and `.xml.gz` sitemap files.
- Up to **12 sitemap files**, **200 results** maximum (`maxResults` default 50), 2.5 MB compressed bytes and 8 MB uncompressed XML per file; 12-second timeout per HTTP request.
- Only HTTPS URLs on the **exact original hostname**. External sitemap indexes and external listed page URLs are ignored. Redirects to other hosts are blocked; no account pages, login pages, or personal profiles are scraped.
- Only robots-permitted sitemaps are read; HTTP blocks, invalid XML, disallowed sitemaps, and inaccessible websites produce plain-language errors. If `/sitemap.xml` does not exist, provide a known explicit sitemap URL; the Actor does not scan or guess alternate sitemap names.
- Simple keyword matching creates false positives and misses synonym pages (for example, `/our-story/`). No page is fetched to confirm it is a company page. Zero results is possible and is not proof there are no company pages.

### Run locally (Python 3.12+, standard library only)

From this Actor folder:

```bash
ACTOR_INPUT_JSON='{"url":"https://www.cloudflare.com/sitemap.xml","maxResults":50}' python src/main.py
```

Or put the input in `storage/key_value_stores/default/INPUT.json`. The local dataset appears as `storage/datasets/default/000000001.json`, etc. On Apify, the Actor reads run input and pushes JSON rows via REST using runtime environment variables. No Apify SDK needed.

Reproduce offline **script-mode** smoke verification (the fixture is illustrative, not a capture of the live Cloudflare sitemap):

```bash
python tests/run_direct_smoke.py
python -m unittest discover -s tests -v
```

The exact terminal output and resulting dataset rows are included in `tests/SMOKE_OUTPUT.txt` and `tests/SMOKE_DATASET.json`.

### Apify Store metadata and suggested price

Suggested categories: **LEAD_GENERATION**, **SEO_TOOLS** (2 categories). Suggested **PRICE_PER_DATASET_ITEM $0.003/item ($3.00 per 1,000 URLs)**. This is a recommendation only in `store_metadata.json`. **No Apify billing is configured.** The Actor makes no billing API calls.

Only official public website sitemaps on user-specified hosts; no login, LinkedIn scraping, personal-data collection, or private-network access.

# Actor input Schema

## `url` (type: `string`):

One public HTTPS URL. No account or login needed.

## `maxResults` (type: `integer`):

Stop after this many matching company-page URLs (1–200).

## Actor input object example

```json
{
  "url": "https://www.cloudflare.com/sitemap.xml",
  "maxResults": 50
}
```

# Actor output Schema

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

Dataset containing the Actor's result items

# 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 = {
    "url": "https://www.cloudflare.com/sitemap.xml"
};

// Run the Actor and wait for it to finish
const run = await client.actor("eichan/sitemap-company-page-collector").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 = { "url": "https://www.cloudflare.com/sitemap.xml" }

# Run the Actor and wait for it to finish
run = client.actor("eichan/sitemap-company-page-collector").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 '{
  "url": "https://www.cloudflare.com/sitemap.xml"
}' |
apify call eichan/sitemap-company-page-collector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eichan/sitemap-company-page-collector"
        }
    }
}
```

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/Ia6BR8OZ5AvbZWfL7/builds/mLMMqqwUCO6alwMxj/openapi.json
