# Sitemap URL Extractor: all pages from robots.txt & sitemaps (`globose_talent_mn9/sitemap-urls`) Actor

List every URL a website publishes in its XML sitemaps: auto-discovery via robots.txt, nested sitemap indexes, .gz, text and RSS sitemaps, lastmod/hreflang/image/news fields, include/exclude patterns, date filter and only-new monitoring mode.

- **URL**: https://apify.com/globose_talent_mn9/sitemap-urls.md
- **Developed by:** [Andrew Shamah](https://apify.com/globose_talent_mn9) (community)
- **Categories:** SEO tools, Developer tools, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.30 / 1,000 url results

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 pages from robots.txt and sitemaps

Give it a domain and get **every URL the site publishes in its XML sitemaps**, plus `lastmod`, `changefreq`, `priority`, hreflang alternates, image/video counts and Google News titles. No browser is needed: it reads only `robots.txt` and the sitemap files themselves, so it is fast (about 170,000 URLs in 30 seconds in our tests) and cheap.

### What it handles

- **Discovery:** reads the `Sitemap:` lines in `robots.txt`. If there are none, it tries `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml`, `/sitemap.xml.gz` and `/sitemap.txt`, skipping any path that robots.txt disallows.
- **Sitemap indexes,** nested up to 6 levels and fetched 4 at a time, with deduplication.
- **Gzip** (`.xml.gz`), **plain-text** sitemaps, **RSS/Atom** feeds used as sitemaps, and namespace-prefixed XML.
- **Extensions:** `xhtml:link` hreflang alternates, `image:image`, `video:video` and `news:title`.
- **Filters:** include and exclude patterns (`*/blog/*` globs or `/regex/`), and *modified after* a date.
- **Only-new mode** for monitoring. Schedule it and get only URLs that weren't in earlier runs, e.g. a competitor's new products, articles or landing pages.
- **Clear failures.** A site with no sitemap, or one that can't be reached, produces one free error row and a `SUMMARY` entry explaining what was checked.

### Input example

```json
{
  "startUrls": ["allbirds.com", "https://www.nytimes.com/sitemaps/new/news.xml.gz"],
  "includePatterns": ["*/products/*"],
  "lastmodAfter": "2026-10-01",
  "maxUrlsTotal": 100000
}
```

Any page URL works as input; the Actor uses the site's origin. For example, `https://wordpress.org/news/` reads all of `wordpress.org`. To read one sub-sitemap only, pass the sitemap URL directly.

### Output

```json
{
  "url": "https://www.nytimes.com/2026/10/27/opinion/ezra-klein-podcast-nate-silver.html",
  "lastmod": "2026-10-27T22:49:48.000Z", "changefreq": null, "priority": null,
  "alternates": null, "imageCount": 1, "videoCount": 0,
  "newsTitle": "Nate Silver on What the Polls Say — and What His Gut’s Telling Him",
  "sitemap": "https://www.nytimes.com/sitemaps/new/news.xml.gz",
  "site": "https://www.nytimes.com", "input": "https://www.nytimes.com/sitemaps/new/news.xml.gz",
  "scrapedAt": "2026-10-28T13:19:32.542Z", "error": null
}
```

The `SUMMARY` record in the key-value store shows, per site, how many sitemaps were found and fetched, any sitemap errors, the URLs listed and the URLs output.

### Pricing

This Actor uses pay-per-event pricing:

- Apify's standard **Actor start** fee.
- A **per-URL** fee for each URL in the dataset.

Error rows are free. Large sites can list **millions** of URLs (apify.com lists about 820,000), so by default a run stops at 100,000 URLs (`maxUrlsTotal`). Raise the limit, or set it to 0 for no limit, when you really want everything. You can also set *Maximum cost per run*, and the Actor stops cleanly at that amount.

### Limits and honest notes

- The output is only what the site lists in its sitemaps. Pages missing from the sitemap are not found, because this is not a crawler.
- `lastmod` values are whatever the site reports, and some sites set every page to "today".
- Only-new mode keys its memory on the exact list of start URLs.

### Legal and data use

The Actor fetches only `robots.txt` and sitemap files. Sitemaps are published so that automated agents can discover a site's URLs. It does not fetch page content, log in or bypass any protection, and it follows robots.txt `Disallow` rules when it probes for fallback sitemap paths. You are responsible for how you use the URLs and any content you fetch later.

# Actor input Schema

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

Domains (example.com), any page on the site (https://example.com/blog), or direct sitemap URLs (https://example.com/sitemap.xml, .xml.gz or .txt). For a domain, sitemaps are discovered from robots.txt, then common locations.

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

Keep only URLs matching at least one pattern. Use \* as a wildcard (e.g. */blog/*), or wrap in slashes for a regex (//products/\d+/).

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

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

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

Keep only URLs whose <lastmod> is on or after this date (YYYY-MM-DD). URLs without lastmod are kept unless 'Require lastmod' is on.

## `requireLastmod` (type: `boolean`):

When filtering by date, drop URLs that have no <lastmod>.

## `onlyNew` (type: `boolean`):

Monitoring mode: remembers returned URLs (per start-URL list) and outputs only new ones on later runs. Great for tracking new pages, products or articles on a competitor's site.

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

Add the xhtml:link hreflang alternates listed for each URL.

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

0 = no limit.

## `maxUrlsTotal` (type: `integer`):

Safety cap on URLs output per run (default 100,000). Set 0 for no limit. Big sites can list millions of URLs; you can also cap spend with the run's Maximum cost setting.

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

Safety limit on sitemap files followed per site (indexes included).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.sitemaps.org/sitemap.xml",
    "docs.apify.com"
  ],
  "requireLastmod": false,
  "onlyNew": false,
  "includeAlternates": true,
  "maxUrlsPerSite": 0,
  "maxUrlsTotal": 100000,
  "maxSitemapsPerSite": 1000
}
```

# Actor output Schema

## `overview` (type: `string`):

All sitemap URLs in the default dataset, shown with the 'overview' table view.

# 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://www.sitemaps.org/sitemap.xml",
        "docs.apify.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("globose_talent_mn9/sitemap-urls").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://www.sitemaps.org/sitemap.xml",
        "docs.apify.com",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("globose_talent_mn9/sitemap-urls").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://www.sitemaps.org/sitemap.xml",
    "docs.apify.com"
  ]
}' |
apify call globose_talent_mn9/sitemap-urls --silent --output-dataset

```

## MCP server setup

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

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/SzSgbqkogaOZVaczh/builds/i0mx3PFnzBqzgbilo/openapi.json
