# Sitemap Extractor: XML Sitemap Parser & URL List Exporter (`classier_wholemeal/sitemap-url-extractor`) Actor

Extract every URL from any website sitemap.xml or sitemap index. Auto-discovers sitemaps from robots.txt, follows nested indexes, and returns loc, lastmod, changefreq, priority and optional HTTP status. No login, no proxy, no API key. $0.09 per 1,000 URLs.

- **URL**: https://apify.com/classier_wholemeal/sitemap-url-extractor.md
- **Developed by:** [JackKnifeAI](https://apify.com/classier_wholemeal) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.09 / 1,000 url extracteds

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 URL Extractor: XML Sitemap Parser, Sitemap Index Crawler & URL List Exporter

**Sitemap extractor and XML sitemap parser** for any website. Paste a homepage or a `sitemap.xml` URL and get every published page as a clean list: `loc`, `lastmod`, `changefreq`, `priority`, the sitemap it came from, and (optionally) the live HTTP status. Nested **sitemap indexes**, `.xml.gz` files and `Sitemap:` lines in **robots.txt** are followed automatically.

Use it as a sitemap scraper for SEO audits, crawl seeding, RAG URL discovery, redirect maps and site migrations. No login, no API key, no headless browser and no paid proxy.

### Why this sitemap extractor

| | This Actor | Typical sitemap scrapers |
|---|---|---|
| Auto-discover from homepage + robots.txt | ✅ | Often needs the exact sitemap URL |
| Nested sitemap indexes + `.xml.gz` | ✅ | Partial |
| lastmod, changefreq, priority | ✅ | Sometimes URL only |
| Optional HTTP status check | ✅ opt-in, off by default so large sites stay cheap | Often forced, slow and expensive |
| Image sitemap `<image:loc>` | ✅ optional | Rare |
| Path include / exclude filters | ✅ | Rare |
| Price | **$0.09 per 1,000 URLs** | Official Store extractor starts at $0.50 / 1,000 on the free plan |

### Who uses it

- **SEO audits:** export every URL a site declares, then find stale `lastmod` values or pages that now 404.
- **Crawl seeding:** feed Website Content Crawler, RAG pipelines or custom scrapers a complete, de-duplicated URL list.
- **Site migrations and 301 maps:** compare an old sitemap with the live site.
- **Competitor research:** see how a competitor structures blog, product and locale URLs.
- **AI / agents:** give an LLM a real inventory of pages instead of guessing from the homepage.

### Example input

```json
{
  "startUrls": ["https://docs.apify.com", "https://www.sitemaps.org/sitemap.xml"],
  "checkPageStatus": false,
  "pathContains": "",
  "pathExcludes": "/tag/,/author/",
  "maxUrls": 5000
}
```

Accepted input: a homepage (`https://example.com`), a bare domain (`example.com`), or a direct sitemap (`https://example.com/sitemap.xml`, `sitemap_index.xml`, `sitemap.xml.gz`).

### Example output

```json
{
  "url": "https://docs.apify.com/platform/actors",
  "lastmod": "2026-10-12T00:00:00+00:00",
  "changefreq": "weekly",
  "priority": "0.8",
  "sitemapUrl": "https://docs.apify.com/sitemap_base.xml",
  "source": "docs.apify.com",
  "extractedAt": "2026-11-06T07:30:00+00:00"
}
```

When **Check HTTP status** is on, each row also includes `status`, `finalUrl`, `responseMs` and `error` (if the request failed).

A `SUMMARY` record in the default key-value store reports how many URLs were extracted and how many sitemap files were parsed.

### Pricing

Pay per event:

| Event | Price |
|---|---|
| Actor start | $0.00005 |
| URL extracted | **$0.00009** ($0.09 per 1,000 URLs) |

You only pay for unique URLs written to the dataset. Failed sitemap downloads are free. Set a maximum charge per run to cap spend.

### How it works

1. For a homepage, the Actor reads `robots.txt` for `Sitemap:` directives and also tries common paths (`/sitemap.xml`, `/sitemap_index.xml`, …).
2. It parses `urlset` and `sitemapindex` documents, including gzip-compressed sitemaps, and walks nested indexes.
3. URLs are de-duplicated, optionally filtered, and exported.
4. If you turn on status checks, each URL is verified with HEAD (GET fallback) — no JavaScript rendering and no proxy required.

### API example

```bash
curl -X POST "https://api.apify.com/v2/acts/classier_wholemeal~sitemap-url-extractor/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://docs.apify.com"], "maxUrls": 200}'
```

Export results as JSON, CSV or Excel, or send them to Google Sheets, Zapier, Make, n8n or a webhook. It also works as a tool for AI agents through the Apify MCP server.

### FAQ

**Do I need the exact sitemap URL?** No. A homepage is enough in most cases. If a site hides its sitemap, paste the sitemap URL directly.

**Does it follow sitemap indexes?** Yes. Nested indexes are crawled up to `maxSitemapDepth` (default 10; `0` means no limit).

**Will this get blocked?** It only downloads public sitemap and robots files with a clear User-Agent. It does not render pages or bypass bot protections. Status checks use simple HEAD/GET requests; turn them off for the lightest run.

**What about huge sitemaps (100k+ URLs)?** Set `maxUrls` and a maximum charge per run. Increase memory on very large sites if the XML files themselves are big.

**Is this legal?** Yes. Sitemaps and robots.txt are published so crawlers can find pages. Use the URL list in line with the site's terms and applicable law.

**Does it replace a full website crawler?** It lists the URLs the site declares. Pages that are not in any sitemap will not appear. Combine it with a crawler if you need undiscovered URLs.

**Can I filter to a section of the site?** Yes. Use `pathContains` (e.g. `/blog/`) and `pathExcludes` (comma-separated, e.g. `/tag/,/author/`).

# Actor input Schema

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

Website homepages (https://example.com) or direct sitemap URLs (https://example.com/sitemap.xml). The Actor finds sitemaps from robots.txt and common paths when you give a homepage.

## `checkPageStatus` (type: `boolean`):

Send a lightweight HEAD (GET fallback) request to every sitemap URL and record status, final URL and response time. Turn off for a faster list-only extract.

## `includeImages` (type: `boolean`):

Also export <image:loc> URLs from Google image sitemap extensions.

## `pathContains` (type: `string`):

Optional substring filter, e.g. /blog/ or /product/. Leave empty to keep all.

## `pathExcludes` (type: `string`):

Optional comma-separated substrings to drop, e.g. /tag/,/author/.

## `maxUrls` (type: `integer`):

Safety cap across the whole run.

## `maxSitemapDepth` (type: `integer`):

How many nested sitemap-index levels to follow. 0 means unlimited.

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

Parallel HTTP requests.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.apify.com",
    "https://www.sitemaps.org"
  ],
  "checkPageStatus": false,
  "includeImages": false,
  "maxUrls": 10000,
  "maxSitemapDepth": 10,
  "maxConcurrency": 8
}
```

# Actor output Schema

## `results` (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": [
        "https://docs.apify.com",
        "https://www.sitemaps.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("classier_wholemeal/sitemap-url-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": [
        "https://docs.apify.com",
        "https://www.sitemaps.org",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("classier_wholemeal/sitemap-url-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": [
    "https://docs.apify.com",
    "https://www.sitemaps.org"
  ]
}' |
apify call classier_wholemeal/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,classier_wholemeal/sitemap-url-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/xQWyGlMlNROby7eCr/builds/TrNQ9ndU6IYbHit2n/openapi.json
