# Sitemap URL Extractor: Bulk Export with lastmod (`dvc-analytics/sitemap-urls-bulk-export`) Actor

Sitemap URL extractor: get all URLs of a website from sitemap.xml, indexes, .gz, text and RSS sitemaps, with lastmod, changefreq and priority. CSV/JSON export.

- **URL**: https://apify.com/dvc-analytics/sitemap-urls-bulk-export.md
- **Developed by:** [luc guerin](https://apify.com/dvc-analytics) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 result rows

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: Bulk Export with lastmod

**Sitemap URL Extractor** reads the sitemaps of up to 200 websites and returns every listed page as a clean row with `lastmod`, `changefreq` and `priority`. Use it as a sitemap crawler to get all URLs of a website, or to turn sitemap.xml into CSV, Excel or JSON. Enter a domain, a homepage or a sitemap URL. No login, API key or proxy is needed.

### What it does

- **Finds the sitemap for you.** It reads the `Sitemap:` lines in `robots.txt`. If there are none, it tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml` and `/wp-sitemap.xml`.
- **Follows sitemap indexes** to any depth. Each sitemap file is fetched only once, so loops (an index that lists itself) cannot cause endless fetching.
- **Reads every common format:** XML `urlset` and `sitemapindex`, gzip files (`.xml.gz`, detected by content, not only by file extension), plain-text sitemaps (one URL per line), and RSS 2.0 / Atom feeds used as sitemaps.
- **Normalises the data.** `lastmod` becomes ISO 8601 when it can be parsed (RSS `pubDate` too), `priority` becomes a number and `changefreq` becomes lower case.
- **Filters:** keep only URLs that contain some text or match a regular expression, and/or only URLs changed on or after a given date.
- **Counts images (optional):** `imageCount` gives the number of `image:image` entries in image sitemaps.
- **Removes duplicates within each site**, even when the same URL appears in several sitemap files.
- **Export and integrations:** download the results as CSV, JSON, Excel or XML, or read them through the Apify API, webhooks, Make, Zapier or an MCP client.

### Use cases

- **SEO audits:** list every indexable URL and spot stale pages by `lastmod`.
- **Content inventory and migrations:** export all URLs of a website to a spreadsheet before a redesign or replatforming.
- **Change monitoring:** schedule a daily run with **Modified since** to get only new or updated pages.
- **Crawler seeding:** give a scraper or an AI ingestion pipeline a full list of URLs, for example only `/blog/` or `/docs/` pages.
- **Competitive research:** compare how many pages competitors publish and how often they update them.

### Input

| Field | Description |
|---|---|
| **Websites or sitemap URLs** (`sites`) | 1-200 entries: `example.com`, `https://example.com` or `https://example.com/sitemap.xml` (also `.gz`, `.txt` or a feed URL). |
| **Max URLs per site** (`maxUrlsPerSite`) | Stops collecting a site after this many unique URLs. Default 1,000, maximum 100,000. |
| **Max sitemap files per site** (`maxSitemapsPerSite`) | Limit on sitemap files fetched per site, indexes included. Default 200, maximum 2,000. |
| **URL filter** (`urlFilter`) | Optional. Keeps only URLs that contain this text (case-sensitive). |
| **Filter is a regular expression** (`filterIsRegex`) | Uses the URL filter as a Python regular expression (`re.search`). |
| **Modified since** (`lastmodSince`) | Optional `YYYY-MM-DD`. Keeps only URLs with a `lastmod` on or after this date. URLs without a readable `lastmod` are dropped while this filter is on. |
| **Count images** (`includeImages`) | Fills `imageCount`. When off, `imageCount` is `null`. |

```json
{
  "sites": ["https://docs.python.org", "example.com", "https://example.org/sitemap_index.xml"],
  "maxUrlsPerSite": 5000,
  "urlFilter": "/blog/",
  "lastmodSince": "2026-01-01",
  "includeImages": false
}
```

### Output example

Each URL is one dataset row:

```json
{
  "site": "docs.python.org",
  "url": "https://docs.python.org/3.11/",
  "lastmod": null,
  "changefreq": "yearly",
  "priority": null,
  "sitemapUrl": "https://docs.python.org/sitemap.xml",
  "imageCount": null
}
```

Fields: `site` (host without `www.`), `url`, `lastmod` (ISO 8601 when it can be parsed, otherwise the raw value, or `null`), `changefreq`, `priority` (0.0-1.0 or `null`), `sitemapUrl` (the file that listed the URL) and `imageCount`.

#### Run summary (not charged)

The run also saves a `SUMMARY` record in the default key-value store. For each site it lists `sitemapsFound`, `sitemapsChecked`, `urlsFound` (entries read before filters and de-duplication), `urlsPushed`, `reachedMaxUrls` and `errors`. **A site without any sitemap does not create a dataset row**, so it costs nothing. Instead, it appears in `SUMMARY.sitesWithoutSitemap`, its errors say `"no sitemap found"`, and the run log shows a warning.

### How much does it cost?

Pay per result: **$0.50 per 1,000 URLs** ($0.0005 per dataset row) plus **$0.00005 per actor start**. Only pushed URL rows are charged. Sites without a sitemap, filtered-out URLs and duplicates are free. Examples: 1,000 URLs cost about $0.50, and 10 sites with 200 URLs each (2,000 rows) cost about $1.00. You can also set a maximum cost per run in Apify; the actor stops cleanly when that limit is reached.

### Data source & legality

The actor only reads files that website owners publish so that machines can read them: `robots.txt`, sitemaps and feeds. It does not crawl HTML pages, log in, solve captchas or use proxies. Sitemaps list public page addresses and normally contain no personal data. You are responsible for using the output in line with each website's terms of service and the laws that apply to you.

### Limits

- Each sitemap file is capped at 50 MB after decompression. The protocol maximum is 50 MB and 50,000 URLs per file. Larger files are skipped and noted in `SUMMARY`.
- XML is parsed as a stream with a safe parser: DTD entity declarations and external entities are rejected, so XML bombs and XXE attacks do not work, and DTDs are never fetched over the network.
- Each site fetches up to 3 sitemaps in parallel, and up to 2 sites are processed at the same time. There is a 30 s timeout per request, with retries on HTTP 429 / 5xx and on network errors.
- De-duplication works within each site, not across sites.
- Sitemaps served only to browsers (blocked by a bot wall or rendered with JavaScript) cannot be read.
- If the sitemap has no `lastmod`, `lastmod` is `null`.

### FAQ

**Can I export sitemap.xml to CSV?** Yes. Open the run's dataset and choose CSV or Excel, or use the dataset API URL with `format=csv`.

**What happens when a site has no sitemap?** No row is pushed and you are not charged. Check the `SUMMARY` record or the log to see which sites had none and which URLs were tried.

**Can I schedule it?** Yes. Create an Apify Schedule (for example, daily) and set **Modified since** to get recently changed pages.

**Can I call it from my code?** Yes. Use the Apify API or the Python/JavaScript clients. Integrations with Make, Zapier, n8n, Google Sheets and webhooks also work.

**Can AI agents use it?** Yes. Through the Apify MCP server, an agent (Claude, ChatGPT or another MCP client) can call this actor to get all URLs of a website before it reads the pages.

**Why are there fewer URLs than the site has?** The sitemap may be incomplete. You may also have hit **Max URLs per site** or **Max sitemap files per site**, or a filter may have removed URLs. `urlsFound` vs `urlsPushed` in `SUMMARY` shows where URLs were dropped.

### Support

Found a bug or need a field? Open an issue in the **Issues** tab of this actor.

# Actor input Schema

## `sites` (type: `array`):

One entry per line (1-200): a domain (example.com), a homepage URL (https://example.com) or a direct sitemap URL (https://example.com/sitemap.xml, .xml.gz, .txt, RSS/Atom feed). For domains and homepages the sitemap is discovered from robots.txt and common paths.

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

Stop collecting a site after this many unique URLs (1-100000). You are charged per URL row.

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

Upper bound of sitemap files (including sitemap indexes) fetched per site (1-2000).

## `urlFilter` (type: `string`):

Optional. Only keep URLs that contain this text (case-sensitive), e.g. /blog/. If 'Filter is a regular expression' is on, it is used as a Python regular expression.

## `filterIsRegex` (type: `boolean`):

Treat 'URL filter' as a regular expression (Python re.search) instead of plain text.

## `lastmodSince` (type: `string`):

Optional. Only keep URLs whose lastmod date is on or after this date. URLs without a readable lastmod are dropped when this is set.

## `includeImages` (type: `boolean`):

Fill the imageCount column with the number of image:image entries listed for each URL (image sitemaps). When off, imageCount is null.

## Actor input object example

```json
{
  "sites": [
    "https://docs.python.org",
    "https://www.djangoproject.com"
  ],
  "maxUrlsPerSite": 50,
  "maxSitemapsPerSite": 200,
  "filterIsRegex": false,
  "includeImages": false
}
```

# Actor output Schema

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

Result rows in the default dataset.

## `summary` (type: `string`):

Per-run summary record (counts, skipped inputs, errors).

# 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 = {
    "sites": [
        "https://docs.python.org",
        "https://www.djangoproject.com"
    ],
    "maxUrlsPerSite": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("dvc-analytics/sitemap-urls-bulk-export").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 = {
    "sites": [
        "https://docs.python.org",
        "https://www.djangoproject.com",
    ],
    "maxUrlsPerSite": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("dvc-analytics/sitemap-urls-bulk-export").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 '{
  "sites": [
    "https://docs.python.org",
    "https://www.djangoproject.com"
  ],
  "maxUrlsPerSite": 50
}' |
apify call dvc-analytics/sitemap-urls-bulk-export --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dvc-analytics/sitemap-urls-bulk-export"
        }
    }
}
```

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/4kL9nW1S2LMgBFKVB/builds/FFD1vB1e39hbi1lK6/openapi.json
