# Sitemap URL Extractor - All Page URLs + Lastmod of Any Site (`zhucl1006/sitemap-url-extractor`) Actor

Get every URL of a website from its XML sitemaps: auto-discovers sitemaps via robots.txt and common paths, follows sitemap indexes, reads .xml.gz and .txt. Returns lastmod, changefreq, priority, hreflang. Regex & date filters. Fast, no browser.

- **URL**: https://apify.com/zhucl1006/sitemap-url-extractor.md
- **Developed by:** [leo zhu](https://apify.com/zhucl1006) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 result items

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/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 Page URLs + Lastmod of Any Site

Get the full list of page URLs of any website from its **XML sitemaps** in seconds - no browser, no crawling. Just give a homepage: the Actor finds the sitemaps in `robots.txt` (or at `/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `/sitemap.txt` ...), follows **sitemap index files**, reads gzipped `.xml.gz` and plain-text sitemaps, and returns every URL with **lastmod, changefreq, priority, image count and hreflang alternates**.

### Who uses it

- **SEO specialists & agencies**: content inventory, find new / updated pages of competitors (`lastmodAfter`), check hreflang coverage, audit indexable URLs.
- **Scraping & AI teams**: get the complete URL list first, then feed it into a crawler, Website Content Crawler or an LLM / RAG pipeline.
- **E-commerce & market research**: list all product or category URLs of a store with `includePatterns: ["/products/"]`.
- **Monitoring**: schedule daily with `lastmodAfter` to catch newly published pages.

### Input

| Field | Description |
|---|---|
| `startUrls` | Homepages (auto-discovery) or direct sitemap URLs. |
| `maxUrlsPerSite` | Default 1000, up to 1,000,000. |
| `includePatterns` / `excludePatterns` | Regex filters on the URL. |
| `lastmodAfter` | e.g. `2026-01-01` - only recently updated pages. |
| `maxSitemapsPerSite`, `maxConcurrency` | Safety / speed limits. |

Example:

```json
{ "startUrls": ["https://www.shopify.com", "https://stripe.com/sitemap.xml"], "maxUrlsPerSite": 50000, "excludePatterns": ["/tag/"], "lastmodAfter": "2026-09-01" }
```

### Output (one row per URL)

```json
{
  "site": "https://blog.apify.com",
  "status": "ok",
  "url": "https://blog.apify.com/what-is-web-scraping/",
  "lastmod": "2026-08-14T10:21:05.000Z",
  "changefreq": null,
  "priority": null,
  "imageCount": 1,
  "alternates": [],
  "sitemapUrl": "https://blog.apify.com/sitemap-posts.xml",
  "foundVia": "robots.txt"
}
```

Websites without a readable sitemap get one `no-sitemap` row (free). `RUN_SUMMARY` in the key-value store has counts.

### Pricing (pay per event)

- **$0.001 per URL saved** (`sitemap-url`) - $1 per 1,000 URLs.
- Tiny start fee per run (`apify-actor-start`).
- Sites without a sitemap and filtered-out URLs are free. Set "Maximum cost per run" to cap spend - the run stops gracefully and keeps saved results.

### Notes

- Duplicate URLs across sitemaps of the same site are removed.
- If a site lists several sitemaps in robots.txt (e.g. multiple sub-sites), give the specific sitemap URL to limit the scope.
- Only public sitemap files are read; nothing behind logins.

# Actor input Schema

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

Website homepages (sitemaps are discovered from robots.txt and common paths) or direct sitemap URLs (.xml, .xml.gz, .txt).

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

Stop after this many URLs per website.

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

Keep only URLs matching any of these, e.g. /blog/ or /products/.

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

Drop URLs matching any of these, e.g. /tag/ or ?page=

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

Date like 2026-01-01. URLs without lastmod are kept.

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

Safety limit for huge sitemap indexes.

## `maxConcurrency` (type: `integer`):

Parallel websites.

## Actor input object example

```json
{
  "startUrls": [
    "https://blog.apify.com",
    "https://www.djangoproject.com"
  ],
  "maxUrlsPerSite": 1000,
  "includePatterns": [],
  "excludePatterns": [],
  "maxSitemapsPerSite": 200,
  "maxConcurrency": 5
}
```

# Actor output Schema

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

No description

## `runSummary` (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",
        "https://www.djangoproject.com"
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("zhucl1006/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 '{
  "startUrls": [
    "https://blog.apify.com",
    "https://www.djangoproject.com"
  ]
}' |
apify call zhucl1006/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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