# Sitemap URL Extractor - URLs & Dates from XML Sitemaps (`bigdavidson/sitemap-url-extractor`) Actor

Unofficial. Lists the page addresses in the sitemaps of the sites you name: follows sitemap indexes, reads robots.txt Sitemap lines, XML, gzip and text files. Returns date, priority, images, languages, news data. Filter by text or date. No key, robots.txt respected.

- **URL**: https://apify.com/bigdavidson/sitemap-url-extractor.md
- **Developed by:** [Jack Sheward](https://apify.com/bigdavidson) (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.14 / 1,000 url listeds

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 - URLs & Dates from XML Sitemaps

Give it websites or sitemap addresses. For a website it finds the sitemaps (the `Sitemap:` lines of its robots.txt, else `/sitemap.xml`, else `/sitemap_index.xml`), follows sitemap index files, reads XML, gzip and plain-text sitemaps (and RSS or Atom files named as sitemaps) and returns one row per page address, with the last-modified date, change frequency, priority, the sitemap it was found in, the number of images, the language versions (`xhtml:link`) and the news data of news sitemaps. You can keep only addresses that contain some text, drop others, and keep only those changed in the last N days.

Use it to list every page of a site before an SEO audit or migration, to find the pages that changed lately, or to feed a crawler or a link checker with a complete address list.

- **$0.20 per 1,000 URLs.** Pay only for rows delivered. No subscription.
- **Nothing to set up.** No account, no API key, no proxies.
- **Give it a site or a sitemap.** It finds the sitemaps named in robots.txt, follows sitemap indexes, unpacks gzip files and returns each address once.
- **Clean, consistent fields**, ready for CSV, Excel, JSON or a database.
- **Runs on a schedule** and connects to the Apify API, Make, Zapier, n8n and AI agents.

### Who uses it

- SEO teams listing every page a site declares before an audit or a migration.
- Developers feeding a crawler, a link checker or an AI index with a site's full list of pages.
- Analysts watching other sites for new and updated pages.

### What you get

One row per distinct page address. A row from a default run (the sitemap of sitemaps.org):

```json
{
  "url": "https://www.sitemaps.org/",
  "lastModified": "2016-11-21",
  "changeFrequency": null,
  "priority": null,
  "sitemapUrl": "https://www.sitemaps.org/sitemap.xml",
  "site": "https://www.sitemaps.org/",
  "imageCount": 0,
  "alternates": [],
  "newsTitle": null,
  "newsPublishedAt": null,
  "newsPublicationName": null,
  "scrapedAt": "2026-11-11T23:57:29Z"
}
```

- `url` is the address as the sitemap publishes it, with the scheme and host in lower case, an empty path written as `/` and any `#fragment` removed. Only `http` and `https` addresses are returned. An address longer than 2,000 characters, one that holds a space or control character, a relative one and one with another scheme are dropped (never cut), and so is one with a user name or password in it (`https://user:pass@host/...`; it is counted in the log). It is not fetched or checked: a listed page may no longer exist.
- `lastModified` is the date the sitemap gives, when it can be read as one. A year, a year and month or a date alone is returned as written (`2016-11-21`); a date with a time is converted to UTC and written like `2026-11-01T08:00:00Z`; a time without a zone is taken as UTC. RSS dates in the usual email format are read too. Anything else (`soon`, `2026-13-45`) gives `null`.
- `changeFrequency` is one of `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, `never` (lower case), otherwise `null`. `priority` is the number between 0 and 1 the sitemap gives, otherwise `null`. Both are what the site publishes; search engines largely ignore them.
- `sitemapUrl` is the sitemap file the address was first found in. `site` is the input it came from, written with `https://` when you gave a bare domain.
- `imageCount` is the number of `image:image` entries of the address (only the count; the image addresses are not returned).
- `alternates` is the list of language versions from `xhtml:link` entries: `{"lang": "de", "url": "https://..."}`, at most 20 per address (further ones are not returned), without a check that the other version exists.
- `newsTitle`, `newsPublishedAt` and `newsPublicationName` come from Google-News-style sitemaps (`news:news`), otherwise `null`. Titles are cut at 300 characters and names at 150, after email addresses are removed.
- `scrapedAt` is the time of the run in UTC.
- RSS and Atom files: the item or entry address is `url` and its date `lastModified`; the other fields stay empty.

An address found in two sitemaps of one run is returned once, even when two inputs lead to it.

### Input

| Field | What it does |
|---|---|
| Sites or sitemap addresses | Up to 100, one per line. A bare domain gets `https://`. An address that looks like a sitemap file (it ends in `.xml`, `.xml.gz`, `.gz`, `.txt`, `.rss` or `.atom`, or has `sitemap` or `feed` in its path) is read as one; any other address means its site (the page itself is not read). |
| Maximum results | Stop after this many addresses in total. Default 100, at most 100,000. Sitemaps are read one after the other and the run stops fetching once enough rows are delivered. |
| Sitemap files per input | At most this many sitemap files (index files included) are fetched for each input. Default 200, at most 1,000. |
| Address must contain | Up to 50 pieces of plain text (not patterns, at most 200 characters each). An address is kept when it contains at least one. Capital and small letters are treated alike. |
| Address must not contain | Up to 50 pieces of plain text; an address that contains any of them is dropped. |
| Modified within the last days | Optional. Keep only addresses whose `lastModified` is within this many days of the run. **Addresses with no readable date are left out when this is set.** A date without a time counts as the start of that day in UTC. |

Index files are followed three levels below the first file at most; a deeper one is not read. Each sitemap is read once per run, so indexes that point at each other end; an input whose sitemaps were already read through an earlier input adds no rows (the log says `already read through` the earlier input, and it is not counted as a failure). The filters apply to the address as returned. Rows appear in the Output tab one by one as they are read.

### What is not charged

An input that yields nothing gets no row and costs nothing. The run log and the final status message give the reason for each input and count the rest:

- no sitemap found (robots.txt names none and `/sitemap.xml` and `/sitemap_index.xml` answer 404), or the sitemap itself answers an HTTP error;
- robots.txt disallows the file (`disallowed by robots.txt`) or could not be read because the site answered it with a server error;
- the site refused an automated request: HTTP 401 or 403, a login redirect, a CAPTCHA or bot-challenge page, or a rate limit that did not go away. That site is then **left alone for the rest of the run**. A refusal is never worked around;
- the address is not a public web address: private, local and internal addresses, addresses with a user name or password, ports other than 80 and 443;
- the answer is not a sitemap: HTML, a different XML document, binary data, XML with a `DOCTYPE`, an entity or an external reference (refused), or XML nested more than 30 levels deep;
- an address dropped for the reasons under `url` above (including a user name or password in it), one filtered out, or one already returned;
- an input whose sitemaps an earlier input already read: it adds no rows.

If the sitemaps of an input are read but hold no addresses that pass the filters, the input is listed as such. The run fails only when no sitemap at all could be read, and then it lists the reasons.

### How to run it

1. Open the **Input** tab. The prefilled example (the sitemaps of sitemaps.org and of docs.python.org) works as it is; replace the addresses with yours.
2. Press **Start**. Rows appear in the **Output** tab as sitemaps are read.
3. Download the results as JSON, CSV, Excel, XML or HTML, or read them through the Apify API.

Requests are made one at a time, at least a second apart. A site costs two requests for robots.txt (the check and the sitemap lookup) and one request per sitemap file, so a site with one sitemap takes about 2 to 5 seconds, and a site whose index lists 200 sitemap files about 3 to 5 minutes, plus the download time of large files. The default run (two sites, up to 100 addresses) returned 91 rows in about 5 seconds locally. Writing 5,000 rows one at a time into local storage took about 19 seconds (measured on a laptop with a pre-built file); on Apify every row is also an API call with a charge, which was not measured for 5,000 rows, so allow a few minutes for a run that big.

### How much does it cost?

**$0.20 per 1,000 URLs** ($0.0002 per URL), plus Apify's standard start charge of $0.00005 per run. There is no subscription and no rental fee.

| Results | Cost |
|---|---|
| 100 | $0.02 |
| 1,000 | $0.20 |
| 10,000 | $2.00 |

You pay only for rows delivered (the `url` charge). Platform usage is included in that price, and a run stops at the spending limit you set. The Pricing tab always shows the current price.

### FAQ

**Do I need an account, an API key or a proxy?** No. The Actor reads public sitemaps only and needs nothing from you besides the input.

**Does it work for a site with no sitemap?** No. It does not crawl pages to discover addresses; a site without a sitemap at the usual places gives no rows. Name the sitemap address yourself if it lives elsewhere.

**Why is an address I know missing?** It is probably not in the site's sitemaps, a filter removed it, or the index was cut by one of the limits below. The log says how many addresses and sitemaps were left out and why.

**Is it safe to give it any address?** The Actor only fetches public web addresses on the standard ports; private, local, internal, multicast and reserved addresses are refused, also when a redirect leads there or a sitemap names them. A sitemap may point at sitemaps on other hosts; at most 10 hosts other than the input's own are contacted per input (redirect steps count). XML is read only with defusedxml, which refuses entity declarations and external references, and a file with a `DOCTYPE` is refused; it is read in small steps without building a tree of the file, so memory stays flat. A gzip file is unpacked in chunks and cut off at 50 MB (the sitemap protocol's own limit), whatever its compressed size. Every download is capped at 50 MB, every sitemap has an element ceiling and a time limit that are checked while the file is parsed, and no regular expression is run over data from a site. The tests include a gzip file of under 1 MB that unpacks to 120 MB, entity bombs, 2 MB files of endless tags, 500,000 empty elements inside one address (about 1 second on the test machine), a 48 MB flood of 12 million empty elements (given up after the first 2 million, about 2 seconds), deep nesting, attribute floods and binary noise, each of which is read, cut or refused within seconds.

