# Sitemap URL Extractor — all URLs + lastmod, no crawl \[$1/1K] (`rojackdj/sitemap-url-extractor`) Actor

Give it a domain, get every URL in its sitemap with lastmod, changefreq and priority. Reads sitemap.xml and robots.txt only — no crawling, no blocks.

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

$1.00 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Sitemap URL Extractor

Give it any website. Get back **every URL that site publishes in its sitemap**, with the `lastmod`,
`changefreq` and `priority` values the site declares — without crawling a single page.

It reads `robots.txt`, `/sitemap.xml` and `/sitemap.txt`, follows nested sitemap index files, and
streams the results into a dataset you can export as JSON, CSV or Excel.

### Example output

Real items from real runs — not mock data.

From `https://crawlee.dev`:

```json
{
    "url": "https://crawlee.dev/blog",
    "lastModified": null,
    "changeFrequency": "weekly",
    "priority": 0.5,
    "sourceSitemap": "https://crawlee.dev/sitemap.xml"
}
```

From `https://www.sitemaps.org`:

```json
{
    "url": "https://www.sitemaps.org/",
    "lastModified": "2016-11-21T00:00:00.000Z",
    "changeFrequency": null,
    "priority": null,
    "sourceSitemap": "https://www.sitemaps.org/sitemap.xml"
}
```

Both shapes have the same five keys. Fields the site does not declare come back as `null` — never
missing, so your CSV columns stay stable across runs.

### Fields

| Field | Type | Description |
| --- | --- | --- |
| `url` | string | The page URL, exactly as declared in the sitemap. |
| `lastModified` | string | null | `<lastmod>` as an ISO 8601 timestamp. |
| `changeFrequency` | string | null | `<changefreq>`: `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly` or `never`. |
| `priority` | number | null | `<priority>`, between 0.0 and 1.0. |
| `sourceSitemap` | string | Which sitemap file this URL came from. Useful on sites with dozens of them. |

### Input

One field. No options to get wrong.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `siteUrl` | string | yes | Any URL of the site. The homepage is fine — the path is ignored. `example.com` works too. |

### Pricing

**$1.00 per 1,000 URLs** ($0.001 per URL), pay-per-event.

You are charged once per URL delivered to the dataset. If the Actor finds no sitemap, or the
sitemaps contain no URLs, the run fails and **you are charged nothing** — there is no charge for
attempts, only for results.

Typical costs, measured on real runs:

| Site | URLs returned | Cost |
| --- | --- | --- |
| `www.sitemaps.org` | 84 | $0.08 |
| `crawlee.dev` | 4,782 | $4.78 |
| `webflow.com` | 124,094 | $124.09 |

Set a **maximum cost per run** in the run options before starting a large site if you want a hard cap.

### Limitations

Written down on purpose, so you know before you pay:

- **No sitemap, no results.** If a site publishes no sitemap, this Actor fails with a clear message
  instead of falling back to crawling. It is a sitemap reader, not a crawler.
- **It returns what the sitemap declares, not what exists.** URLs are not visited or verified. A
  sitemap can list dead pages, and many do.
- **`lastmod`, `changefreq` and `priority` are optional in the sitemap spec** and most sites omit at
  least one. They come back as `null`. Nothing is inferred or guessed.
- **Sub-sitemaps on other hostnames are followed.** Plenty of sites host theirs on a CDN, so results
  may include hostnames other than the one you typed. Check `sourceSitemap` if that matters to you.
- **Nested sitemap indexes are followed 5 levels deep.** Deeper nesting than that is ignored.
- **Very large sites need memory.** Above ~500,000 URLs, raise the run's memory from the default
  512 MB.
- Sitemaps are a public, opt-in file. This Actor reads nothing else: no logins, no personal data.

# Actor input Schema

## `siteUrl` (type: `string`):

Any URL of the site — the homepage is fine. The Actor looks for sitemaps in robots.txt, /sitemap.xml and /sitemap.txt.

## Actor input object example

```json
{
  "siteUrl": "https://www.sitemaps.org"
}
```

# Actor output Schema

## `results` (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 = {
    "siteUrl": "https://www.sitemaps.org"
};

// Run the Actor and wait for it to finish
const run = await client.actor("rojackdj/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 = { "siteUrl": "https://www.sitemaps.org" }

# Run the Actor and wait for it to finish
run = client.actor("rojackdj/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 '{
  "siteUrl": "https://www.sitemaps.org"
}' |
apify call rojackdj/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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