# Sitemap URL Scraper — Every URL, lastmod & New Pages (`northbell/sitemap-url-scraper`) Actor

Sitemap extractor and sitemap scraper: every URL from a site's robots.txt and sitemaps (indexes, .xml.gz, text) with lastmod, images, news and hreflang, or only the pages new since your last run. Never reads the pages. No proxy, no login. $0.50 per 1,000 URLs.

- **URL**: https://apify.com/northbell/sitemap-url-scraper.md
- **Developed by:** [Northbell](https://apify.com/northbell) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 pages

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 Scraper: Every URL, lastmod & New Pages

A sitemap extractor that reads only `robots.txt` and the sitemap files, never the pages: give it a website and get every URL with its `lastmod`, images, news data and language versions, or only the pages added since your last run. To get the new pages every day: save the website as a task with *Only new URLs since the last run* on and add a daily Schedule to that task in Apify Console. **$0.50 per 1,000 URLs**, no proxy, no login.

**Try it now. The input is already filled in.** Press **Start**: `gov.uk` returns **1,000 URLs from 2 sitemap files in 2.3 seconds, for $0.51**. The same site in full: **853,142 URLs from 37 sitemap files in 5 minutes 8 seconds** (measured on 19 Nov 2026, from a home connection; set Max URLs to 1,000,000 to get it). Three of the rows:

| `url` | `lastmod` | `priority` | `sourceSitemap` |
| --- | --- | --- | --- |
| https://www.gov.uk/ | none listed | 0.5 | /sitemaps/sitemap_1.xml |
| https://www.gov.uk/employment-tribunal-decisions/miss-k-king-v-paladin-nsas-3330686-2018 | 2026-10-01T08:52:33+01:00 | 0.5 | /sitemaps/sitemap_1.xml |
| https://www.gov.uk/hmrc-internal-manuals/economic-crime-supervision-handbook/ecsh34115 | 2026-09-30T10:11:39+01:00 | 0.5 | /sitemaps/sitemap_1.xml |

### Input

| Field | What it does |
|---|---|
| `startUrls` (required) | Homepages (`https://example.com`), `robots.txt` addresses or sitemap addresses. For a homepage the `Sitemap:` lines of its robots.txt are used; if there are none, `/sitemap.xml` and `/sitemap_index.xml` are tried. |
| `maxUrls` | Total cap over all sites. Default 1,000, up to 1,000,000. Reading stops when it is reached. |
| `maxUrlsPerSite` | Optional cap for each start URL. |
| `lastmodSince` | Optional date, for example `2026-11-01`. Keeps URLs whose `lastmod` is on or after it. URLs with no `lastmod` are dropped. |
| `urlContains` | Optional list of texts, for example `/blog/`. Keeps URLs containing any of them (not case sensitive). |
| `onlyNew` | On: returns only URLs that are new since an earlier run with the same start URL and filters. The first run returns up to Max URLs and still reads the whole sitemap, remembering the rest without returning or charging it, so the next run brings only pages that are really new. Default off. |
| `includeImages` | Adds the `image:loc` addresses of each URL. Default on. |
| `includeAlternates` | Adds the language versions (`hreflang`) of each URL. Default on. |

Sitemap indexes are followed up to 3 levels deep. `.xml`, `.xml.gz` and plain-text sitemaps (one URL per line) are read.

### What you get

| Row | Fields |
|---|---|
| `url` | `url`, `lastmod`, `changefreq`, `priority`, `images` (list of image addresses), `news` (`publicationName`, `publicationLanguage`, `title`, `publicationDate`), `alternates` (list of `hreflang` and `href`), `sourceSitemap`, `site`, `isNewSinceLastRun`, `observedAt` |
| `summary` (one per start URL, free) | `site`, `sitemapsRead`, `sitemapsFailed`, `urlsFound`, `urlsReturned`, `newSinceLastRun`, `filteredOut`, `alreadyReturned`, `truncated` |
| `error` (free) | `site`, `url`, `message` saying what to do |

`isNewSinceLastRun` is `null` on the first run for a start URL and filters, then `true` or `false`. `truncated` is `true` when the site had more matching URLs than your caps allowed.

### Pricing

- **$0.50 per 1,000 URLs** returned ($0.0005 each).
- **$0.01 per run**, charged together with the first URL. A run that returns no URL costs nothing.
- Summary rows, error rows and URLs removed by your filters are never charged.
- With `onlyNew` on you pay only for the new URLs.

### Questions

**What does it cost?** 1,000 URLs cost $0.51 including the run fee. A site with 50,000 URLs costs about $25. Set `maxUrls` (or Maximum total charge on the run) to keep it below a number you choose.

**Why did I get 0 results?** Look at the free `error` rows: the usual causes are a site with no sitemap (robots.txt lists none and `/sitemap.xml` does not exist; paste the sitemap address itself), a robots.txt that disallows the sitemap path, a `lastmodSince` or `urlContains` that matches nothing (the summary shows `filteredOut`), or `onlyNew` on with nothing added since the last run.

**How do I watch a site for new pages?** Schedule a run (daily or weekly) with `onlyNew` on and the same start URL and filters. Each run returns, and charges for, only the URLs added since the previous one. Another way is `lastmodSince` with a rolling date, which also catches pages that changed.

**Which fields do I get?** Every field in the `url` table above. `lastmod`, `changefreq` and `priority` are what the site writes in its sitemap, so they are empty when the site leaves them out. `images`, `news` and `alternates` are filled only when the site lists them.

### Notes

- Only `robots.txt` and the sitemap files are fetched. The pages themselves are never opened, so there is no HEAD request per page and nothing to block.
- robots.txt is respected, including for the sitemap addresses: a sitemap it disallows is skipped with a free error row. A `Crawl-delay` is honoured up to 10 seconds. One request at a time per host, at least 1 second apart.
- Rules written for AI crawlers that name Claude are respected too, so a few large sites that block those agents return an error row instead of URLs.
- Addresses on private or local networks are refused.
- No login, no proxy, no browser. The run identifies itself as `northbell-sitemap-urls`.
- What `onlyNew` remembers is kept in a stored list of short fingerprints of the URLs read (up to 1,000,000 per start URL and filters), not the URLs themselves.
- Sitemaps are what a site chooses to list. A page missing from the sitemap is not returned.

# Actor input Schema

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

Website homepages (https://example.com), robots.txt addresses or sitemap addresses, one per line. For a homepage the Sitemap lines in its robots.txt are used, or /sitemap.xml and /sitemap_index.xml if there are none. Only robots.txt and the sitemap files are fetched, never the pages.

## `maxUrls` (type: `integer`):

Stops reading when this many URLs are returned. Each URL returned is charged.

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

Optional. Cap for each start URL, so one big site does not use the whole budget.

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

Optional date such as 2026-11-01. Keeps URLs whose lastmod is on or after it. URLs with no lastmod are dropped (not charged).

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

Optional. Keep only URLs containing one of these texts (not case sensitive), for example /blog/ or /products/.

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

On: returns, and charges for, only URLs not returned by an earlier run with the same start URL and filters. The first run returns everything. Schedule it daily or weekly to watch a site for new pages.

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

Adds the image:loc addresses listed for each URL in the sitemap.

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

Adds the xhtml:link rel=alternate language versions listed for each URL.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.gov.uk/sitemap.xml"
  ],
  "maxUrls": 1000,
  "onlyNew": false,
  "includeImages": true,
  "includeAlternates": true
}
```

# Actor output Schema

## `urls` (type: `string`):

Every URL with lastmod, images, news, language versions and the sitemap it came from.

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

Sitemaps read and failed, URLs found, returned, new and filtered out.

# 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.gov.uk/sitemap.xml"
    ],
    "maxUrls": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("northbell/sitemap-url-scraper").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.gov.uk/sitemap.xml"],
    "maxUrls": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("northbell/sitemap-url-scraper").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.gov.uk/sitemap.xml"
  ],
  "maxUrls": 1000
}' |
apify call northbell/sitemap-url-scraper --silent --output-dataset

```

## MCP server setup

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

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/hUgKtmQzPPcE3hnOB/builds/zjdh6gC0Yhg1waeZk/openapi.json
