# Sitemap URL Extractor (`cool_ya/sitemap-url-extractor`) Actor

Discover and parse XML sitemaps for any website. Returns every URL with lastmod, changefreq and priority. Handles sitemap indexes, gzipped and plain-text sitemaps.

- **URL**: https://apify.com/cool\_ya/sitemap-url-extractor.md
- **Developed by:** [Y A](https://apify.com/cool_ya) (community)
- **Categories:** Developer tools, SEO tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 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

**Extract every URL from any website's XML sitemap — in seconds, with no code.**

Point this Actor at a domain or a sitemap URL and get back a clean, structured list of every page the site publishes, complete with `lastmod`, `changefreq`, and `priority` metadata. Perfect for **SEO audits, content inventories, site migrations, crawl seeding, and competitive research**.

### What it does

- 🔍 **Auto-discovers sitemaps** from a bare domain via `robots.txt` and common well-known paths (`/sitemap.xml`, `/sitemap_index.xml`, WordPress `/wp-sitemap.xml`, and more).
- 🗂️ **Follows sitemap indexes** recursively — nested sitemaps are crawled automatically.
- 🗜️ **Handles gzipped** (`.xml.gz`) and **plain-text** sitemaps transparently.
- 🧹 **De-duplicates** URLs across multiple sitemaps.
- ⚡ **HTTP-only and fast** — no headless browser, so runs are cheap and quick.

### Input

| Field | Type | Description |
|-------|------|-------------|
| `startUrls` | array | List of domains or sitemap URLs. Domains are auto-discovered; sitemap URLs are parsed directly. |
| `url` | string | Convenience field for a single target. |
| `maxUrls` | integer | Max URLs to return (0 = unlimited). Default `0`. |
| `includeSubSitemaps` | boolean | Recursively follow sitemap-index files. Default `true`. |

#### Example input

```json
{
    "startUrls": ["https://example.com"],
    "maxUrls": 0,
    "includeSubSitemaps": true
}
```

### Output

Each dataset item is one URL:

```json
{
    "url": "https://example.com/blog/hello-world",
    "lastmod": "2025-01-15",
    "changefreq": "weekly",
    "priority": "0.8",
    "sourceSitemap": "https://example.com/sitemap.xml"
}
```

You can export results as **JSON, CSV, Excel, or via API** directly from the run.

### Pricing

This Actor is billed **per result** — you pay only for the URLs it actually extracts. No subscription, no minimum. Runs that find nothing cost nothing beyond the negligible start event.

### Notes

- The Actor respects standard sitemap conventions and identifies itself with a clear User-Agent.
- If a site has no discoverable sitemap, the run completes cleanly with zero results.

# Actor input Schema

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

A list of websites (domains) or direct sitemap URLs. For domains, the Actor auto-discovers sitemaps via robots.txt and common paths. For sitemap URLs, it parses them directly (indexes and gzipped sitemaps supported).

## `url` (type: `string`):

Optional convenience field for a single target. Use 'startUrls' for multiple.

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

Maximum number of URLs to extract across all sitemaps. Set to 0 for unlimited.

## `includeSubSitemaps` (type: `boolean`):

When enabled, the Actor recursively follows nested sitemaps referenced in a sitemap index file.

## Actor input object example

```json
{
  "startUrls": [
    "https://example.com",
    "https://example.com/sitemap.xml"
  ],
  "maxUrls": 0,
  "includeSubSitemaps": true
}
```

# 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 = {
    "startUrls": [
        "https://apify.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cool_ya/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://apify.com"] }

# Run the Actor and wait for it to finish
run = client.actor("cool_ya/sitemap-url-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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://apify.com"
  ]
}' |
apify call cool_ya/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=cool_ya/sitemap-url-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/GMLrxvT0B0UPeDmEC/builds/eusF8Z7iEvsdUIoSi/openapi.json
