# Sitemap URL Extractor: lastmod, hreflang, robots, status (`kvnloo/sitemap-url-extractor`) Actor

Extract every URL from a website's XML, gzip or text sitemaps and sitemap indexes. Get lastmod, changefreq, priority, hreflang alternates, image counts, robots.txt allow flags and optional HTTP status codes. No proxy or browser.

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

## Pricing

from $0.10 / 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.
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 URL Extractor: every URL from a site's sitemaps, with SEO fields

Give it a domain or a sitemap URL. It finds the sitemaps, follows sitemap indexes, and returns one clean row per page URL with `lastmod`, `changefreq`, `priority`, hreflang alternates, image counts, and a robots.txt **allowed** flag. Optional HTTP status checks show broken or redirected sitemap URLs.

It uses plain HTTP requests: no browser, no proxy, no login. It reads only robots.txt and sitemap files unless you turn on status checks.

### What it does

- **Finds sitemaps for you.** For a bare domain it reads `Sitemap:` lines in `robots.txt`, then tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml` and `/wp-sitemap.xml`.
- **Reads every format.** XML `urlset`, nested `sitemapindex` files (followed recursively), `.xml.gz` gzip sitemaps, and plain-text `.txt` sitemaps.
- **Returns the SEO fields that matter.** `lastmod`, `changefreq`, `priority`, `<xhtml:link hreflang>` alternates, and the number of `<image:image>` entries.
- **Flags sitemap/robots conflicts.** `robotsAllowed: false` marks URLs listed in the sitemap but blocked by the start host's robots.txt, a common technical SEO error. Rules follow Google's matching: `*` and `$` wildcards, longest rule wins, and a tie goes to Allow. Only the `User-agent: *` group is applied, and URLs on other hosts get `null`.
- **Can check status codes (optional).** It sends a HEAD request to each URL (a 1-byte GET if HEAD is refused) and follows redirects. It records the final status code, the final URL, and `redirected: true` when the final URL differs. URLs blocked by robots.txt are never requested. Requests are paced, and a 429 response is retried once after the server's Retry-After delay, up to 10 seconds.
- **Filters before you pay.** Include and exclude regular expressions run before a row is saved, so skipped URLs are free.
- **Fails fast and cheaply.** If a site has no readable sitemap, the run says so in the log and saves no rows, so you pay no per-URL charges. It does not wander a site or burn time on retries.

### Input

| Field | Default | Description |
|---|---|---|
| `startUrls` | (required) | 1 to 20 domains, homepages, or direct sitemap URLs |
| `maxUrls` | 1000 | Stop after this many unique URLs (up to 200,000) |
| `includePattern` | empty | Only keep URLs matching this regex, e.g. `/blog/` |
| `excludePattern` | empty | Drop URLs matching this regex, e.g. `\?page=\|/tag/` |
| `checkStatus` | false | Request each URL and record `statusCode` and `finalUrl` |
| `concurrency` | 5 | Parallel status requests (1 to 20) |

```json
{
  "startUrls": ["https://crawlee.dev"],
  "maxUrls": 1000,
  "excludePattern": "/api/",
  "checkStatus": true
}
```

### Output

One dataset row per unique page URL:

```json
{
  "url": "https://crawlee.dev/blog",
  "site": "https://crawlee.dev",
  "sitemapUrl": "https://crawlee.dev/sitemap.xml",
  "lastmod": null,
  "changefreq": "weekly",
  "priority": 0.5,
  "imageCount": 0,
  "alternates": [],
  "robotsAllowed": true,
  "statusCode": 200,
  "finalUrl": "https://crawlee.dev/blog",
  "redirected": false
}
```

`lastmod` is the raw value the site published. `statusCode`, `finalUrl` and `redirected` are `null` when status checks are off, when robots.txt blocks the URL, or when the request fails. Export as JSON, CSV, Excel or HTML from the dataset tab, or fetch through the API.

A `SUMMARY` record in the key-value store reports `resultCount`, `errorCount` (start URLs without a readable sitemap) and `aborted`.

### Pricing

Pay per event, per saved URL, by Apify plan:

| Apify plan | Per 1,000 URLs |
|---|---|
| Free, Starter (Bronze) | $0.30 |
| Scale (Silver) | $0.20 |
| Business (Gold) and above | $0.10 |

There is also a $0.00005 start fee per run. There are no charges for filtered-out URLs, duplicates, or sites without a sitemap. Set a maximum cost per run in the run options and the Actor stops cleanly at that limit.

Examples on the Free plan: 1,000 URLs cost about $0.30, and a 20-URL smoke test costs under $0.01.

### Use cases

- **Crawl planning.** Feed a clean URL list into Website Content Crawler or your own scraper instead of crawling blindly.
- **Technical SEO audits.** Find 404s, redirects and robots-blocked URLs that are still in the sitemap, plus missing `lastmod` and hreflang gaps.
- **Content inventories.** Count blog posts, product pages or docs pages, and track `lastmod` over time with a scheduled run.
- **Competitor monitoring.** Schedule weekly runs and diff the datasets to spot new or removed pages.

### How it compares

Compared with the best-known sitemap extractor on Apify Store (checked November 2026), whose documented output is `url`, `status` and `lastmod`:

- **Same price or lower on every plan:** $0.30 per 1,000 URLs on Free against its $0.50, and equal to its Bronze, Silver and Gold prices.
- **More output fields:** `changefreq`, `priority`, hreflang alternates, image counts, the source sitemap file, a robots.txt allow flag, the final redirect URL, and a `redirected` flag.
- **Status checks are opt-in**, so a plain URL list does not send a request to every page on the site.
- **A clear result when there is no sitemap:** the run finishes with a plain message and no per-URL charges.

Formats supported here: XML, sitemap indexes, gzip and plain-text sitemaps, with robots.txt discovery and four well-known fallback paths.

### FAQ

**Does it crawl pages or follow links?** No. It reads only robots.txt and sitemap files. With `checkStatus` on, it sends one lightweight request per listed URL and never downloads page bodies.

**Does it work on JavaScript-heavy sites?** Yes. Sitemaps are static XML, so the site's front-end framework does not matter.

**Why did my run return nothing?** The site publishes no sitemap at robots.txt or the common paths. If you know its sitemap URL, pass it directly in `startUrls`.

**Does it bypass blocking or use proxies?** No. It identifies itself with a clear User-Agent and does not circumvent bot protection. A site that blocks plain HTTP requests to its sitemap will show up as "no readable sitemap".

**Is there a size limit?** Each sitemap file can be up to 50 MB uncompressed (the sitemap protocol maximum). Up to 500 sitemap files per site and up to 200,000 URLs per run are supported.

**Does it collect personal data?** No. Output contains only URLs and sitemap metadata published for search engines.

### Limits and responsible use

Run it on sites you own or whose terms allow automated access. Keep `concurrency` low when checking status on small sites. Private, loopback and internal network addresses are refused.

# Actor input Schema

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

1 to 20 entries. A bare domain or homepage is discovered via robots.txt Sitemap lines, then /sitemap.xml, /sitemap_index.xml, /sitemap-index.xml and /wp-sitemap.xml. A URL ending in .xml, .xml.gz or .txt, or containing 'sitemap', is read directly. Sitemap indexes are followed recursively.

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

Stop after this many unique page URLs across all start URLs. Each saved URL is one billable result.

## `includePattern` (type: `string`):

Optional regular expression. Only page URLs that match are saved and charged, for example /blog/.

## `excludePattern` (type: `string`):

Optional regular expression. Page URLs that match are skipped and not charged, for example ?page=|/tag/.

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

Send a HEAD request (or a 1-byte GET when HEAD is refused) to each saved URL and record the status code and final URL after redirects. URLs disallowed by robots.txt are not requested. Off by default: listing is faster and lighter on the site.

## `concurrency` (type: `integer`):

Parallel status requests when status checks are on. Keep it low for small sites.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawlee.dev"
  ],
  "maxUrls": 20,
  "includePattern": "",
  "excludePattern": "",
  "checkStatus": false,
  "concurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (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": 20
};

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

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

```

## MCP server setup

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