# Sitemap Extractor & URL Finder: All Pages, Lastmod, Hreflang (`keel-data/sitemap-extractor`) Actor

Sitemap extractor and URL finder: get every page URL a website publishes, with lastmod, changefreq, priority, hreflang and image counts. Finds sitemaps via robots.txt, follows nested sitemap indexes, reads .gz, text, RSS and Atom. Date and pattern filters, optional status codes. Pay only per URL.

- **URL**: https://apify.com/keel-data/sitemap-extractor.md
- **Developed by:** [Keel Data](https://apify.com/keel-data) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.15 / 1,000 urls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & URL Finder: All Pages, Lastmod, Hreflang

Get **every page URL a website publishes** in its sitemaps, as clean rows with `lastmod`, `changefreq`, `priority`, hreflang language versions and image counts. Enter a domain and the Actor finds the sitemaps for you, or paste the exact sitemap URL.

Built for SEO audits, site migrations, content inventories and crawl planning. **You pay only for URLs delivered.** Sites without a sitemap, broken sitemap files and filtered-out URLs are free.

### What it does

- **Finds the sitemaps:** reads the `Sitemap:` lines in robots.txt, then tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml`, `/sitemap.txt` and `/sitemap.xml.gz`.
- **Follows nested sitemap indexes** (index → index → urlset), up to 500 files per site by default.
- **Reads every common format:** XML sitemaps, gzipped `.xml.gz`, plain-text `sitemap.txt`, RSS and Atom feeds.
- **Keeps the useful extras:** hreflang alternates (`xhtml:link`), image sitemap entries, video counts and Google News titles and dates.
- **Filters:** keep or skip URLs by pattern (plain text or regular expression) and by lastmod date range.
- **Optional HTTP status check:** finds 404s, redirects and server errors that are still listed in a sitemap.
- **Removes duplicates** per site, so a URL listed in two sitemaps comes back once.

### How to use it

1. Enter one or more **websites** (`example.com`) or **sitemap URLs** (`https://example.com/post-sitemap.xml`).
2. Optionally set **Max URLs per site** (default 1,000; 0 = no limit), URL patterns and dates.
3. Run, then download the results as JSON, CSV or Excel, or send them to Google Sheets, Make, Zapier or n8n.

#### Example input

```json
{
  "startUrls": ["https://crawlee.dev", "https://wordpress.org/news/sitemap.xml"],
  "maxUrlsPerSite": 5000,
  "includeUrlPatterns": ["/blog/"],
  "excludeUrlPatterns": ["/tag/", "/page/\\d+"],
  "lastmodAfter": "2026-01-01",
  "checkStatusCodes": false
}
```

#### Example output (one row per URL)

```json
{
  "status": "ok",
  "url": "https://www.theguardian.com/sport/live/2026/nov/13/australia-vs-england-cricket-odi-perth-live-scores",
  "lastmod": "2026-11-13T02:54:00Z",
  "changefreq": "hourly",
  "priority": null,
  "site": "https://www.theguardian.com/",
  "sitemapUrl": "https://www.theguardian.com/sitemaps/news.xml",
  "sitemapType": "xml",
  "imageCount": 1,
  "videoCount": 0,
  "alternates": [],
  "newsTitle": "Australia v England: first men's cricket one-day international – live",
  "newsPublicationDate": "2026-11-13T02:50:08Z",
  "scrapedAt": "2026-11-13T03:00:00.000Z"
}
```

With **Check HTTP status** on, each row also has `httpStatus` (for example `200`, `301`, `404`) and `redirectTo`.

Rows that cost nothing tell you what went wrong:

| `status` | Meaning |
|---|---|
| `no_sitemap` | No sitemap in robots.txt or at the usual addresses. `triedUrls` lists what was checked. |
| `error` | One sitemap file could not be read (404, blocked, not a sitemap). The other files of the site still count. |
| `no_urls` | Sitemaps were read, but they are empty or your filters removed every URL. |

A per-site summary (sitemaps found and read, URLs found, duplicates, filtered out, limit reached) is saved in the `RUN_STATS` record.

### Pricing

Pay per event, no start fee, proxies and compute included:

- **URL** (`url`): one row with a page URL from the sitemap.
- **URL with status check** (`url-with-status`): one row when **Check HTTP status** is on. It replaces the plain URL event; you are not charged twice.

Free: `no_sitemap`, `error` and `no_urls` rows, duplicates, URLs removed by filters and every retry. Set a maximum cost per run in the run options: the Actor stops cleanly when it gets there and keeps everything collected so far. If a run delivers no URL at all, it is marked as failed and costs nothing in events.

### Limits

- Up to 1,000 websites per run and 1,000,000 URLs per site.
- Sitemap files up to 120 MB uncompressed (the sitemap standard allows 50 MB).
- Date filters use the `lastmod` the site declares. URLs without a `lastmod` are dropped when a date filter is set.
- This Actor reads sitemaps; it does not crawl links. Pages a site leaves out of its sitemaps are not found.

### Use cases

- **SEO audits:** compare sitemap URLs with indexed pages, find 404s and redirects listed in sitemaps, check hreflang coverage.
- **Site migrations:** export the full URL inventory before and after a move to build redirect maps.
- **Content monitoring:** schedule a daily run with `lastmodAfter` to get pages added or updated since the last run.
- **Crawl planning and AI pipelines:** feed the URL list to a content crawler or an AI agent through the Apify MCP server.

### Support

We run a test extraction every day and fix problems quickly. If something looks wrong, open an issue on the **Issues** tab; we answer within one business day.

### Is it allowed?

Sitemaps are public files that websites publish so robots can find their pages. This Actor reads only those public files (and, if you ask, the status code of each listed URL). It collects no personal data and needs no login. You are responsible for how you use the results. This Actor is not affiliated with or endorsed by any of the websites you scan or by sitemaps.org.

# Actor input Schema

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

A domain or home page (we find its sitemaps through robots.txt and the usual addresses), or the exact URL of a sitemap, sitemap index, .xml.gz, sitemap.txt, RSS or Atom feed. Up to 1,000 per run.

## `maxUrlsPerSite` (type: `integer`):

Stop after this many URLs for each site (after filters). 0 = no limit (up to 1,000,000).

## `includeUrlPatterns` (type: `array`):

Keep a URL only if it matches at least one of these. Plain text such as /blog/ works, and so do regular expressions such as /products/\[^/]+$. Not case-sensitive.

## `excludeUrlPatterns` (type: `array`):

Drop URLs matching any of these (plain text or regular expressions, not case-sensitive), e.g. /tag/ or ?page=.

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

YYYY-MM-DD. Keep only URLs whose sitemap lastmod is on or after this date. URLs with no lastmod are dropped when a date filter is set.

## `lastmodBefore` (type: `string`):

YYYY-MM-DD. Keep only URLs whose sitemap lastmod is on or before this date.

## `includeAlternates` (type: `boolean`):

Add the language versions (xhtml:link hreflang) listed for each URL.

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

Add the image URLs, titles and captions from image sitemaps. The image count is always included.

## `checkStatusCodes` (type: `boolean`):

Request every URL (headers only, redirects not followed) and add httpStatus and redirectTo. Finds 404s and redirects listed in your sitemap. Slower and priced per checked URL instead of per URL.

## `useRobotsTxt` (type: `boolean`):

Read the Sitemap: lines of robots.txt when you enter a domain.

## `tryCommonPaths` (type: `boolean`):

If robots.txt lists no sitemap, try /sitemap.xml, /sitemap_index.xml, /sitemap-index.xml, /wp-sitemap.xml, /sitemap.txt and /sitemap.xml.gz.

## `maxSitemapsPerSite` (type: `integer`):

Safety limit on how many sitemap files (including nested indexes) are read for one site.

## `maxRetries` (type: `integer`):

Retries with backoff (and a proxy switch if the site blocks) before a sitemap counts as failed. Retries are free.

## `proxyConfiguration` (type: `object`):

Leave empty. Sitemaps are fetched directly, and the Actor switches to Apify proxies by itself if a site blocks it. Proxy costs are included in the price.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawlee.dev"
  ],
  "maxUrlsPerSite": 1000,
  "includeUrlPatterns": [],
  "excludeUrlPatterns": [],
  "includeAlternates": true,
  "includeImages": false,
  "checkStatusCodes": false,
  "useRobotsTxt": true,
  "tryCommonPaths": true,
  "maxSitemapsPerSite": 500,
  "maxRetries": 3
}
```

# Actor output Schema

## `overview` (type: `string`):

One row per page URL found in the site's sitemaps, with lastmod, changefreq, priority and hreflang.

## `runStats` (type: `string`):

Per-site summary (sitemaps found and read, URLs found, duplicates, filtered out) and request counts.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("keel-data/sitemap-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://crawlee.dev"] }

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

```

## MCP server setup

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