# Sitemap Extractor: All URLs, Lastmod, Images, Hreflang (`tagadanar/sitemap-extractor`) Actor

Every URL in a website's sitemaps: robots.txt and standard-path discovery, sitemap indexes, .xml.gz and text sitemaps; lastmod, changefreq, priority, image/video/news/hreflang data, date and URL filters, optional HTTP status check. $0.30 per 1,000 URLs.

- **URL**: https://apify.com/tagadanar/sitemap-extractor.md
- **Developed by:** [Tagada Data](https://apify.com/tagadanar) (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.21 / 1,000 url delivereds

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 Extractor: All URLs, Lastmod, Images, Hreflang

**Every URL a website lists in its sitemaps, with the data the sitemap carries.** Give it a domain and it finds the sitemaps itself (the `Sitemap:` lines of robots.txt, then `/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml` and the other standard paths), follows sitemap indexes, reads `.xml.gz` and plain-text sitemaps, and returns **one row per page URL**: last-modified date, change frequency, priority, image URLs, video details, Google News title and date, hreflang language alternates, and the sitemap file it came from. Filter by URL pattern or by last-modified date, and optionally check each URL's HTTP status.

**$0.30 per 1,000 URLs on Free ($0.21 on Gold), plus $1.00 per 1,000 sitemap files read and $0.001 per run. The optional status check is $0.20 per 1,000 URLs checked. Platform usage is included.** No API key, no login, no proxy needed.

### What you get

One flat row per URL (`rowType: "url"`), plus one free summary row per site (`rowType: "summary"`). Fields the sitemap does not publish are null.

| Field | What it is |
| --- | --- |
| `url` | The page URL (`<loc>`) |
| `site` | The website it was found for |
| `lastmod` | Last-modified date as the sitemap gives it (`<lastmod>`) |
| `changefreq` | `<changefreq>` (daily, weekly ...) |
| `priority` | `<priority>`, 0.0 to 1.0 |
| `imageCount`, `images` | Image sitemap entries: how many, and their URLs |
| `videoCount`, `videos` | Video sitemap entries: `title`, `description`, `thumbnailUrl`, `contentUrl`, `playerUrl`, `durationSeconds`, `publicationDate` |
| `newsTitle`, `newsPublicationName`, `newsLanguage`, `newsPublicationDate`, `newsKeywords` | Google News sitemap fields |
| `alternateCount`, `alternates` | hreflang language versions: `hreflang` and `href` of each |
| `sitemapUrl` | The sitemap file the URL was listed in |
| `sitemapDepth` | 0 for a top-level sitemap, 1 for a sitemap inside an index, ... |
| `discoveredVia` | `robots.txt`, `standard path` or `input` (a sitemap URL you gave) |
| `httpStatus` | Status check on: the URL's own status code (301 / 302 for a redirect) |
| `finalStatus`, `finalUrl` | Status check on: the status after redirects, and where the URL redirects to |
| `checkError` | Status check on: why there is no status (`TIMEOUT`, `DNS_ERROR`, `TLS_ERROR`, `ROBOTS_DISALLOWED` ...) |
| `retrievedAt` | When the sitemap file was read (ISO 8601) |

The summary row per site holds: `outcome`, `robotsTxt`, `fallbackUsed`, `sitemapsRead`, `sitemapsFailed`, `sitemapsSkippedByDate`, `sitemapsNotRead`, `entriesScanned`, `urlsDelivered`, `duplicates`, `filteredOut`, `undated`, `newestLastmod`, `oldestLastmod`, `statusCounts` (status check on), and `sitemaps`: one line per sitemap file with its type, depth, URL count, newest lastmod and any error.

### Who uses it

- **SEO audits and migrations**: the full list of URLs a site submits to search engines, with lastmod and hreflang, to compare against a crawl, a redirect map or Search Console; the status check finds sitemap URLs that redirect or return 404.
- **Crawl seeding**: a clean, de-duplicated URL list for Website Content Crawler, a RAG pipeline or your own scraper, filtered to the sections you need (`/blog/*`, `/products/*`).
- **Content and competitor monitoring**: what a site published or updated since a date (`lastmodAfter: "7 days"`), from news, blog or product sitemaps.
- **E-commerce and media research**: product and article URLs with their images, videos and publication dates.

### Examples

All URLs of a site, up to 100 (the prefill):

```json
{"startUrls":["https://nodejs.org"],"maxUrlsPerSite":100}
```

Only blog posts updated in the last 30 days, two sites:

```json
{"startUrls":["https://yoast.com","https://blog.cloudflare.com"],"includePatterns":["/blog/*","*/20*"],"excludePatterns":["*/tag/*","*/page/*"],"lastmodAfter":"30 days","maxUrlsPerSite":2000}
```

One sitemap file directly, with the HTTP status of every URL:

```json
{"startUrls":["https://crawlee.dev/sitemap.xml"],"checkStatus":true,"maxUrlsPerSite":500}
```

A large site, everything (raise the cap; the run streams the sitemaps, memory stays flat):

```json
{"startUrls":["https://www.gov.uk"],"maxUrlsPerSite":1000000,"includeSummary":true}
```

### How discovery works

1. robots.txt is read. Every `Sitemap:` line in it is a sitemap to read.
2. If robots.txt lists none (or none of them answers), the standard paths are tried in order and the first one that holds a sitemap is used: `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml`, `/sitemap.xml.gz`, `/sitemap.txt`. A path robots.txt disallows is not fetched.
3. Sitemap indexes are followed (up to 5 levels deep), gzip files are inflated, text sitemaps (one URL per line) and RSS / Atom feeds used as sitemaps are read too.
4. A URL listed in several sitemap files of the same site is delivered once, from the first file that lists it.

Give a sitemap URL (`.../sitemap.xml`, `.../post-sitemap.xml`, `.../sitemap.xml.gz`) instead of a domain to read just that file and the files it points to.

### Filters

- **Include / exclude patterns**: `*` is a wildcard, a pattern starting with `/` matches the URL path (`/blog/*`), a full URL matches the start, and `/regex/` is a regular expression. Filtered-out URLs are not charged.
- **Modified after / before**: a date (`2026-01-31`, `2026-01-31T12:00:00Z`) or a relative age (`7 days`, `24 hours`, `3 months`), compared with each URL's `<lastmod>`. URLs without a lastmod are dropped while a date filter is on, unless *Keep URLs without a lastmod* is checked. With *Modified after*, a sitemap file that its index dates before that day is not downloaded at all, which keeps date-filtered runs on big news sites fast.
- **Max URLs per site** stops reading a site once that many URLs were delivered; **Max sitemap files per site** caps the files read.

### Status check

Turn on *Check each URL's HTTP status* to send a HEAD request to every delivered URL (a GET when the server refuses HEAD; the page body is never downloaded) and add `httpStatus`, `finalStatus`, `finalUrl` and `checkError`. Redirects are followed up to 5 hops. The check is polite to the site: at most 4 requests in flight and 10 per second per host, the robots.txt `Crawl-delay` respected (up to 1 s between requests), a `Retry-After` pause honoured, and URLs that robots.txt disallows are not requested (`checkError: "ROBOTS_DISALLOWED"`, not charged). A host that stops answering is left alone after 10 failures in a row; its remaining URLs get `checkError: "HOST_UNRESPONSIVE"` and are not charged. Large sites take time at that pace: about 9 URLs per second on one host, so roughly 20 minutes per 10,000 URLs; several sites in one run are checked side by side.

### Results, zeros and errors

- A site whose sitemaps were read but list no URL, or none matching your filters, is reported as such in the status and the summary row; the run SUCCEEDS.
- A site with no sitemap in robots.txt nor at any standard path is reported as `NO_SITEMAP`; a domain that does not resolve as `SITE_UNREACHABLE`. Both are answers, so the run SUCCEEDS.
- A sitemap that could not be read (403, 5xx, timeout) is named in the summary row and the status, never reported as "no URLs". If no site could be read, the run FAILS with the reason.
- Invalid input ends the run right away with an "Input error: ..." message and only the $0.001 start charge.
- Only public http(s) addresses are fetched: private, local and cloud-metadata addresses are refused, also after redirects. A sitemap file is read up to 100 MB (the protocol limit is 50 MB).

### Pricing

- $0.001 per run (start).
- $1.00 per 1,000 sitemap files read on Free ($0.70 on Gold): one per file that parsed as a sitemap, indexes included. A standard path that holds no sitemap, and a file that fails, are not charged.
- $0.30 per 1,000 URLs delivered on Free, with lower prices on higher Apify plans ($0.21 per 1,000 on Gold).
- Status check (optional): $0.20 per 1,000 URLs checked on Free ($0.14 on Gold); URLs skipped by robots.txt or an unresponsive host are not charged.
- Summary rows are free. Platform usage is included.

Examples on Free: a 5,000-URL site in 3 sitemap files costs $0.001 + $0.003 + $1.50 = about $1.50 (about $2.50 with the status check). A filtered run that scans all 37 sitemap files of a large site (877,000 URLs) and keeps 161 of them costs $0.001 + $0.037 + $0.048 = about $0.09, and takes about 10 seconds.

Set a maximum charge per run in Apify if you want a hard ceiling; the actor stops at it and says so in the status.

### FAQ

**Does it crawl the website's pages?** No. It reads only robots.txt and the sitemap files, so it is fast and light on the site. The optional status check sends one HEAD (or GET) request per URL and never downloads page bodies.

**The site has no sitemap. What then?** The status and summary row say `NO_SITEMAP` and list the paths tried. To list the pages of a site without a sitemap you need a crawler.

**Why are some URLs from another domain?** Some sites list pages of their other domains or a CDN in their sitemaps; the actor reports what the sitemap says.

**How big can a site be?** Up to 1,000,000 URLs and 10,000 sitemap files per site per run. Each file is streamed from disk, so memory does not grow with the size of the site.

**Can I use it with Make, Zapier, n8n or the API?** Yes. Schedule it with *Modified after* set to `1 day` to get each day's new and updated URLs.

### Data use

The actor reads robots.txt and the sitemap files that websites publish for search engines. It respects robots.txt rules for every file it fetches other than the sitemaps robots.txt itself lists, sends an honest User-Agent that names this actor, does not log in and fetches no page bodies.

# Changelog

This Actor's version history is a separate document: https://apify.com/tagadanar/sitemap-extractor/changelog.md

# Actor input Schema

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

A website (example.com or https://example.com) to discover its sitemaps from robots.txt and the standard paths (/sitemap.xml, /sitemap_index.xml, /wp-sitemap.xml ...), or a sitemap file itself (.xml, .xml.gz, .txt, sitemap index, RSS/Atom feed) to read just that one. Up to 100 per run.

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

Stop reading a site's sitemaps after this many URLs were delivered (after filters and de-duplication). Default 5,000, max 1,000,000.

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

Keep only URLs matching at least one pattern. `*` is a wildcard; a pattern starting with `/` matches the path (`/blog/*`); a full URL matches the start (`https://example.com/docs/*`); `/regex/` is a regular expression.

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

Drop URLs matching any of these patterns (same syntax as the include patterns), e.g. `/tag/*` or `*?page=*`.

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

Keep only URLs whose sitemap <lastmod> is on or after this date: 2026-01-31, 2026-01-31T12:00:00Z, or relative like "7 days", "24 hours", "3 months". Sitemap files an index dates before this are not downloaded.

## `lastmodBefore` (type: `string`):

Keep only URLs whose sitemap <lastmod> is on or before this date (same formats). Use it with "Modified after" for a window, or alone to find stale pages.

## `includeUndated` (type: `boolean`):

With a date filter on, URLs whose sitemap gives no <lastmod> are dropped by default; turn this on to keep them.

## `checkStatus` (type: `boolean`):

Send a HEAD request (GET when HEAD is refused) to every delivered URL and add its status code, the redirect target and the final status. Billed per URL checked. Polite: at most 4 requests in flight and 10 per second per host, robots.txt rules and Crawl-delay respected.

## `includeSummary` (type: `boolean`):

One extra row per site (rowType "summary", free): sitemap files read with their URL counts and newest lastmod, URLs scanned / filtered / duplicated, newest and oldest lastmod, status-code counts.

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

Safety cap on the sitemap files (indexes included) read for one site. Default 500, max 10,000.

## Actor input object example

```json
{
  "startUrls": [
    "https://nodejs.org"
  ],
  "maxUrlsPerSite": 100,
  "includeUndated": false,
  "checkStatus": false,
  "includeSummary": true,
  "maxSitemapsPerSite": 500
}
```

# Actor output Schema

## `dataset` (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://nodejs.org"
    ],
    "maxUrlsPerSite": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/sitemap-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://nodejs.org"],
    "maxUrlsPerSite": 100,
}

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

```

## MCP server setup

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