# Sitemap Extractor and Change Monitor (`kmswiill/sitemap-extractor-monitor`) Actor

Lists every URL in the sitemaps of any website, found automatically through robots.txt, and tells you what changed since your last run: new pages, updated pages and removed pages.

- **URL**: https://apify.com/kmswiill/sitemap-extractor-monitor.md
- **Developed by:** [KmS](https://apify.com/kmswiill) (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.26 / 1,000 url rows

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 and Change Monitor

Get every URL a website lists in its sitemaps, and on the next run get **only what changed**: new pages, updated
pages and pages that left the sitemap.

Enter a website and the Actor finds its sitemaps by itself, through `robots.txt` and the usual addresses. It follows
sitemap indexes, opens compressed files (`.xml.gz`) and reads XML sitemaps, plain text lists and RSS or Atom feeds.
There is no browser and no proxy involved, so a site with tens of thousands of URLs is read in seconds.

### What you can do with it

- Build the full list of pages of a site before a crawl, an SEO audit, a migration or a content inventory.
- Feed only new and updated pages to your crawler or your search index instead of reading the whole site again.
- Watch a competitor and get the pages they published since yesterday.
- Find the pages that were modified in the last 7 days, or that match a pattern such as `/blog/`.
- Catch pages that disappeared from a sitemap after a release.

### Input

| Field | What it does |
|---|---|
| Websites or sitemap addresses | One per line. A website (`example.com`) to find its sitemaps automatically, or the address of one sitemap file. |
| Only changes | Returns only new, updated and removed URLs since your previous run. |
| Report updated URLs | Marks a URL as updated when its last modified date changes. Turn it off to track only new and removed URLs. |
| Modified after | Keeps only URLs modified on or after a date (`2026-11-01`) or within a period (`7 days`, `2 weeks`, `3 months`). |
| URL must contain | Keeps only URLs that match one of the patterns. Plain text or `*` wildcards. |
| URL must not contain | Leaves out URLs that match any of the patterns. |
| Sitemap file keywords | Reads only the sitemap files whose address contains one of the words, such as `product` or `post`. |
| Include images, videos, news and language versions | Adds the extra data the sitemap lists for each URL. |
| Maximum URLs per site | Upper limit of URLs read from each site. |

Example: the blog posts a site published or changed in the last week.

```json
{
    "sites": ["example.com"],
    "modifiedAfter": "7 days",
    "includePatterns": ["/blog/"]
}
```

Example: a daily watch that returns only what changed in two sites.

```json
{
    "sites": ["example.com", "https://another-example.com/sitemap_index.xml"],
    "onlyChanges": true
}
```

### Output

One row per URL:

```json
{
    "site": "developer.mozilla.org",
    "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asIntN",
    "lastModified": "2026-10-26",
    "changeFrequency": null,
    "priority": null,
    "sitemapUrl": "https://developer.mozilla.org/sitemaps/en-us/sitemap.xml.gz",
    "change": "updated",
    "previousLastModified": "2026-09-30",
    "scrapedAt": "2026-11-22T06:51:46.909Z"
}
```

| Field | Meaning |
|---|---|
| `site` | The website the URL belongs to, as you entered it. |
| `url` | The page address listed in the sitemap. |
| `lastModified` | The last modified date from the sitemap, as `YYYY-MM-DD` or as a full UTC time. `null` when the sitemap has none. |
| `changeFrequency`, `priority` | The optional hints from the sitemap. |
| `sitemapUrl` | The sitemap file where the URL was found. |
| `change` | What happened since your previous run. See below. |
| `previousLastModified` | For updated and removed URLs, the last modified date seen before. |
| `scrapedAt` | When the site was read. |

The `change` field:

| Value | Meaning |
|---|---|
| `new` | The URL was not in the sitemaps before. |
| `updated` | The last modified date is different from the one seen in your previous run. |
| `removed` | The URL is no longer in the sitemaps. |
| `null` | Nothing changed. |

With "Include images, videos, news and language versions" on, every row also has `images` (addresses), `videos`
(title, description, thumbnail, player and content addresses, duration, publication date), `news` (title,
publication, language, publication date) and `alternates` (language and address of each language version).

A summary of the run is saved in the key-value store under `SUMMARY`. For each site it tells how the sitemaps were
found, how many files and URLs were read, the number of changes, and the reason for any site or file that failed.

### How change detection works

The Actor remembers the URLs of each site and their last modified dates in a named key-value store in your account
(`sitemap-extractor-monitor-state`). On the next run it compares the sitemaps with that memory.

- The first run for a site reports every URL as `new`, because nothing has been seen yet.
- `change` is filled in on every run, even when "Only changes" is off. Changed rows come first.
- A change that was not delivered because your spending limit was reached is reported again on the next run.
- `removed` is reported only when every sitemap file of the site was read. If a file failed, or the site has more
  URLs than "Maximum URLs per site", removals wait for a complete run.
- If a site that had URLs comes back empty, nothing is reported as removed. An empty sitemap is far more often a
  temporary problem of the site than a real mass removal.
- The memory is kept per site and per set of "Sitemap file keywords". The filters on URLs and dates only choose
  which rows you receive.

#### Dates you can trust

Many sites do not record when a page changed. They fill the last modified field with the moment the sitemap was
generated, so every page looks freshly modified on every visit. Shopify stores do this for their products, and
static site generators often stamp every page with the build date.

A monitor that believed those dates would report the whole site as updated on every run. This Actor recognizes
them and does not count them as updates:

- a last modified value shared by most URLs of a sitemap file is treated as a generation time;
- a last modified time only minutes old is not counted yet. If the page really changed, the date stays the same
  on the next run and the update is reported then.

`lastModified` always shows what the sitemap says. The number of dates that were not counted is in `SUMMARY`, under
`generatedDatesIgnored`. For sites whose dates are unreliable in other ways, turn "Report updated URLs" off and
track new and removed URLs only.

### Pricing

You pay per URL delivered to the dataset, plus a small fee per run. With "Only changes" on, a quiet day costs
almost nothing, because unchanged URLs are not delivered. Set a maximum cost per run in the run options and the
Actor stops delivering when that limit is reached.

### Notes and limits

- The Actor reads only `robots.txt` and sitemap files. It does not open the pages themselves, so it does not check
  status codes or page content.
- It identifies itself as `sitemap-extractor-monitor` and does not use proxies. A site that refuses automated
  requests is reported as failed in `SUMMARY`.
- A sitemap file that `robots.txt` does not allow is not read and is listed in `SUMMARY`.
- A site with no sitemap in `robots.txt` or at `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`,
  `/wp-sitemap.xml` or `/sitemap.xml.gz` is reported as failed. If you know where its sitemap is, enter that
  address directly.
- The default memory of 512 MB is enough for a few hundred thousand URLs per site. For sites with millions of
  URLs, raise "Maximum URLs per site" and run with 2 GB or more.

### FAQ

**What is a sitemap?**
A file in which a website lists the pages it wants search engines to find, usually at `/sitemap.xml`. Large sites
split it into many files and link them from a sitemap index.

**How do I schedule a daily watch?**
Save a task with "Only changes" on and add a schedule to it. Each run returns only the differences since the
previous one. Connect the dataset to a webhook, a spreadsheet or your own crawler.

**Can I read many sites in one run?**
Yes. Each site is handled on its own, so a failing site does not affect the rest.

**The site has a sitemap but the Actor did not find it.**
Enter the full address of the sitemap file instead of the website address.

**I need another field or another format.**
Open an issue on the Issues tab and it will be considered for the next version.

# Actor input Schema

## `sites` (type: `array`):

One per line. Enter a website, for example example.com, and its sitemaps are found automatically through robots.txt and the usual addresses. Or paste the full address of one sitemap file to read only that file and the files it links to.

## `onlyChanges` (type: `boolean`):

Return only what changed since your previous run: new URLs, URLs with a different last modified date and URLs that left the sitemap. The first run for a site returns every URL, because nothing has been seen yet.

## `detectUpdates` (type: `boolean`):

Mark a URL as updated when its last modified date differs from the one seen in your previous run. Turn this off to track only new and removed URLs, for sites whose last modified dates cannot be trusted.

## `modifiedAfter` (type: `string`):

Keep only URLs whose last modified date is on or after this point. Use a date such as 2026-11-01, or a period counted back from now such as 7 days, 2 weeks or 3 months. URLs without a last modified date are left out when this is set.

## `includePatterns` (type: `array`):

Keep only URLs that match at least one of these. Plain text is searched anywhere in the URL, for example /blog/. Use \* as a wildcard to match the whole URL, for example https://example.com/\*/pricing. Not case sensitive.

## `excludePatterns` (type: `array`):

Leave out URLs that match any of these. Same rules as the field above, for example /tag/ or \*.pdf.

## `sitemapKeywords` (type: `array`):

Read only the sitemap files whose address contains one of these words, for example product or post. Useful on large sites that split their sitemap by section. Sitemap index files are always followed. Each set of keywords keeps its own memory for change detection.

## `includeExtensions` (type: `boolean`):

Add the image addresses, video details, news details and alternate language addresses that the sitemap lists for each URL.

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

Upper limit of URLs read from each site, before the filters. When a site has more URLs than this limit, removed URLs are not reported for it, because the sitemap was not read in full.

## Actor input object example

```json
{
  "sites": [
    "https://www.sitemaps.org"
  ],
  "onlyChanges": false,
  "detectUpdates": true,
  "includeExtensions": false,
  "maxUrlsPerSite": 100000
}
```

# Actor output Schema

## `urls` (type: `string`):

One item per URL found in the sitemaps, with its last modified date and what changed since the previous run.

## `summary` (type: `string`):

For each site: how the sitemaps were found, files read, URLs found and changes, plus sites and files that failed and the reason.

# 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 = {
    "sites": [
        "https://www.sitemaps.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kmswiill/sitemap-extractor-monitor").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 = { "sites": ["https://www.sitemaps.org"] }

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

```

## MCP server setup

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

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/IEc2Dvb48tZGeioEX/builds/KQ4zutqvDxAHj94ji/openapi.json
