# Sitemap URL Extractor - Nested, Gzip, lastmod & hreflang (`ponderable_ironwork/sitemap-urls-extractor`) Actor

Get every URL a website publishes in its sitemaps: auto-discovery from robots.txt, nested sitemap indexes, .gz, text and RSS sitemaps. lastmod, changed-since filter, include/exclude patterns, hreflang alternates, image/video/news counts.

- **URL**: https://apify.com/ponderable_ironwork/sitemap-urls-extractor.md
- **Developed by:** [Zac Vincent](https://apify.com/ponderable_ironwork) (community)
- **Categories:** SEO tools, Developer 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.30 / 1,000 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

## Sitemap URL Extractor: All URLs from XML Sitemaps (Nested, Gzip, lastmod & hreflang)

**Get every URL a website publishes in its XML sitemaps, with `lastmod`, priority, hreflang alternates and image, video and news counts. Give a domain, and the Actor discovers the sitemaps itself.** It's built for SEO audits, crawl seeding, content inventories and change monitoring. **$0.50 per 1,000 URLs.**

- ✅ **Auto-discovery**: reads the `Sitemap:` lines in robots.txt, then tries common paths (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`…)
- ✅ **Nested sitemap indexes of any depth**, **.xml.gz** (gzip), plain-text sitemaps, and RSS/Atom feeds used as sitemaps
- ✅ **Changed-since filter**: only URLs whose `lastmod` is newer than a date or window ("7 days"). Unchanged child sitemaps are skipped entirely, so monitoring runs stay fast and cheap
- ✅ **Include / exclude patterns**: plain text, globs (`*/blog/*`) or `/regex/`
- ✅ **hreflang alternates**, image and video counts, Google News title and publication date
- ✅ Respects robots.txt; no browser or proxies; thousands of URLs per second
- 💲 **$0.50 per 1,000 URLs**

### What data does the sitemap extractor return?

| Field | Meaning |
|---|---|
| `site`, `url` | The site and one page URL from its sitemap |
| `lastmod`, `lastmodIso`, `changefreq`, `priority` | Sitemap metadata (raw and normalized date) |
| `alternates[]` | hreflang language/region versions (`{hreflang, href}`) |
| `imageCount`, `videoCount`, `newsTitle`, `newsPublishedAt` | Image, video and Google News sitemap extensions |
| `sitemap`, `sitemapDepth`, `sitemapType` | Which sitemap file listed it, how deeply nested, and its format |

### How to extract all URLs from a sitemap

1. Add a domain (`apify.com`), any page URL, or a direct sitemap URL (`…/sitemap.xml`, `.xml.gz`, `.txt`) to **Websites or sitemap URLs**.
2. Set **Max URLs per site** (default 10,000; use a small number to test).
3. Optionally keep only recent pages with **Only URLs changed since** (`7 days`, `2026-01-31`), or filter with **Include / Exclude URL patterns**.
4. Click **Start**, then export the URL list or feed it into a crawler or audit Actor.

#### Input example

```json
{
  "startUrls": ["apify.com", "https://developer.mozilla.org/sitemaps/en-us/sitemap.xml.gz"],
  "maxUrlsPerSite": 50000,
  "changedSince": "30 days",
  "includePatterns": ["*/blog/*"],
  "excludePatterns": ["/\\?page=\\d+/"]
}
```

#### Output example (real run)

```json
{
  "site": "https://blog.apify.com",
  "url": "https://blog.apify.com/",
  "lastmod": "2026-11-22T13:49:59.293Z",
  "lastmodIso": "2026-11-22T13:49:59.293Z",
  "changefreq": null,
  "priority": null,
  "imageCount": 0,
  "videoCount": 0,
  "newsTitle": null,
  "newsPublishedAt": null,
  "sitemap": "https://blog.apify.com/sitemap-pages.xml",
  "sitemapDepth": 1,
  "sitemapType": "urlset",
  "alternates": []
}
```

Sites with hreflang tags get `alternates: [{"hreflang": "de", "href": "https://example.com/de/page"}, …]`.

### Use cases

- **SEO audits**: a full URL inventory, stale `lastmod` dates, missing hreflang pairs and sitemap coverage
- **Crawl seeding**: feed the URL list into a crawler, the [Bulk PageSpeed checker](https://apify.com/ponderable_ironwork/pagespeed-bulk-audit) or your own scraper
- **Content and competitor monitoring**: a daily run with `changedSince: "1 day"` shows new and updated pages
- **Site migrations**: export every old URL to build redirect maps

### Why use this Actor?

| | This Actor | Basic sitemap parsers | Full website crawlers |
|---|---|---|---|
| robots.txt + common-path discovery | ✅ | Often needs the sitemap URL | N/A |
| Nested indexes, .gz, text, RSS | ✅ | Partial | N/A |
| `changedSince` (skips unchanged child sitemaps) | ✅ | ❌ | ❌ |
| hreflang, image, video, news fields | ✅ | Rarely | Partial |
| Speed and cost | Thousands of URLs/s, **$0.50 per 1,000** | Similar price | Much slower and pricier |

### Use it from AI agents (MCP) and code

**MCP (Claude, Cursor, VS Code, ChatGPT and other MCP clients).** Add this Actor as a single tool through Apify's hosted MCP server. You sign in with your Apify account on first use:

```json
{
  "mcpServers": {
    "apify-sitemap-urls-extractor": {
      "url": "https://mcp.apify.com?tools=ponderable_ironwork/sitemap-urls-extractor"
    }
  }
}
```

The tool appears as `ponderable_ironwork--sitemap-urls-extractor`. Try a prompt like: *"List every blog URL in example.com's sitemap that changed in the last 30 days."*

**API (one call, results back as JSON).** Replace `<APIFY_TOKEN>` with your token from Apify Console → Settings → API & Integrations:

```bash
curl -X POST "https://api.apify.com/v2/acts/ponderable_ironwork~sitemap-urls-extractor/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://blog.apify.com"], "maxUrlsPerSite": 1000, "changedSince": "30 days"}'
```

The Apify [JavaScript](https://docs.apify.com/api/client/js/) and [Python](https://docs.apify.com/api/client/python/) clients, **schedules**, **webhooks** and the **Make, n8n and Zapier** integrations work too. Every run's dataset downloads as JSON, CSV, Excel or XML.

### Pricing

**$0.50 per 1,000 URLs saved** (lower on higher Apify plans). Filtered-out URLs and sites without a sitemap cost nothing. A per-site `SUMMARY` (how the sitemaps were found, counts and warnings) is saved in the key-value store.

### FAQ

**What if the site has no sitemap?** The `SUMMARY` says so ("No sitemap found…"), and nothing is charged for that site.

**Does it crawl pages?** No. It reads only the sitemap files a site publishes for crawlers, which is why it's fast and cheap. Pair it with a crawler if you need page content.

### More data tools from this developer

- [Career Page Jobs API](https://apify.com/ponderable_ironwork/ats-jobs-feed): every open job from Greenhouse, Lever, Ashby, Workable, Recruitee & Workday boards, $1.50 per 1,000 jobs
- [Bulk PageSpeed Insights & Core Web Vitals](https://apify.com/ponderable_ironwork/pagespeed-bulk-audit): Lighthouse scores and real-user LCP/INP/CLS for hundreds of URLs, $3.00 per 1,000 audits
- [Wayback Machine Snapshots & Archived URLs](https://apify.com/ponderable_ironwork/wayback-machine-snapshots): capture history and every archived URL of a domain, $1.00 per 1,000 results
- [Bulk Domain Availability, RDAP WHOIS & DNS](https://apify.com/ponderable_ironwork/domain-rdap-dns-checker): availability, registrar, expiry, MX/SPF/DMARC, $1.00 per 1,000 domains
- [OpenAlex Academic Papers Search](https://apify.com/ponderable_ironwork/openalex-papers-search): 250M+ papers with citations, abstracts and BibTeX, $1.00 per 1,000 papers
- [Hacker News Search & Comment Threads](https://apify.com/ponderable_ironwork/hacker-news-search): stories and full comment threads by keyword, domain or date, $0.60 per 1,000 results
- [RSS, Atom & Podcast Feed Reader](https://apify.com/ponderable_ironwork/rss-feed-reader): any feed to clean JSON with auto-discovery, $0.80 per 1,000 items

Found a bug or need a field? Open an issue on the **Issues** tab. Fixes usually ship within days.

# Actor input Schema

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

A domain (apify.com), any page URL, or a direct sitemap URL (…/sitemap.xml, .xml.gz, .txt). For domains the sitemaps are discovered from robots.txt, then common paths.

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

0 = no limit.

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

Caps how many sitemap files (including nested ones) are read per site. 0 = no limit.

## `changedSince` (type: `string`):

Keep only URLs whose lastmod is on/after this date (2026-01-31) or within a window ('7 days', '3 months'). URLs without lastmod are skipped when this is set.

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

Keep only URLs containing one of these. Plain text, globs with \* (e.g. */blog/*) or /regex/.

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

Drop URLs matching any of these (same syntax as include).

## `sameHostOnly` (type: `boolean`):

Drop URLs that point to other domains/subdomains.

## `includeAlternates` (type: `boolean`):

Add the language/region versions (xhtml:link hreflang) listed for each URL.

## Actor input object example

```json
{
  "startUrls": [
    "https://blog.apify.com"
  ],
  "maxUrlsPerSite": 50,
  "maxSitemapsPerSite": 500,
  "sameHostOnly": false,
  "includeAlternates": true
}
```

# Actor output Schema

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

All items produced by the run.

## `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.apify.com"
    ],
    "maxUrlsPerSite": 50
};

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

# Run the Actor and wait for it to finish
run = client.actor("ponderable_ironwork/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://blog.apify.com"
  ],
  "maxUrlsPerSite": 50
}' |
apify call ponderable_ironwork/sitemap-urls-extractor --silent --output-dataset

```

## MCP server setup

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