# Sitemap URL Extractor - All Page URLs with Lastmod & Status (`consequential_programmer/sitemap-url-extractor`) Actor

Extract every page URL from any website's XML sitemaps. Auto-finds sitemaps via robots.txt, follows sitemap indexes and .gz files, and returns lastmod, changefreq, priority, images, news, hreflang and optional HTTP status. Filter by pattern or date. No proxy. $0.30 per 1,000 URLs.

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

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 - All Page URLs with Lastmod & Status

**Get every page URL a website lists in its XML sitemaps and export it to JSON, CSV or Excel.** Paste a website (like `example.com`) or a sitemap URL, and the Actor finds the sitemaps, follows every sitemap index and `.xml.gz` file, and returns one clean row per URL with **lastmod date, changefreq, priority, images, Google News and video data, hreflang alternates** and, if you want, the **live HTTP status** of each page.

It uses plain HTTPS requests only: no browser, no proxy, no login. It runs on 256 MB and costs **$0.30 per 1,000 URLs**.

### How sitemaps are found

| You paste | What happens |
| --- | --- |
| A website: `https://example.com` or `example.com` | Reads `Sitemap:` lines in **robots.txt**, then tries common locations (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `/sitemap.xml.gz`, `/sitemap.txt`, ...), then `<link rel="sitemap">` on the home page |
| A sitemap: `https://example.com/sitemap.xml` | Read directly |
| A sitemap index | Every child sitemap is followed (nested indexes too) |
| A `.xml.gz` file | Decompressed automatically |
| A text sitemap (`sitemap.txt`, one URL per line) | Supported |
| An RSS or Atom feed (`/feed/`, `.rss`, `.atom`) | Supported - URL, title and publication date |

Works with WordPress (Yoast, Rank Math, core `wp-sitemap.xml`), Shopify, Wix, Squarespace, Webflow, Ghost, Next.js, Docusaurus and any other site that publishes a standard sitemap.

### What you get for each URL

- 🔗 **URL** plus its domain, the sitemap file it came from and the parent sitemap index
- 🕒 **lastmod** normalized to ISO-8601 UTC, **changefreq** and **priority**
- 🖼️ **Images** from image sitemaps (count and up to 20 image URLs)
- 📰 **Google News** title, publication name and publication date
- 🎬 **Video** count, first video title and thumbnail
- 🌍 **hreflang alternates** (`[{hreflang, url}]`) for multilingual sites
- ✅ **HTTP status** (optional): `statusCode`, `finalUrl`, `redirected`, `contentType` - find 404s and redirects listed in your sitemap

### Why use this sitemap extractor?

- **Paste a domain, not a sitemap.** Sitemap discovery via robots.txt, common paths and the home page, so you don't have to hunt for the sitemap location.
- **Complete.** Nested sitemap indexes, gzip, text sitemaps, RSS/Atom, image, news, video and hreflang extensions.
- **Filters that save money.** Include/exclude URL patterns (plain text or `re:` regular expressions), "modified within N days" and same-domain-only. Filtered-out URLs and duplicates are not charged.
- **Optional status check** with HEAD requests (GET fallback for servers that reject HEAD) to audit a sitemap for broken or redirected pages.
- **Fair pricing.** Sites without a sitemap, invalid inputs and failed requests are free error rows. Set a maximum cost per run and the Actor stops cleanly when it is reached.
- **Fast and light.** Streams huge sitemaps (50,000 URLs per file) on 256 MB with retries, back-off and per-request timeouts.

### Use cases

- **SEO audits:** list every indexable URL, check lastmod freshness and find 404s or redirects in the sitemap
- **Crawling and RAG:** get a clean URL list to feed into a content scraper, an LLM knowledge base or a vector database
- **Competitor monitoring:** schedule a daily run with `modifiedWithinDays: 1` to see new and updated pages (products, blog posts, landing pages)
- **Site migrations:** export the full URL inventory before and after a redesign to build redirect maps
- **E-commerce research:** pull every product or collection URL with `includePatterns: ["/products/"]`
- **AI agents and automations:** call it from the API, n8n, Make or Zapier to get a site's URL list on demand

### How to use it

1. Add websites or sitemap URLs under **Websites or sitemap URLs**, one per line.
2. Optionally add **Include** / **Exclude** patterns, **Modified within (days)** or turn on **Check HTTP status**.
3. Set **Max URLs per site** (0 = all) and click **Start**.
4. Download the **URLs overview** view or all fields as CSV, Excel or JSON. The `SUMMARY` record shows how each site's sitemaps were found.

#### Example input

```json
{
  "startUrls": [
    "https://blog.cloudflare.com",
    "https://crawlee.dev/python/sitemap.xml",
    "example-shop.com"
  ],
  "maxUrlsPerSite": 1000,
  "includePatterns": ["/blog/", "re:/20(25|26)/"],
  "excludePatterns": ["/tag/", "?page="],
  "modifiedWithinDays": 30,
  "keepUrlsWithoutLastmod": true,
  "sameDomainOnly": false,
  "checkStatus": false
}
```

#### Example output (one URL)

