# Sitemap URL Extractor: Get All URLs of Any Website (`datawright-labs/sitemap-url-extractor`) Actor

Extract all URLs from any website's sitemap.xml. Auto-discovers sitemaps via robots.txt, follows sitemap indexes, reads .xml.gz, text, RSS and Atom sitemaps, returns lastmod, hreflang, image and news data, and detects new URLs between runs.

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

## Pricing

from $0.16 / 1,000 url extracteds

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

**Extract every URL from a website's sitemap in seconds.** Enter a domain and the Actor finds its sitemaps automatically (robots.txt + common locations), follows **sitemap indexes** of any depth, reads **gzipped `.xml.gz`**, **plain-text**, **RSS** and **Atom** sitemaps, and returns a clean list of URLs with **lastmod**, **changefreq**, **priority**, **hreflang alternates**, **image** and **Google News** data.

Schedule it with a monitoring key and it tells you **which pages are new** since the last run: perfect for tracking competitor blogs, product launches and content changes.

No browser, no crawling of HTML pages: it only reads the sitemaps the site publishes for search engines, so it is **fast and cheap** (hundreds of thousands of URLs per minute).

### What can this sitemap extractor do?

- 🔎 **Auto-discovers sitemaps** from `robots.txt` (`Sitemap:` lines), falling back to `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml`, `/sitemap.xml.gz` and `/sitemap.txt`.
- 🗂️ **Follows sitemap index files recursively** (WordPress, Yoast, Rank Math, Shopify, Wix, Squarespace, Next.js, Docusaurus and custom setups).
- 📦 Reads **gzip-compressed sitemaps**, **text sitemaps** (one URL per line), **RSS 2.0** and **Atom** feeds.
- 🌍 Extracts **hreflang alternates** (`xhtml:link`) so you can audit international SEO.
- 🖼️ Counts and optionally lists **image sitemap** URLs; reads **Google News sitemap** title, publication and date.
- 🧹 **Deduplicates** URLs across all sitemaps of a site and **filters** by URL pattern (contains, wildcard or regex) and **lastmod date** ("modified in the last 7 days").
- 🆕 **New-URL monitoring**: flags every URL with `isNew` versus the previous run and reports new and removed URL counts.
- 🧾 A per-site **SITES report**: which sitemaps were found, URL counts per sitemap and a clear error for every sitemap that failed (404, blocked, not XML, HTML page...).

### Use cases

