# XML Sitemap URL and Metadata Batch Extractor (`plainkitbin/sitemap-extract`) Actor

Extract page URLs and available last-modified date, change frequency, and priority from XML sitemaps. Start with a website or sitemap URL; sitemap indexes, gzip files, and robots.txt Sitemap directives are supported.

- **URL**: https://apify.com/plainkitbin/sitemap-extract.md
- **Developed by:** [PlainKit bin](https://apify.com/plainkitbin) (community)
- **Categories:** Developer tools, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.33 / 1,000 sitemap page 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

## Sitemap URL Extractor

### Introduction

Sitemap URL Extractor serves as a specialized XML sitemap URL extractor for SEO and site audits, discovering and extracting web page URLs directly from sitemap XML feeds, sitemap indexes, and gzip-compressed sitemaps. It reads `robots.txt` Sitemap declarations automatically or traverses direct sitemap links, extracting each unique URL alongside available metadata such as `lastmod`, `changefreq`, and `priority`. The Actor fetches sitemaps only without downloading page contents.

#### Use cases

- **SEO technical auditing**: Collect complete inventories of sitemap URLs to feed into site-wide SEO audit tools and crawlers.
- **Content inventory & migration**: Build comprehensive crawl lists during domain migrations or content inventory audits.
- **Freshness monitoring**: Track changes in `lastmod` timestamps across recurring sitemap exports.

### Tutorial

#### Step-by-step guide

1. Prepare a JSON input object specifying `start_urls` with 1 to 5 website or direct sitemap URLs, and set `max_urls` (1 to 500).
2. Start the Actor execution on the Apify platform or trigger it via the Apify API.
3. The Actor inspects `robots.txt`, identifies sitemaps or sitemap indexes, uncompresses gzip files if necessary, and extracts unique URLs.
4. Export the extracted page list and metadata in JSON, CSV, or Excel format.

### Pricing

The Actor is priced per extracted unique page URL under the Pay-Per-Event model using the **`page-url-extracted`** event.

| Usage tier | Price per page URL |
| --- | ---: |
| FREE | $0.0005 |
| BRONZE | $0.00045 |
| SILVER | $0.0004 |
| GOLD, PLATINUM, DIAMOND | $0.000333 |

#### Charge contract

Each row is pushed first and charged right after a successful push; a refused charge stops work and that row stays delivered and uncharged; a reached limit stops work after that row was charged; failed items are neither pushed nor charged. Status records written to the key-value store under STATUS are uncharged. Rows already in the dataset of a restarted run are skipped and not charged again; if the dataset of a restarted run cannot be read, the run fails with DATASET_READ_FAILED before any new row or charge.

#### Operational limits

- Accepts 1 to 5 starting URLs per run.
- Extracts up to 500 unique page URLs (`max_urls` configurable 1 to 500, default 100).
- Traverses sitemap indexes up to depth 2, processing at most 20 sitemap files.
- Maximum sitemap size is 1,000,000 bytes before and after gzip expansion.
- Crawl-delay is capped at 14 seconds per origin; higher crawl delays trigger a safe skip.
- Request timeout is 20 seconds with up to 5 redirect hops. Private IP ranges are blocked.

### Input and output examples

#### Input example

```json
{
  "start_urls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "max_urls": 100
}
```

#### Output example

```json
{
  "record_type": "page",
  "url": "https://www.sitemaps.org/protocol.html",
  "lastmod": "2026-10-11",
  "changefreq": "weekly",
  "priority": 0.8,
  "sitemap": "https://www.sitemaps.org/sitemap.xml"
}
```

#### Output fields

| Field | Type | Description |
| --- | --- | --- |
| `record_type` | String | Type indicator (`page`) |
| `url` | String | Extracted target page URL |
| `lastmod` | String | Last modified date string when available in sitemap |
| `changefreq` | String | Expected change frequency hint (e.g. `weekly`, `monthly`) |
| `priority` | Number | Priority score (0.0 to 1.0) declared in sitemap |
| `sitemap` | String | Source sitemap file URL where the item was found |

### Actor recommendations

Pair this Actor with:

- **SEO On-Page Audit**: Audit technical SEO factors on the URLs extracted from your sitemap.
- **Readable Article Extractor**: Extract clean article copy from all newly discovered blog posts in the sitemap.
- **Web Page to Markdown Converter**: Convert full sitemap pages into Markdown documentation sets.

### FAQ and support

#### Does the Actor fetch or crawl page contents?

No. The Actor processes XML sitemap and robots documents only; it does not download destination web pages.

#### Does it support compressed gzip (.xml.gz) sitemaps?

Yes. Both uncompressed XML and gzip-compressed sitemaps are automatically decompressed and parsed.

#### How does it discover sitemaps from a base domain?

When given a website URL, the Actor inspects `robots.txt` for `Sitemap:` directives, defaulting to `/sitemap.xml` if none are found.

#### Support and inquiries

For issues, bug reports, or feature requests, submit a ticket in the Apify Console.

# Actor input Schema

## `start_urls` (type: `array`):

Provide a website URL to discover Sitemap directives in robots.txt, or a sitemap URL directly.

## `max_urls` (type: `integer`):

Maximum page URL records to return; values above the hard limit of 500 are rejected.

## Actor input object example

```json
{
  "start_urls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "max_urls": 100
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items produced by this run.

# 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 = {
    "start_urls": [
        "https://www.sitemaps.org/sitemap.xml"
    ],
    "max_urls": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainkitbin/sitemap-extract").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 = {
    "start_urls": ["https://www.sitemaps.org/sitemap.xml"],
    "max_urls": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("plainkitbin/sitemap-extract").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 '{
  "start_urls": [
    "https://www.sitemaps.org/sitemap.xml"
  ],
  "max_urls": 100
}' |
apify call plainkitbin/sitemap-extract --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainkitbin/sitemap-extract"
        }
    }
}
```

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/hhgyobLDcQojjkPtB/builds/nYTJtsXghQut2bKtw/openapi.json
