# Sitemap Extractor & Validator: All URLs, Indexes, .gz, Status (`mrlarryjohnson/sitemap-extractor-validator`) Actor

Extract every URL from a website's XML sitemaps (sitemap indexes, .xml.gz, text sitemaps, auto-discovered from robots.txt) with lastmod, changefreq, priority, hreflang and image counts. Validates against the sitemaps.org protocol and can check each URL for 404s, redirects and robots.txt blocks.

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

## Pricing

from $0.10 / 1,000 url listeds

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 Extractor & Validator: All URLs, Indexes, .gz, Status

Give it a sitemap, or just a website, and get **every URL the site publishes** as clean rows, plus a validation report:

- **Auto-discovery:** reads `Sitemap:` lines in robots.txt, then tries `/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml` and more
- **Sitemap indexes** followed recursively, **.xml.gz** decompressed, **text sitemaps** supported
- Per URL: `lastmod`, `changefreq`, `priority`, **hreflang alternates**, image/video counts, Google News flag
- **Protocol validation** (sitemaps.org): over 50,000 URLs or 50 MB, wrong namespace, XML errors, invalid `lastmod` / `priority` / `changefreq`, future dates, cross-host URLs, unescaped characters, duplicates
- **Optional status check:** find listed URLs that return **404 / 5xx**, **redirect** (sitemaps should list final URLs) or are **blocked by robots.txt**
- **`lastmodAfter` filter:** schedule it daily and get only new or updated pages

### Use cases

- **SEO audits:** confirm the sitemap only lists live, canonical, indexable pages
- **Content inventories and migrations:** export every URL of a site in one run
- **Change monitoring:** daily run with `lastmodAfter` to see what a site published
- **Crawler seeding:** feed the URL list into your own scraper or the Broken Link Checker

### Input

| Field | Default | Notes |
|---|---|---|
| `startUrls` | — | Sitemap URLs or website URLs |
| `maxUrls` | `10000` | Up to 1,000,000 distinct URLs |
| `checkStatus` | `false` | HEAD (GET fallback) per URL, robots.txt respected |
| `lastmodAfter` | — | ISO date; older URLs skipped for free |
| `maxSitemaps` | `500` | Safety cap incl. index children |
| `maxConcurrency` | `10` | Status checks in parallel |

### Output

URL rows (`type: "url"`):

```json
{
  "type": "url", "url": "https://example.com/blog/launch", "sitemapUrl": "https://example.com/post-sitemap.xml",
  "lastmod": "2026-10-12T08:30:00+00:00", "changefreq": "weekly", "priority": 0.8,
  "alternates": [{"hreflang": "de", "href": "https://example.com/de/blog/launch"}],
  "imageCount": 2, "videoCount": 0, "isNews": false,
  "statusCode": 301, "finalUrl": "https://example.com/blog/launch/", "redirectCount": 1, "issues": ["REDIRECTS"]
}
```

One free row per sitemap file (`type: "sitemap"`) with `kind` (urlset / sitemapindex / text), `gzipped`, sizes, `urlCount`, `childSitemaps`, `duplicateUrls`, `invalidUrls`, how it was discovered and its `issues` (`TOO_MANY_URLS_50K`, `TOO_LARGE_50MB`, `WRONG_NAMESPACE`, `XML_PARSE_ERROR`, `NOT_DECLARED_IN_ROBOTS_TXT`, `HTTP_404` ...). Totals are in the `SUMMARY` key-value record.

### Pricing (pay per event)

- **$0.10 per 1,000 URLs** (`url-listed`, $0.0001 each), status check included, plus the standard $0.00005 actor start.
- **Free:** duplicate URLs, invalid entries, URLs filtered out by `lastmodAfter`, sitemap-file rows and failed sitemaps.
- Respects your run's maximum cost and `maxUrls`.

### Fair use

- Sitemaps and robots.txt are published for crawlers. The Actor fetches each sitemap file once, obeys robots.txt and identifies itself as `ApifySitemapValidator`.
- Status checks send one lightweight request per URL. Run them on sites you own or manage.
- XML entity tricks (billion-laughs style) are refused, files are capped at 60 MB, and private-network addresses are blocked.

***

*Actively maintained. Issues answered within 24 hours on the Issues tab.*

# Actor input Schema

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

Sitemap URLs (sitemap.xml, sitemap_index.xml, .xml.gz, .txt) or plain website URLs. For a website, sitemaps are discovered from robots.txt (then /sitemap.xml and other common locations). Up to 100.

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

Stop after this many distinct URLs (each one is a `url-listed` event).

## `checkStatus` (type: `boolean`):

Request every listed URL (HEAD, GET fallback) to find 404s, 5xx errors, redirects and URLs that robots.txt blocks. Same price per URL; slower.

## `lastmodAfter` (type: `string`):

Skip URLs whose <lastmod> is older than this date (e.g. 2026-10-01). Skipped URLs are free. URLs without lastmod are kept.

## `maxSitemaps` (type: `integer`):

Safety cap on sitemap files read, including children of sitemap indexes.

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

Only used when status checks are on.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawlee.dev/"
  ],
  "maxUrls": 200,
  "checkStatus": false,
  "maxSitemaps": 500,
  "maxConcurrency": 10
}
```

# 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://crawlee.dev/"
    ],
    "maxUrls": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("mrlarryjohnson/sitemap-extractor-validator").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://crawlee.dev/"],
    "maxUrls": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("mrlarryjohnson/sitemap-extractor-validator").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://crawlee.dev/"
  ],
  "maxUrls": 200
}' |
apify call mrlarryjohnson/sitemap-extractor-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mrlarryjohnson/sitemap-extractor-validator"
        }
    }
}
```

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/VnECblQbUgtpZ3cYv/builds/v8mnYJFIi4ySHEgqY/openapi.json