**Something looks wrong?** Open the **Issues** tab on this page and include the input you used.

### Limits

- **robots.txt is obeyed.** A sitemap file that the site's robots.txt disallows for this Actor is not read, and a site that bars all bots cannot be read at all (not even its robots.txt Sitemap lines). The page addresses a sitemap lists are only listed, never fetched, so a robots.txt rule about those pages does not change the rows. The Actor identifies itself honestly and does not imitate a browser, so it cannot read sites that only serve browsers or block data-centre addresses.
- **Only addresses that sitemaps publish.** It does not crawl, does not check whether an address still works (use a link checker for that), does not read page titles or content, and does not return image or video addresses and details, only the number of images. Video and other extension fields are ignored.
- **Size and time limits.** A sitemap larger than 50 MB (as served) is not read; a gzip file that unpacks to more than 50 MB is read up to that point. Each sitemap gets at most 120 seconds for the download (robots.txt check and redirects included) and 60 seconds of parsing (the time spent delivering rows does not count); one that takes longer keeps the rows read so far. An XML file is also given up after 2,000,000 elements (a real sitemap of 50,000 addresses has well under 1,000,000); the rows read before that point are kept, the entry being read is not, and the log names the file. Both limits are checked every few thousand elements while the file is parsed, in small steps, so no separate worker thread is used. Inside one address only the first 1,000 elements are looked at. A damaged or cut-off file keeps the rows before the damage. A run stops once addresses that gave no answer have taken more than 15 minutes together; rows already delivered are kept and the log says how many sitemaps were not read.
- **Caps.** At most 100 inputs, 100,000 results, 1,000 sitemap files per input, 20 language versions per address, 3 index levels. For a gzip file only the first gzip member is read. Text sitemaps are read as UTF-8; a line longer than 4,000 characters is dropped.
- **Redirects** are followed one step at a time, at most 5, and every step is checked against robots.txt and the address rules. The address a name resolves to is checked before each request and each redirect step; the connection itself resolves the name again, so a name that changes its answer between the two is not covered.
- **Server errors are retried.** The shared client asks again up to three times, with pauses, when a site answers with a 5xx status. A bot-challenge page is never retried, whatever its status code. A rate limit (HTTP 429) is waited out once; if it persists the site counts as refusing.
- **Tested on constructed files and a few live sitemaps.** Live reads covered plain urlset files, an index with robots.txt `Sitemap:` lines and language versions. News, image, gzip, text and RSS or Atom handling were tested only on constructed files, not on a live site.
- A different answer in a browser is possible: some sites answer an automated client differently from a person.
- Uses ordinary web requests, one at a time and at least a second apart, and keeps no cookies. It does not log in, solve CAPTCHAs or work around blocks.
- Organisation-level data only. Addresses and news titles are returned as the site publishes them, so an address or a title can contain a person's name (for example a profile page). Email addresses in `newsTitle` and `newsPublicationName` are replaced with `[email removed]` before the text is cut; they are not removed from `url` and the other address fields, which are delivered as they are, even if an address holds one in a query. Phone numbers in a long news title (80 characters or more with several words) are replaced with `[phone removed]`.
- Unofficial. Not affiliated with, endorsed by or sponsored by any of the sites it reads. Check each site's terms before using the data commercially.