- **SEO audits & migrations**: get the full list of indexable URLs, compare old vs new sitemaps, check hreflang coverage and lastmod freshness.
- **Competitor monitoring**: get notified when a competitor publishes new blog posts, landing pages, products or docs.
- **Feed a crawler**: use the URL list as start URLs for [Website Content Crawler](https://apify.com/apify/website-content-crawler), our [Bulk PageSpeed & Core Web Vitals Auditor](https://apify.com/datawright-labs/pagespeed-auditor) or our [Website Screenshot API](https://apify.com/datawright-labs/website-screenshot).
- **Content inventories**: count pages per section (`/blog/`, `/products/`, `/docs/`) and see how often they change.
- **News tracking**: read Google News sitemaps for the latest articles from publishers.
- **AI / RAG pipelines**: discover all documentation pages of a product before indexing them.

### How to use it

1. Enter one or more **websites** (`https://example.com`, or just `example.com`) or paste **sitemap URLs** directly.
2. Optionally add **filters** (e.g. `/blog/`), a **Modified after** date (`7 days`) or a **Max URLs per site** limit.
3. Click **Start**. Download the results as JSON, CSV, Excel or HTML, or get them via the API.

To **monitor a site for new pages**: set **Monitoring key** (any name, e.g. `competitor-blogs`), turn on **Output only new URLs**, and create a **Schedule** (e.g. daily). The first run records the baseline; each following run outputs only the new URLs. Connect Slack, email, Google Sheets, Zapier, Make or a webhook to get alerts.

### Input example

```json
{
  "startUrls": ["https://crawlee.dev", "https://www.theguardian.com/sitemaps/news.xml"],
  "includePatterns": ["/docs/"],
  "modifiedAfter": "30 days",
  "maxUrlsPerSite": 5000
}
```

| Field | What it does | Default |
|---|---|---|
| `startUrls` | Websites (auto-discovery) or sitemap URLs | `["https://crawlee.dev"]` |
| `maxUrlsPerSite` | Cap on saved URLs per site, 0 = all | `0` |
| `includePatterns` / `excludePatterns` | Contains text, `*` wildcard or `/regex/` | – |
| `modifiedAfter` | `YYYY-MM-DD` or `7 days`, `24 hours`, `2 weeks` | – |
| `sameHostOnly` | Drop URLs on other hosts | `false` |
| `monitorStateKey` / `onlyNewUrls` | New-URL monitoring | – / `false` |
| `includeAlternates` / `includeImages` / `includeNews` | Extra fields | `true` / `false` / `true` |
| `discoverFromRobotsTxt` / `tryCommonLocations` | Sitemap discovery | `true` / `true` |
| `proxyConfiguration` | Optional Apify Proxy for sites that block | off |

### Output example

One row per unique URL:

```json
{
  "url": "https://crawlee.dev/js/docs/introduction",
  "site": "https://crawlee.dev",
  "sitemapUrl": "https://crawlee.dev/sitemap.xml",
  "sitemapType": "urlset",
  "lastmod": null,
  "lastmodRaw": null,
  "changefreq": "weekly",
  "priority": 0.5,
  "alternates": [],
  "imageCount": 0,
  "discoveredAt": "2026-10-19T15:40:12.345Z"
}
```

With a monitoring key every row also has `"isNew": true|false`. News sitemaps add `newsTitle`, `newsPublicationName`, `newsPublicationDate` and `newsLanguage`. The **SITES** record in the run's key-value store lists every sitemap file found, its type and URL count, skipped sitemaps, and the new/removed URL counts per site.

### How much does it cost to extract sitemap URLs?

You pay **$0.0002 per unique URL** saved ($0.20 per 1,000). Failed sitemaps, filtered-out URLs and unchanged URLs in "only new" mode are free. No start fee.

| Job | URLs | Cost |
|---|---|---|
| Small blog | 300 | **$0.06** |
| 1,000 URLs | 1,000 | **$0.20** |
| Mid-size e-commerce site | 25,000 | **$5** |
| 100,000 URLs | 100,000 | **$20** |
| Daily new-page monitor of 10 competitor sites (~50 new URLs/day) | ~1,500/month | **~$0.30/month** |

- Apify's **free plan includes $5 of monthly credit**, i.e. about **25,000 URLs a month for free**.
- Paid Apify plans get automatic discounts: **Silver -10%**, **Gold and above -20%**.
- Use **Max URLs per site** or **Maximum cost per run** to cap spend.

### Sitemap extractor vs. the alternatives

| | This Actor | Online "sitemap checker" pages | Full website crawler | Writing a script |
|---|---|---|---|---|
| Finds sitemaps via robots.txt + common paths | ✅ | sometimes | – | DIY |
| Nested sitemap indexes, .xml.gz, text, RSS/Atom | ✅ | partial | – | DIY |
| lastmod, hreflang, image and Google News data | ✅ | rarely | ❌ | DIY |
| Many domains per run | ✅ | ❌ one at a time | ✅ | ✅ |
| New / removed URL detection between runs | ✅ | ❌ | ❌ | DIY state |
| Speed / cost | 100k+ URLs per minute, $0.20 per 1,000 | free, capped | slow, renders pages | your time |

### Use it as an API (Python, JavaScript, cURL, MCP)

Every Apify Actor is also a REST API, so you can call this sitemap extractor from your own code, a no-code tool or an AI agent.

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("datawright-labs/sitemap-url-extractor").call(run_input={"startUrls": ["https://crawlee.dev"], "maxUrlsPerSite": 1000})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### JavaScript / Node.js

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('datawright-labs/sitemap-url-extractor').call({"startUrls": ["https://crawlee.dev"], "maxUrlsPerSite": 1000});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### cURL (run and get results in one request)

```bash
curl -X POST "https://api.apify.com/v2/acts/datawright-labs~sitemap-url-extractor/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://crawlee.dev"], "maxUrlsPerSite": 1000}'
```

#### AI agents (MCP)

Add `https://mcp.apify.com/?tools=datawright-labs/sitemap-url-extractor` to Claude, Cursor or any MCP client and the agent can run it as a tool.

Results can also go straight to **Google Sheets, Slack, Make, Zapier, n8n, Airbyte or a webhook** via Apify integrations, and you can run it on a **Schedule**.

### FAQ

#### The site has no sitemap. What happens?

The site is reported in the SITES record with the error "No sitemap found", and you pay nothing. If you know the sitemap address (some sites use custom paths), paste it directly.

**A site returns 403 / 429.**
Some sites block datacenter traffic. Enable **Apify Proxy** in the Proxy section and run again.

#### Does it crawl pages that are not in the sitemap?

No. It reads only sitemaps, which is what makes it fast and cheap. To discover pages by following links, use a crawler such as Website Content Crawler on the URLs this Actor returns.

#### How many URLs can it handle?

Large sites are fine: a test run extracted ~766,000 URLs from apify.com's 18 sitemaps in under 10 seconds of download time. Use 2-4 GB memory for multi-million-URL sites.

#### Is it legal?

Sitemaps are public files that site owners publish specifically so that automated tools can discover their pages. The Actor collects no personal data. You are responsible for how you use the URLs and the pages behind them.

**Something is missing?** Open an issue on the Issues tab; we usually reply within a day.

#### How do I find all pages of a website?

Most sites list every indexable page in their XML sitemap. Enter the domain and this Actor finds and reads all of its sitemaps, returning every URL with its last-modified date. For pages not in the sitemap, run a crawler on top.

#### How do I extract URLs from sitemap.xml to CSV or Excel?

Run the Actor with the sitemap or domain, then download the dataset as CSV/Excel, or send it to Google Sheets with the integration.

#### How can I monitor a competitor's new pages or blog posts?

Set a monitoring key, turn on "only new URLs", and schedule the Actor daily. Each run returns just the pages added since the last run.

### More tools from Datawright Labs

- [Bulk PageSpeed & Core Web Vitals Checker](https://apify.com/datawright-labs/pagespeed-auditor): audit PageSpeed / Lighthouse scores for many URLs.
- [Website Screenshot API](https://apify.com/datawright-labs/website-screenshot): bulk full-page screenshots and PDFs.
- [Google Autocomplete Keyword Scraper](https://apify.com/datawright-labs/autocomplete-keyword-scraper): long-tail keyword ideas from Google, YouTube and Bing.
- [Greenhouse, Lever & Ashby Jobs Scraper](https://apify.com/datawright-labs/ats-jobs-scraper): normalized job feeds from 5 ATS platforms.
- [Broken Link Checker](https://apify.com/datawright-labs/broken-link-checker): find broken links, images and redirects across a whole site.
- [App Store Top Charts & Rank Tracker](https://apify.com/datawright-labs/app-store-top-charts): daily top free/paid/grossing app rankings with rank changes.

Tip: pass the URLs to the **Bulk PageSpeed & Core Web Vitals Checker** or the **Website Screenshot API** to audit or archive a whole site.

Made by **Datawright Labs**: reliable, fairly priced web data tools. Questions or a missing feature? Open an issue on the Issues tab; we usually reply within a day.

# Actor input Schema

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

One per line. Enter a website (e.g. https://example.com or example.com) to auto-discover its sitemaps from robots.txt and common locations, or paste a sitemap URL directly (sitemap.xml, sitemap index, .xml.gz, .txt, RSS or Atom feed).

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

Stop saving URLs for a site after this many (after filters). 0 = no limit. Tip: also set 'Maximum cost per run' in the run options to cap spend.

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

Keep only URLs matching at least one pattern. Plain text = case-insensitive 'contains' (e.g. /blog/), \* = wildcard (e.g. */products/*), or a regular expression between slashes (e.g. //20(25|26)//). Leave empty for all URLs.

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

Drop URLs matching any of these patterns (same syntax as above), e.g. /tag/ or ?page=.

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

Only URLs whose <lastmod> date is on/after this date. Use YYYY-MM-DD or a relative period like '7 days', '24 hours', '2 weeks'. URLs without a lastmod are dropped when this is set. Child sitemaps whose own lastmod is older are skipped entirely, which makes runs much faster.

## `sameHostOnly` (type: `boolean`):

Drop URLs whose hostname differs from the site (www. is ignored). Useful for sitemaps that list CDN or partner URLs.

## `monitorStateKey` (type: `string`):

Give this monitor a name (e.g. competitor-blogs) and schedule the Actor. Each URL then gets isNew = true/false compared with the previous run that used the same key, and the SITES record reports new and removed URL counts. State is kept in your named key-value store 'sitemap-url-extractor-state'.

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

With a monitoring key, save (and pay for) only URLs not seen in the previous run. The first run just records the baseline and outputs nothing.

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

Add the xhtml:link hreflang alternates (language versions) of each URL.

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

Add the list of image URLs from image sitemaps (imageCount is always included).

## `includeNews` (type: `boolean`):

Add news title, publication name, language and publication date from news sitemaps.

## `discoverFromRobotsTxt` (type: `boolean`):

Read the Sitemap: lines of the site's robots.txt.

## `tryCommonLocations` (type: `boolean`):

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

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

Safety limit for huge sitemap indexes.

## `maxConcurrency` (type: `integer`):

How many sitemap files to download at once for each site.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for one sitemap or robots.txt download before retrying.

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

Most sitemaps download fine without a proxy. Enable Apify Proxy if a site blocks you (HTTP 403/429).

## Actor input object example

```json
{
  "startUrls": [
    "https://crawlee.dev",
    "https://www.theguardian.com/sitemaps/news.xml"
  ],
  "maxUrlsPerSite": 500,
  "includePatterns": [],
  "excludePatterns": [],
  "sameHostOnly": false,
  "onlyNewUrls": false,
  "includeAlternates": true,
  "includeImages": false,
  "includeNews": true,
  "discoverFromRobotsTxt": true,
  "tryCommonLocations": true,
  "maxSitemapsPerSite": 1000,
  "maxConcurrency": 5,
  "requestTimeoutSecs": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All extracted URLs with lastmod, changefreq, priority, hreflang alternates, image and news data.

## `sites` (type: `string`):

SITES record: sitemaps discovered per site, URL counts, new/removed URLs (monitoring) and errors.

# 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",
        "https://www.theguardian.com/sitemaps/news.xml"
    ],
    "maxUrlsPerSite": 500
};

// Run the Actor and wait for it to finish
const run = await client.actor("datawright-labs/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",
        "https://www.theguardian.com/sitemaps/news.xml",
    ],
    "maxUrlsPerSite": 500,
}

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

```

## MCP server setup

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