```json
{
  "type": "url",
  "url": "https://blog.cloudflare.com/enabling-google-analytics-on-wordpress-blog",
  "domain": "blog.cloudflare.com",
  "site": "https://blog.cloudflare.com",
  "sitemapUrl": "https://blog.cloudflare.com/sitemap-posts.xml",
  "parentSitemapUrl": "https://blog.cloudflare.com/sitemap.xml",
  "sitemapFormat": "xml",
  "lastmod": "2026-07-15T12:25:22Z",
  "changefreq": null,
  "priority": null,
  "alternates": [
    { "hreflang": "en-us", "url": "https://blog.cloudflare.com/enabling-google-analytics-on-wordpress-blog" },
    { "hreflang": "x-default", "url": "https://blog.cloudflare.com/enabling-google-analytics-on-wordpress-blog" }
  ],
  "statusCode": 200,
  "finalUrl": "https://blog.cloudflare.com/enabling-google-analytics-on-wordpress-blog",
  "redirected": false,
  "contentType": "text/html",
  "scrapedAt": "2026-11-23T08:30:00Z"
}
```

`statusCode`, `finalUrl`, `redirected` and `contentType` are only added when **Check HTTP status** is on. Image, news and video fields appear when the sitemap contains them.

Inputs that can't be processed produce a free row, for example `{"type": "error", "input": "https://example.com", "errorMessage": "Skipped (not charged): no sitemap found in robots.txt, common locations or the home page - paste the sitemap URL directly"}`. A run summary (URLs, sitemap files parsed, how each site's sitemaps were found, failed sitemap files) is saved to the `SUMMARY` record in the key-value store.

### Pricing

Pay per event. You only pay for URLs that are saved to your dataset:

| Event | What it is | Price |
| --- | --- | --- |
| `url-extracted` | One unique URL saved | $0.30 / 1,000 URLs ($0.0003 each) |
| Actor start | Once per run (set by Apify, scales with memory) | $0.001 |

Example: 10,000 URLs cost about $3.00. The HTTP status check is included at no extra charge. Sites without a sitemap, invalid inputs, filtered-out URLs, duplicates and failed requests are free.

### Tips and limits

- **No sitemap found?** Some sites don't publish one, or keep it at an unusual path. Paste the sitemap URL directly if you know it (check `/robots.txt`).
- **Big sites:** use **Max URLs per site** for a quick test first. **Max sitemap files per site** (default 1,000) protects against endless sitemap indexes.
- **Date filter:** `lastmod` is set by the site owner and isn't always accurate. URLs without a lastmod are kept by default (turn off **Keep URLs without lastmod** to drop them).
- **Status check** sends one light request per URL to the website. Keep **Max concurrency** low for small sites.
- Pages that are not listed in any sitemap are not discovered. This Actor reads sitemaps; it does not crawl links.

### Legal

The Actor only reads robots.txt files, sitemaps and feeds that website owners publish so that machines can discover their pages. It does not log in anywhere, bypass any protection or collect personal data. You are responsible for how you use the URLs you extract.

### FAQ

- **How am I charged?** $0.0003 per URL saved plus a $0.001 start fee. Error rows, duplicates and filtered-out URLs are free.
- **How fresh is the data?** Live. Every run downloads the current sitemaps.
- **Can I get only new pages?** Yes. Schedule a daily run with `modifiedWithinDays: 1`.
- **What if I leave the input empty?** The Actor falls back to a sample site (blog.cloudflare.com, 20 URLs), logs a warning and still writes a dataset.
- **Is there a limit?** Up to 1,000 websites per run and up to 1,000,000 URLs per site.

# Actor input Schema

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

One per line. Paste a website (example.com or https://example.com - its sitemaps are found automatically via robots.txt, common locations like /sitemap.xml and the home page) or a direct sitemap URL (sitemap.xml, sitemap_index.xml, .xml.gz, .txt, RSS or Atom feed). Max 1,000 per run.

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

Stop after this many URLs per website. 0 = all URLs. Use a small number for a quick test.

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

Keep only URLs that contain at least one of these texts (case-insensitive), e.g. /blog/ or /products/. Start with re: for a regular expression, e.g. re:/20(24|25)/. Leave empty to keep all URLs.

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

Drop URLs that contain any of these texts (or re: regular expressions), e.g. /tag/ or ?page=. Excluded URLs are not charged.

## `modifiedWithinDays` (type: `integer`):

Keep only URLs whose sitemap lastmod (or news publication date) is within the last N days - great for finding new or updated pages. 0 = no date filter.

## `keepUrlsWithoutLastmod` (type: `boolean`):

When the date filter is on, also keep URLs that have no lastmod date in the sitemap.

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

Drop URLs that point to another domain than the website you entered (subdomains are kept).

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

Send a lightweight HEAD request to every saved URL and add statusCode, finalUrl, redirected and contentType - find broken (404) and redirected pages in your sitemap. Slower; same price.

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

Safety limit on how many sitemap files (including nested index files) are read per website.

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

How many websites are processed in parallel (status checks use twice this number).

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

Timeout for each request. Failed requests are retried automatically with back-off.

## Actor input object example

```json
{
  "startUrls": [
    "https://blog.cloudflare.com",
    "https://crawlee.dev/python/sitemap.xml"
  ],
  "maxUrlsPerSite": 100,
  "includePatterns": [],
  "excludePatterns": [],
  "modifiedWithinDays": 0,
  "keepUrlsWithoutLastmod": true,
  "sameDomainOnly": false,
  "checkStatus": false,
  "maxSitemapsPerSite": 1000,
  "maxConcurrency": 5,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

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

No description

## `allItems` (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://blog.cloudflare.com",
        "https://crawlee.dev/python/sitemap.xml"
    ],
    "maxUrlsPerSite": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("consequential_programmer/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://blog.cloudflare.com",
        "https://crawlee.dev/python/sitemap.xml",
    ],
    "maxUrlsPerSite": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("consequential_programmer/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://blog.cloudflare.com",
    "https://crawlee.dev/python/sitemap.xml"
  ],
  "maxUrlsPerSite": 100
}' |
apify call consequential_programmer/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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