# Sitemap Extractor & New Page Monitor (`pegton/sitemap-extractor`) Actor

Every URL a website lists in its sitemaps: robots.txt discovery, nested indexes, gzip, Google News titles, images, hreflang. Optional HTTP status check, a site summary row and a monitor that returns only new URLs since the last run.

- **URL**: https://apify.com/pegton/sitemap-extractor.md
- **Developed by:** [Rafael Iovi](https://apify.com/pegton) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **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 urls

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 & New Page Monitor

**Get every URL a website lists in its sitemaps, and find out which pages are new since your last run. Give it a domain, a page or a sitemap URL. The Actor finds the sitemaps through robots.txt and the usual paths, walks nested sitemap indexes and gzip files, and returns each URL with lastmod, changefreq, priority, Google News title and date, image and video data and hreflang language versions. An optional status check flags 404s and redirects. A summary row per site shows how big and how fresh the site is.**

Schedule it daily with `onlyNewUrls` and it becomes a **competitor page monitor**: new products, blog posts, landing pages, job pages or news articles, the same day they appear in the sitemap.

### Why this Actor

| | |
|---|---|
| 🧭 **Finds the sitemaps for you** | robots.txt `Sitemap:` lines first, then `/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `/sitemap.xml.gz`, `/sitemap.txt` and more. Nested indexes, gzip, RSS/Atom and plain-text sitemaps all work. Broken XML is read leniently instead of failing the run. |
| 🆕 **New-page monitor** | `onlyNewUrls` remembers every URL per site. Later runs return only URLs that appeared since, and the summary row reports `removedSinceLastRun` with a sample. In our test, a daily-style rerun on BBC's news sitemap caught 2 new articles and 1 removed one within 90 seconds. |
| 📰 **Rich fields, not just URLs** | `lastmod`, `changefreq`, `priority`, Google News `newsTitle`, `newsPublishedAt` and `newsKeywords`, image count, video titles, hreflang alternates, plus the sitemap file each URL came from. |
| 🩺 **Optional status check** | `checkStatus` sends a HEAD request (GET if HEAD is refused) to each URL: status code, final URL, redirect flag, content type and the Last-Modified header. Use it to find dead pages that are still in the sitemap. |
| 📊 **Site summary** | One row per site: total URLs, sitemap files, top sections (`/blog`, `/products` ...), share of URLs with lastmod, newest and oldest lastmod, URLs updated in the last 7 and 30 days, lastmod by year, news and image counts, hreflang languages and status counts. |
| 🎯 **Filters** | `includePatterns` / `excludePatterns` (text or `/regex/`) and `lastmodWithinDays`. Only matching URLs are delivered and charged. The summary still counts the whole site. |
| 🤝 **Polite and legal** | Respects robots.txt and Crawl-delay, uses an identifiable user agent and limits parallel requests per site. Sites that block automated access are reported as a free error row. Blocks are never bypassed. |

### Use cases

- **Competitor monitoring:** new product pages, pricing pages, landing pages, integrations or job pages, every morning.
- **SEO audits:** URL inventory, freshness (lastmod by year), sections, hreflang coverage, and 404s or redirects that are still listed in the sitemap.
- **Content and news tracking:** headlines and publication times from Google News sitemaps (BBC, heise, most publishers).
- **Feeding crawlers and AI pipelines:** a clean, deduplicated URL list for Website Content Crawler, screenshot tools or RAG indexing. With `onlyNewUrls`, only the delta.
- **Migrations:** compare old and new URL sets before and after a relaunch.

### Measured on real sites (18 Nov 2026)

| Site | Sitemap files | URLs | Notes |
|---|---|---|---|
| apify.com | 24 | 1,013,499 | Scanning the first 500,000 took 10 s at 344 MB peak memory. |
| wordpress.org | 294 | 202,844 | 9 sitemaps listed in robots.txt. |
| heise.de | 1 | 9,984 | 200 URLs updated in the last 3 days, all 12 sampled returned 200. |
| stripe.com | 10 | 7,360 | Up to 76 hreflang language versions per page. |
| bbc.com news sitemap | 4 | 2,184 | Every URL has a news headline and publication time. |

A run over 8 inputs, including invalid ones and sites without a sitemap, took 47 s.

### Input examples

**All URLs of a site**

```json
{ "startUrls": ["stripe.com"] }
```

**Daily monitor: only new blog posts and product pages of three competitors**

```json
{
  "startUrls": ["competitor-a.com", "https://competitor-b.com/sitemap_index.xml", "competitor-c.de"],
  "includePatterns": ["/blog/", "/products/"],
  "onlyNewUrls": true
}
```

Save it as a task and add a daily schedule. The first run saves the current URLs, and every later run returns only URLs that are new.

**News published in the last 2 days, with status check**

```json
{
  "startUrls": ["https://www.bbc.com/sitemaps/https-index-com-news.xml", "heise.de"],
  "lastmodWithinDays": 2,
  "checkStatus": true,
  "maxUrlsPerSite": 500
}
```

### Output

**URL row** (real values, from the monitor test: this article was new on the second run)

```json
{
  "type": "url",
  "site": "https://www.bbc.com",
  "url": "https://www.bbc.com/news/articles/cqglryg6k44ko",
  "path": "/news/articles/cqglryg6k44ko",
  "section": "/news",
  "lastmod": "2026-11-18T20:12:18Z",
  "newsTitle": "Mobo founder Kanya King has stone laid in her honour",
  "newsPublishedAt": "2026-11-18T20:12:18Z",
  "newsPublication": "BBC News",
  "newsLanguage": "en",
  "images": 0,
  "isNew": true,
  "sitemap": "https://www.bbc.com/sitemaps/https-sitemap-com-news-1.xml"
}
```

With `checkStatus`, each row also gets `status`, `finalUrl`, `redirected`, `contentType` and `lastModifiedHeader`.

**Site summary row** (real values, shortened)

```json
{
  "type": "site",
  "site": "https://heise.de",
  "totalUrls": 9984,
  "matchingUrls": 200,
  "sitemapFilesParsed": 1,
  "urlsWithLastmodPct": 99.3,
  "urlsUpdatedLast7Days": 372,
  "topSections": [{"section": "/news", "urls": 7402}, {"section": "/hintergrund", "urls": 761}, {"section": "/bestenlisten", "urls": 611}],
  "newUrls": null,
  "removedSinceLastRun": null,
  "statusCounts": {"200": 12}
}
```

Sites without a sitemap, invalid inputs and blocked sites produce an uncharged `error` row (`no_sitemap_found`, `access_denied`, `blocked_by_robots_txt`, `invalid_input`). The dataset has three views: **URLs**, **Site summary** and **Errors**. `RUN_SUMMARY` in the key-value store has the request counts and the estimated charge.

### Pricing (pay per event)

| Event | Price | When it's charged |
|---|---|---|
| URL | **$0.0001** ($0.10 per 1,000 URLs) | Each URL row delivered. Filtered-out URLs and URLs skipped by `onlyNewUrls` are free. |
| Status check | $0.0002 | Only with `checkStatus`, per URL checked. |
| Site summary | $0.001 | One per site (turn off with `includeSiteSummary: false`). |
| Actor start | $0.00005 | Apify's standard start event. |

Examples: all 7,360 URLs of stripe.com cost about $0.74. A daily monitor of 10 competitor sites that finds 30 new pages a day costs about $0.013 per day. `maxItems` and `maxChargeUsd` stop a run before it costs more than you want.

### FAQ

**Does it crawl the website?**
No. It reads only the sitemaps, which the site publishes for crawlers. With `checkStatus` on, it sends one light request per delivered URL. Nothing else is downloaded.

**The site has no sitemap. What now?**
You get a free `no_sitemap_found` error row. If you know the sitemap address, paste it directly. Many shops and CMSs use names like `/sitemap_products_1.xml` or `/post-sitemap.xml`.

**How big can a site be?**
Up to `maxUrlsToScanPerSite` URLs per site (default 300,000) and `maxSitemapsPerSite` sitemap files (default 1,000). Sitemap files are parsed as a stream, so the default 1 GB of memory is enough. In our test, apify.com (500,000 URLs scanned), wordpress.org (202,844) and heise.de together peaked at 361 MB. For bigger sites, raise both limits and give the run more memory.

**How does the monitor work?**
URL hashes are stored per site in the named key-value store `sitemap-monitor-state` in your account. The first run delivers the current URLs (within your filters), and later runs deliver only new ones. `removedSinceLastRun` counts URLs that disappeared.

**Is it legal?**
Sitemaps are public files that sites publish so crawlers can find their pages. The Actor follows robots.txt and Crawl-delay, doesn't log in, doesn't use cookies and doesn't bypass any block. The output is page URLs and metadata, not personal data.

**Something doesn't work?**
Open an issue on the Issues tab with the site. Most fixes ship the same day.

### Related tools by pegton

- [Website Screenshot & Change Monitor](https://apify.com/pegton/website-screenshot-monitor): screenshot the new pages this Actor finds, and get visual diffs when they change.
- [Website Contact Details Scraper](https://apify.com/pegton/website-contact-enricher): emails, phones and social profiles from company websites.
- [Free Website Change Monitor for n8n](https://pegton.gumroad.com/l/website-change-monitor-n8n): a ready-made alert workflow.

# Actor input Schema

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

One per line: a domain (example.com), any page URL, or a sitemap URL (https://example.com/sitemap.xml, .xml.gz, sitemap index, RSS feed or .txt). Domains are discovered via robots.txt, then the usual sitemap paths.

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

Case-insensitive text, e.g. /blog/ or /products/. Wrap in slashes for a regex: //20(25|26)//

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

Same syntax, e.g. /tag/ or ?page=

## `lastmodWithinDays` (type: `integer`):

Uses the sitemap's lastmod (or the news publication date). URLs without a date are excluded when this is set. 0 = no date filter.

## `onlyNewUrls` (type: `boolean`):

Remembers every URL per site. The first run delivers the current URLs; later runs deliver only URLs that appeared since, and the site summary reports how many disappeared. Schedule it daily to catch competitors' new pages, products, articles or job pages.

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

Sends a HEAD request (GET if HEAD is refused) to every delivered URL: status, final URL after redirects, content type, Last-Modified header. Finds 404s and redirects that are still listed in the sitemap. Respects robots.txt and Crawl-delay.

## `includeSiteSummary` (type: `boolean`):

One row per site: total URLs, sitemap files, sections, lastmod freshness by year, news and image counts, hreflang languages, new and removed URLs.

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

Adds the full list of language versions (hreflang + URL) per page. Off by default because it can be large; alternatesCount and the summary's hreflangLanguages are always included.

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

0 = all. The summary always counts every URL found.

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

Safety limit for huge sitemap indexes.

## `maxUrlsToScanPerSite` (type: `integer`):

Safety limit for memory on giant sites (300,000 URLs need about 300 MB). The site summary counts up to this many URLs. Raise it, and the run memory, for sites with millions of URLs.

## `maxConcurrencyPerSite` (type: `integer`):

Be polite: 4 is plenty for sitemap files. A Crawl-delay in robots.txt is always respected.

## `maxItems` (type: `integer`):

Stop after this many URL rows (0 = no limit).

## `maxChargeUsd` (type: `number`):

Stop before this amount would be exceeded. The run's own max-charge setting is always respected too.

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

Usually not needed. Sites that block automated access are reported as errors, never bypassed.

## Actor input object example

```json
{
  "startUrls": [
    "https://stripe.com"
  ],
  "onlyNewUrls": false,
  "checkStatus": false,
  "includeSiteSummary": true,
  "includeAlternates": false,
  "maxUrlsPerSite": 100,
  "maxSitemapsPerSite": 1000,
  "maxUrlsToScanPerSite": 300000,
  "maxConcurrencyPerSite": 4,
  "maxItems": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `sites` (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://stripe.com"
    ],
    "maxUrlsPerSite": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("pegton/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://stripe.com"],
    "maxUrlsPerSite": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("pegton/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://stripe.com"
  ],
  "maxUrlsPerSite": 100
}' |
apify call pegton/sitemap-extractor --silent --output-dataset

```

## MCP server setup

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