# Sitemap Scraper: Extract All URLs from XML Sitemaps (`berryish_pillar/sitemap-url-extractor`) Actor

Get every URL a website lists in its XML sitemaps (index, gzip, news, image, hreflang), with lastmod, priority and news titles. Auto-finds sitemaps via robots.txt. Monitor mode outputs only URLs that are new since the last run. $0.30 per 1,000 URLs.

- **URL**: https://apify.com/berryish_pillar/sitemap-url-extractor.md
- **Developed by:** [berryish_pillar](https://apify.com/berryish_pillar) (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

Pay per event

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 URL Extractor & New-URL Monitor: get all URLs from any website

Give it a domain or a sitemap URL and get **every URL the site publishes in its XML sitemaps**, with **lastmod, changefreq, priority, image counts, Google News titles and hreflang alternates**. It finds sitemaps automatically through **robots.txt** and common paths, follows **sitemap indexes**, and reads **.xml.gz** and plain-text sitemaps.

Turn on **monitor mode** and schedule it to get **only the URLs that are new since the last run**: new products, blog posts, job pages, news articles or landing pages on any site.

**$0.30 per 1,000 URLs.** Sitemap reads and robots.txt requests are free.

### What can it do?

- 🌐 **Domain in, all URLs out.** `apify.com` gives you every URL from every sitemap that robots.txt lists, across nested indexes. In our test that was 1,003,479 URLs from 23 sitemap files in seconds.
- 🗂️ **Every sitemap format**: sitemap index, urlset, gzip, Google News (`news:title`, publication date), image sitemaps, hreflang `xhtml:link` alternates, plain-text sitemaps.
- 🆕 **New-URL monitor**: remembers every URL per site and outputs only new ones. `RUN_SUMMARY` also counts URLs **removed** since the last run. URL memory needs a run with full permissions or from the Actor owner's account; limited-permission runs still extract every sitemap URL, but treat all of them as first-seen.
- 🔎 **Filters**: include/exclude regex, `lastmod` on or after a date, same-domain only.
- ⚡ **Fast and cheap**: no browser, no page crawling. It reads only the sitemap files.
- 🤖 **Polite**: robots.txt respected, rate limited per host, retries with backoff, per-site timeout.

### Who uses this?

- **SEO teams**: inventory a site, compare against a crawl, find pages missing from Google.
- **Competitive intelligence**: get alerts when a competitor publishes new product, pricing, landing or docs pages.
- **AI / RAG pipelines**: get the clean URL list to feed into a content crawler, and only re-crawl what changed (`lastmodAfter`, `onlyNewUrls`).
- **News and content monitoring**: track new articles via Google News sitemaps with titles and timestamps.
- **E-commerce**: watch for new product URLs on any store (pairs with our [Shopify Products Monitor](https://apify.com/berryish_pillar/shopify-products-monitor)).

### How to use it

1. Add domains or sitemap URLs.
2. Optionally set **Max URLs per site**, filters, or turn on **Only URLs that are new since the last run**.
3. Click **Start** and download JSON, CSV or Excel, or read the dataset from the API. Add a **Schedule** for monitoring.

#### Input example

```json
{
  "startUrls": [{ "url": "https://apify.com" }, { "url": "https://www.nytimes.com/sitemaps/new/news.xml.gz" }],
  "maxUrlsPerSite": 1000,
  "includeUrlPatterns": [],
  "onlyNewUrls": false
}
```

#### Output example

```json
{
  "site": "nytimes.com",
  "url": "https://www.nytimes.com/es/2026/11/16/espanol/estilos-de-vida/apego-ansioso-evitativo-seguro.html",
  "lastmod": "2026-11-16T06:07:13Z",
  "changefreq": null,
  "priority": null,
  "imageCount": 0,
  "newsTitle": "¿Tienes un apego ansioso, evitativo o seguro?",
  "newsPublicationDate": "2026-11-16T06:07:13Z",
  "alternates": [],
  "sitemap": "https://www.nytimes.com/sitemaps/new/news.xml.gz",
  "isNew": null,
  "scrapedAt": "2026-11-17T16:53:17Z"
}
```

### How much does it cost?

Pay per event:

| Event | Price |
|---|---|
| URL returned | $0.0003 ($0.30 per 1,000 URLs) |

Examples: a 5,000-page site costs **$1.50**. A daily new-URL monitor on 30 competitor sites that finds 100 new URLs a day costs **$0.03 a day**. In monitor mode you pay only for new URLs. Set **Maximum cost per run** in run options and the Actor stops cleanly at that amount.

### Tips and limits

- The Actor only knows what the sitemap lists. Sites without a sitemap return `no_sitemap` in `RUN_SUMMARY` (you're not charged). Use our [SEO Site Audit](https://apify.com/berryish_pillar/seo-site-audit) to crawl those by links.
- For sites with more than 350,000 URLs, new-URL tracking isn't saved (the URL list is still returned).
- `lastmod` is whatever the site publishes; some sites set it to the crawl date for every URL.

### Is it legal? Responsible use

Sitemaps are files that websites publish specifically so that machines can discover their URLs. The Actor reads only those files and robots.txt, identifies itself and respects robots.txt. It collects no personal data.

### FAQ

**Does it visit every page?** No. It reads the sitemap files only, which is why it's fast and cheap.

**Can I pass a specific sitemap?** Yes. Paste its URL directly, including `.xml.gz` files and news sitemaps.

# Actor input Schema

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

A domain or homepage (sitemaps are found through robots.txt and common paths), or a direct sitemap URL (.xml, .xml.gz, sitemap index, news sitemap, or a plain-text sitemap).

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

0 = all URLs. You pay per URL in the output.

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

Stop after this many URLs across all sites. 0 = no limit.

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

Optional, e.g. /blog/ or /products/.

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

Optional, e.g. /tag/ or ?

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

Uses the sitemap's lastmod. URLs without lastmod are skipped when this is set.

## `sameDomainOnly` (type: `boolean`):

Drop sitemap entries that point to other domains.

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

Remembers every URL per site (per Monitor ID) and outputs, and charges for, only new ones. The first run outputs everything as the baseline. Schedule it to track new pages, products or articles on any site.

## `monitorId` (type: `string`):

Name for the remembered URL lists. Use a different ID per watchlist.

## `rememberUrls` (type: `boolean`):

Save the URL list (when the whole sitemap was read and no filters are set) so later runs can mark isNew and count removed URLs.

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

Safety cap for huge sitemap indexes.

## `maxConcurrentSites` (type: `integer`):

How many sites to process at the same time.

## `maxRequestsPerSecondPerHost` (type: `number`):

Politeness cap. A stricter robots.txt Crawl-delay wins.

## `respectRobotsTxt` (type: `boolean`):

Skip sitemap files that robots.txt disallows.

## `siteTimeoutSecs` (type: `integer`):

A site that takes longer is stopped; URLs already output are kept.

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

Retries with backoff on timeouts, 429 and 5xx.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://www.nytimes.com/sitemaps/new/news.xml.gz"
    }
  ],
  "maxUrlsPerSite": 1000,
  "maxUrls": 0,
  "sameDomainOnly": true,
  "onlyNewUrls": false,
  "monitorId": "default",
  "rememberUrls": true,
  "maxSitemapsPerSite": 500,
  "maxConcurrentSites": 3,
  "maxRequestsPerSecondPerHost": 2,
  "respectRobotsTxt": true,
  "siteTimeoutSecs": 1800,
  "maxRetries": 3
}
```

# Actor output Schema

## `urls` (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": [
        {
            "url": "https://apify.com"
        },
        {
            "url": "https://www.nytimes.com/sitemaps/new/news.xml.gz"
        }
    ],
    "maxUrlsPerSite": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("berryish_pillar/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": [
        { "url": "https://apify.com" },
        { "url": "https://www.nytimes.com/sitemaps/new/news.xml.gz" },
    ],
    "maxUrlsPerSite": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("berryish_pillar/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": [
    {
      "url": "https://apify.com"
    },
    {
      "url": "https://www.nytimes.com/sitemaps/new/news.xml.gz"
    }
  ],
  "maxUrlsPerSite": 1000
}' |
apify call berryish_pillar/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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