# Actor input Schema

## `urls` (type: `array`):

Websites (a bare domain such as example.com gets https://) or addresses of sitemap files, one per line, up to 100. For a site the Actor reads the Sitemap lines of its robots.txt and, when there are none, /sitemap.xml and then /sitemap_index.xml. An input whose sitemaps an earlier input already read adds no rows. An input that yields nothing (no sitemap, robots.txt bars it, the site refuses, not XML) costs nothing and is listed in the log; the run fails only when no sitemap at all could be read.

## `maxResults` (type: `integer`):

Stop after this many addresses in total (one result is one page address). Sitemaps are read lazily: once enough addresses are delivered, no further sitemap is fetched.

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

At most this many sitemap files (index files included) are fetched for each input. Each file costs about a second plus its download. Files beyond the limit are not read.

## `urlContains` (type: `array`):

Plain text, not a pattern: keep only addresses that contain at least one of these pieces of text (up to 50, each at most 200 characters; capital and small letters are treated alike). Empty means no filter.

## `urlExcludes` (type: `array`):

Plain text, not a pattern: drop addresses that contain any of these pieces of text (up to 50, each at most 200 characters; capital and small letters are treated alike).

## `modifiedWithinDays` (type: `integer`):

Keep only addresses whose published last-modified date is within this many days. Addresses without a readable date are then left out. Leave empty to keep all.

## Actor input object example

```json
{
  "urls": [
    "https://www.sitemaps.org/",
    "https://docs.python.org/"
  ],
  "maxResults": 100,
  "maxSitemapsPerSite": 200
}
```

# Actor output Schema

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

All result rows from the run's default dataset, as JSON.

# 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 = {
    "urls": [
        "https://www.sitemaps.org/",
        "https://docs.python.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("bigdavidson/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 = { "urls": [
        "https://www.sitemaps.org/",
        "https://docs.python.org/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("bigdavidson/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 '{
  "urls": [
    "https://www.sitemaps.org/",
    "https://docs.python.org/"
  ]
}' |
apify call bigdavidson/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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