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

Scrape every URL listed in a website's XML sitemaps, with lastmod, changefreq and priority. Finds sitemaps through robots.txt, follows sitemap indexes, reads .xml.gz and plain-text sitemaps, and filters by URL text or modification date. Pay only per URL.

- **URL**: https://apify.com/lowcountrytech/sitemap-urls-extractor.md
- **Developed by:** [Lowcountry Tech Solutions LLC](https://apify.com/lowcountrytech) (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.35 / 1,000 sitemap urls

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

Scrape any website's XML sitemaps into a clean list of URLs with their last-modified dates, in one run.

**No login · No proxy needed · JSON, CSV, Excel or API · Tested daily**

Sample output from the default input:

| URL | Lastmod | Changefreq | Priority | Sitemap URL |
|---|---|---|---|---|
| crawlee.dev/blog | — | weekly | 0.5 | crawlee.dev/sitemap.xml |
| crawlee.dev/blog/archive | — | weekly | 0.5 | crawlee.dev/sitemap.xml |
| crawlee.dev/blog/authors | — | weekly | 0.5 | crawlee.dev/sitemap.xml |

### What does Sitemap Scraper do?

Give it a website and it reads robots.txt to find the sitemaps the site declares, falling back to `/sitemap.xml` and `/sitemap_index.xml`. It follows sitemap indexes into their child sitemaps, decompresses `.xml.gz` files, reads plain-text `sitemap.txt` files, and returns one row per URL with `lastmod`, `changefreq`, `priority`, hreflang alternates and image count, plus the sitemap file it came from. You can also paste sitemap URLs directly. Filters keep only the URLs you care about, e.g. everything under `/blog/` modified since last month.

- Automatic discovery through robots.txt `Sitemap:` lines, with sensible fallbacks
- Follows nested sitemap indexes, with limits on depth and file count
- Reads gzip-compressed `.xml.gz` sitemaps and plain-text sitemaps
- Filter by URL text (include and exclude) and by lastmod date
- Duplicates across sitemaps are removed, so each URL is charged once

### Who is it for?

- SEO agencies building a full URL inventory before an audit or migration
- Content teams listing every article changed since a date
- Feeding URL lists into other actors (meta-tag checks, link checks, page-to-Markdown) instead of crawling
- Competitive research: how many product, blog or docs pages a competitor publishes, and how often they change
- Monitoring a site's sitemap for new or removed pages on a schedule

### How much does it cost?

This actor uses **pay-per-event** pricing, so you pay only for what you get:

| Event | Price |
|---|---|
| Sitemap URL (per URL) | $0.0005 ($0.50 per 1,000) |
| Actor start (per run) | $0.00005 |

Paid Apify plans get the Store's discount tiers on the URL price: $0.45 per 1,000 at Bronze, $0.40 at Silver, and $0.35 at Gold and above.

The default input returns up to 100 URLs, which costs about $0.05. Apify's free plan includes monthly credit that covers thousands of URLs. Set **Maximum URLs** or a maximum cost per run to cap spending.

### How to use it

1. Click **Try for free**.
2. Enter one or more websites, or paste sitemap URLs directly.
3. Optionally set URL filters or a Modified-after date, and raise **Maximum URLs** for big sites.
4. Click **Start** and download the URLs as CSV, Excel or JSON.

### Input

| Field | Type | Description | Default |
|---|---|---|---|
| `startUrls` | array | A website (`https://example.com` or `example.com`) to discover its sitemaps through robots.txt, falling back to `/sitemap.xml` and `/sitemap_index.xml`. Or a direct sitemap URL (`https://example.com/post-sitemap.xml`, `.xml.gz`, or a plain-text `sitemap.txt`). | `["https://crawlee.dev"]` |
| `urlContains` | array of strings | Keep only URLs that contain any of these strings (case-insensitive), e.g. `/blog/`. Leave empty to keep all. | `[]` |
| `urlExcludes` | array of strings | Drop URLs that contain any of these strings (case-insensitive), e.g. `/tag/`. | `[]` |
| `lastmodAfter` | string | Keep only URLs whose `lastmod` is on or after this date (`YYYY-MM-DD`). URLs without a lastmod are dropped when this is set. Leave empty to keep all. | `""` |
| `maxSitemaps` | integer | Stop opening new sitemap files after this many per run (sitemap indexes count too). Hard limit 500. | `20` |
| `maxDepth` | integer | How many levels of nested sitemap indexes to follow. 1 reads the sitemaps listed in the first index only. | `3` |
| `maxItems` | integer | Stop after this many URLs. You are charged per URL, so this also caps the cost of a run. Use 0 for no limit. | `100` |
| `proxyConfiguration` | object | Optional. The target is a public page or API and normally works without a proxy. | `{"useApifyProxy":false}` |

Example input:

```json
{
  "startUrls": [
    "https://crawlee.dev"
  ],
  "urlContains": [],
  "urlExcludes": [],
  "lastmodAfter": "",
  "maxSitemaps": 20,
  "maxDepth": 3,
  "maxItems": 100
}
```

### Output

Each URL is one record in the dataset:

| Field | Type | Description |
|---|---|---|
| `url` | string | Page URL (the sitemap's <loc>). |
| `lastmod` | string or null | Last modification date as published in the sitemap (W3C datetime). |
| `changefreq` | string or null | Declared change frequency (always, hourly, daily, weekly, monthly, yearly, never). |
| `priority` | number or null | Declared priority between 0.0 and 1.0. |
| `alternates` | array | Language alternates from \<xhtml:link rel="alternate" hreflang>: objects with lang and href. |
| `imageCount` | integer | Number of <image:image> entries for this URL. |
| `sitemapUrl` | string | The sitemap file this URL was listed in. |
| `site` | string | Origin of the website (scheme and host) the sitemap belongs to. |
| `scrapedAt` | string | When this record was scraped (ISO 8601). |

Sample:

```json
[
  {
    "url": "https://crawlee.dev/blog",
    "lastmod": null,
    "changefreq": "weekly",
    "priority": 0.5,
    "alternates": [],
    "imageCount": 0,
    "sitemapUrl": "https://crawlee.dev/sitemap.xml",
    "site": "https://crawlee.dev",
    "scrapedAt": "2026-10-20T12:00:00.000Z"
  },
  {
    "url": "https://crawlee.dev/blog/archive",
    "lastmod": null,
    "changefreq": "weekly",
    "priority": 0.5,
    "alternates": [],
    "imageCount": 0,
    "sitemapUrl": "https://crawlee.dev/sitemap.xml",
    "site": "https://crawlee.dev",
    "scrapedAt": "2026-10-20T12:00:00.000Z"
  }
]
```

### Limitations

- Only URLs listed in sitemaps are returned; pages missing from the sitemap are not discovered.
- Sitemaps disallowed by robots.txt for this actor are skipped.
- `lastmod`, `changefreq` and `priority` are whatever the site publishes; many sites omit them or set them all to the same value.
- Sites on the actor's denylist of platforms that forbid automated access are refused.

### FAQ

**How many URLs can it extract?**

As many as the sitemaps list. A single sitemap file can hold 50,000 URLs, and the actor reads up to 500 sitemap files per run. Set **Maximum URLs** to the number you need; you pay only for URLs saved.

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

If robots.txt declares none and neither `/sitemap.xml` nor `/sitemap_index.xml` exists, the actor logs that and returns nothing for that site, and you are not charged for it.

**Does it crawl pages to find URLs?**

Sitemap Scraper does not crawl pages. It reads only robots.txt and the sitemap files, so it is fast and light on the website. URLs that are not in a sitemap are not found.

**Is it legal to scrape this data?**

Sitemap Scraper reads only publicly available, non-personal sitemap data from the robots.txt and sitemap files of the websites you list, without logging in and at a polite request rate. It respects robots.txt. You are responsible for how you use the results; check the target's terms and the laws that apply to you. If you are unsure, ask a lawyer.

**Can I call it from my own code, Make, Zapier, n8n, or an AI agent?**

Sitemap Scraper has an HTTP API, official JavaScript and Python clients, and integrations with Make, Zapier, n8n and LangChain. AI agents can run it as a tool through the Apify MCP server: add `https://mcp.apify.com?tools=lowcountrytech/sitemap-urls-extractor` to your MCP client and the actor becomes the tool `lowcountrytech--sitemap-urls-extractor`. Set `maxTotalChargeUsd` in the call options to cap what one run can cost.

**Something broke or a field is missing. What now?**

Open an issue on the Issues tab with the input you used. The actor is tested daily and repaired quickly when the source site changes.

***

# Actor input Schema

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

A website (`https://example.com` or `example.com`) to discover its sitemaps through robots.txt, falling back to `/sitemap.xml` and `/sitemap_index.xml`. Or a direct sitemap URL (`https://example.com/post-sitemap.xml`, `.xml.gz`, or a plain-text `sitemap.txt`).

## `urlContains` (type: `array`):

Keep only URLs that contain any of these strings (case-insensitive), e.g. `/blog/`. Leave empty to keep all.

## `urlExcludes` (type: `array`):

Drop URLs that contain any of these strings (case-insensitive), e.g. `/tag/`.

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

Keep only URLs whose `lastmod` is on or after this date (`YYYY-MM-DD`). URLs without a lastmod are dropped when this is set. Leave empty to keep all.

## `maxSitemaps` (type: `integer`):

Stop opening new sitemap files after this many per run (sitemap indexes count too). Hard limit 500.

## `maxDepth` (type: `integer`):

How many levels of nested sitemap indexes to follow. 1 reads the sitemaps listed in the first index only.

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

Stop after this many URLs. You are charged per URL, so this also caps the cost of a run. Use 0 for no limit.

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

Optional. The target is a public page or API and normally works without a proxy.

## Actor input object example

```json
{
  "startUrls": [
    "https://crawlee.dev"
  ],
  "urlContains": [],
  "urlExcludes": [],
  "lastmodAfter": "",
  "maxSitemaps": 20,
  "maxDepth": 3,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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://crawlee.dev"
    ],
    "maxItems": 100,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("lowcountrytech/sitemap-urls-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"],
    "maxItems": 100,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("lowcountrytech/sitemap-urls-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"
  ],
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call lowcountrytech/sitemap-urls-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lowcountrytech/sitemap-urls-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/0mSraYqLIPHbeRM4S/builds/XJ3lebLQFZzGoBO4O/openapi.json
