# Sitemap & URL Extractor (Reliable, Any Website) (`pankajbhatia/sitemap-url-extractor`) Actor

Get every page URL from any website's sitemaps. Auto-discovers sitemaps via robots.txt, follows sitemap indexes, handles .gz, broken XML, text sitemaps and RSS/Atom. Filter by pattern and date. Optional HTTP status check.

- **URL**: https://apify.com/pankajbhatia/sitemap-url-extractor.md
- **Developed by:** [Pankaj Bhatia](https://apify.com/pankajbhatia) (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 url returneds

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

Get **every page URL** from any website's sitemaps as a clean table: URL, last-modified date, change frequency, priority, images, language alternates and Google News data. Just type a domain. The Actor finds the sitemaps for you.

- **Auto-discovery**: reads `robots.txt`, then tries common locations (`/sitemap.xml`, `/sitemap_index.xml`, `/wp-sitemap.xml`, `.gz` and more).
- **Handles messy real-world sitemaps**: nested sitemap indexes, `.xml.gz` files, broken XML, byte-order marks, plain-text sitemaps, and RSS/Atom feeds.
- **Fast and cheap**: no browser. It reads 30,000 URLs in about 20 seconds.
- **Filters**: include/exclude URL patterns, and "modified after" a date.
- **Optional status check**: finds 404s and redirects that are still listed in a sitemap.
- **Retries automatically** and only falls back to a proxy if a site blocks the request.

### Who is it for?

- **SEO specialists and agencies**: audit sitemaps, find broken or redirected URLs, and track newly published pages.
- **AI / RAG builders**: get the full list of pages to feed into a content crawler or vector database.
- **Content and competitor monitoring**: see what a competitor published since a given date (`modifiedAfter`).
- **Developers and AI agents**: one clean JSON list of URLs for any site, over the API.

### How to use it

1. Add one or more **websites** (for example `apify.com`) or **direct sitemap URLs**.
2. Optionally add **URL patterns** (for example `/blog/`) or a **modified-after date**.
3. Click **Start** and export the results as JSON, CSV or Excel, or use the API.

#### Pattern syntax

| Pattern | Meaning |
|---|---|
| `/blog/` | URL contains `/blog/` |
| `*/products/*` | Wildcards |
| `re:/news/20(25\|26)/` | Regular expression (prefix `re:`) |

### Input example

```json
{
  "startUrls": [{ "url": "https://www.example.com" }],
  "includePatterns": ["/blog/"],
  "excludePatterns": ["/tag/", "/author/"],
  "modifiedAfter": "2026-09-01",
  "maxUrlsPerSite": 1000,
  "checkStatus": false
}
```

### Output example

```json
{
  "url": "https://www.nytimes.com/athletic/7664898/2026/10/06/yankees-game-2-alds-mistakes-errors-rays/",
  "lastmod": "2026-10-07T11:51:11Z",
  "changefreq": null,
  "priority": null,
  "site": "https://www.nytimes.com",
  "domain": "www.nytimes.com",
  "sitemapUrl": "https://www.nytimes.com/sitemaps/new/news.xml.gz",
  "sitemapType": "urlset",
  "images": ["https://static01.nyt.com/athletic/uploads/....jpg"],
  "news": { "publicationDate": "2026-10-06T09:41:20Z", "title": "For Yankees, a harsh reality after Game 2 meltdown..." }
}
```

With **Check each URL's HTTP status** turned on, each row also gets `statusCode`, `finalUrl` and `redirected`.

If a site has no sitemap, you get **one free row** with an `error` explaining why, so you never pay for nothing. A per-site summary (sitemaps found and read, errors, URLs skipped) is saved as `SITE_SUMMARIES` in the run's key-value store.

### How much does it cost?

Pay-per-event: you pay a small fee **per URL returned**, with a slightly higher price for URLs with a status check. For example, 1,000 URLs cost about $1 (about $2 with status checks on). Set **Maximum cost per run** to cap any run. The Actor stops cleanly at your limit. Use `maxUrlsPerSite` to keep large sites in check.

### Use it through the API, integrations or AI agents

Run it from the Apify API, on a schedule, or connect it to Make, Zapier, n8n or Google Sheets. AI agents can find and call it through the Apify MCP server. Output is clean JSON with the same fields on every run.

### FAQ

**The site returned nothing?** Some sites don't publish a sitemap (python.org, for example) or hide it. Check the free error row and `SITE_SUMMARIES`.

**Why were URLs skipped with "modified after"?** Many sitemaps have no `lastmod` dates. Those URLs can't be date-filtered, so they're skipped, and the summary tells you how many.

**Does it crawl pages?** No. It reads the sitemaps that websites publish for search engines, which makes it fast and light on the sites. Status checks send one light request per URL.

**Found a sitemap it can't read?** Open an issue with the URL. We usually reply within 24 hours.

### More tools from this developer

- [SAM.gov Contract Opportunities Finder & Bid Alerts](https://apify.com/pankajbhatia/sam-gov-contract-opportunities): federal contract opportunities and bid alerts
- [Website to Markdown for AI & RAG](https://apify.com/pankajbhatia/website-to-markdown): turn web pages into clean Markdown for LLMs
- [Tech Stack Detector](https://apify.com/pankajbhatia/tech-stack-detector): find what any website is built with
- [Apple App Store Reviews Scraper](https://apify.com/pankajbhatia/app-store-reviews): App Store reviews and ratings for any app
- [ATS Jobs Scraper](https://apify.com/pankajbhatia/ats-jobs-scraper): jobs from Greenhouse, Lever, Ashby, Workable and more
- [Website Screenshot](https://apify.com/pankajbhatia/website-screenshot): full-page, mobile and PDF screenshots in bulk
- [PDF to Text & Markdown Extractor](https://apify.com/pankajbhatia/pdf-text-extractor): extract text from PDFs for AI and search
- [Domain WHOIS, DNS & SSL Checker](https://apify.com/pankajbhatia/domain-whois-dns-ssl-checker): bulk domain, DNS, email security and SSL checks
- [SEO Meta Tags & On-Page Audit](https://apify.com/pankajbhatia/seo-meta-tags-checker): bulk on-page SEO audit with fixes
- [Bulk URL Status & Broken Link Checker](https://apify.com/pankajbhatia/url-status-broken-link-checker): status codes, redirect chains and broken links
- [RSS & Atom Feed Reader](https://apify.com/pankajbhatia/rss-feed-reader): merge and filter many news feeds
- [Hacker News Scraper](https://apify.com/pankajbhatia/hacker-news-scraper): HN stories, comments and Who is hiring jobs
- [Academic Paper Search](https://apify.com/pankajbhatia/academic-paper-search): papers from Crossref, arXiv and PubMed
- [SEC EDGAR Filings & Financials](https://apify.com/pankajbhatia/sec-edgar-filings-financials): 10-K, 10-Q, 8-K filings and company financials

# Actor input Schema

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

Enter websites (e.g. apify.com) to auto-discover their sitemaps, or direct sitemap URLs (e.g. https://example.com/sitemap.xml).

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

Keep URLs that match ANY pattern. Plain text = 'contains' (e.g. /blog/). Wildcards work (e.g. */products/*). Prefix with re: for a regular expression.

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

Drop URLs that match ANY pattern (same syntax as above), e.g. /tag/, /author/.

## `modifiedAfter` (type: `string`):

Keep only URLs whose sitemap lastmod is after this date (YYYY-MM-DD). URLs without a lastmod are dropped when this is set.

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

Stop after this many URLs for each site. Raise it for big sites (e.g. 50000). 0 = no limit.

## `includeExtras` (type: `boolean`):

Adds image URLs, language alternates and Google News fields when the sitemap has them.

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

Sends a light request to every URL and adds statusCode, finalUrl and redirected. Finds broken (404) and redirected pages listed in your sitemap. Priced slightly higher per URL.

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

How many requests run in parallel. Lower it for small or fragile sites.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for each sitemap download.

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

Safety limit on how many sitemap files are read per site (large sites split URLs across many files).

## `proxyConfiguration` (type: `object`):

Only used as a fallback when a site blocks the request (403/429/503). Most sites need no proxy.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "maxUrlsPerSite": 1000,
  "includeExtras": true,
  "checkStatus": false,
  "maxConcurrency": 10,
  "requestTimeoutSecs": 30,
  "maxSitemapsPerSite": 500,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One item per page URL found in the site's sitemaps.

## `siteSummaries` (type: `string`):

Sitemaps found and read, errors, URLs found and returned per site.

# 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": [
        {
            "url": "https://apify.com"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pankajbhatia/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": [{ "url": "https://apify.com" }] }

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

```

## MCP server setup

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