# Sitemap URL Extractor (`kindliest_readiness/sitemap-url-extractor`) Actor

Extract page URLs and last-modified values from XML sitemaps, nested indexes, and gzip sitemap files.

- **URL**: https://apify.com/kindliest_readiness/sitemap-url-extractor.md
- **Developed by:** [Ming Zhang](https://apify.com/kindliest_readiness) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 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/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

Export page URLs from XML sitemaps for SEO audits, site migrations, and content inventories. The Actor follows nested sitemap indexes, reads gzip-compressed sitemaps, and records which sitemap listed each URL.

### Input

| Field | Default | What it controls |
| --- | --- | --- |
| `startUrls` | Required | HTTP(S) URLs for sitemaps, sitemap indexes, or site roots. For each root the Actor tries `/sitemap.xml` and discovers additional URLs from `Sitemap:` lines in `/robots.txt`. |
| `maxSitemaps` | `50` | Maximum number of distinct sitemap URLs attempted, including indexes and failures. |
| `maxUrls` | `10000` | Maximum number of dataset rows after filtering and deduplication. |
| `pathContains` | Empty | Case-sensitive substring of the URL pathname. |
| `modifiedSince` | Empty | Inclusive `YYYY-MM-DD` cutoff. The Actor uses the calendar date written in `lastmod` and skips URLs with missing or invalid dates when this filter is set. |
| `dedupe` | `true` | Keep the first matching occurrence of each normalized URL across all sitemaps. |

```json
{
  "startUrls": ["https://example.com/sitemap.xml"],
  "pathContains": "/articles/",
  "modifiedSince": "2026-01-01"
}
```

### Output

The dataset has one row per matching URL. `lastmod` contains the trimmed value as supplied by the sitemap, or an empty string when absent. `sitemap` is the requested sitemap URL.

```json
{
  "url": "https://example.com/articles/sitemap-basics",
  "lastmod": "2026-03-15T09:00:00Z",
  "sitemap": "https://example.com/sitemap.xml"
}
```

### Limits

- Requests run sequentially with a 15-second timeout per request and the user agent `OneRice-SitemapExtractor/0.1`.
- Responses are limited to 50 MiB, including after gzip decompression. Sitemaps must be UTF-8 XML. DTDs and custom entities are unsupported.
- Unavailable and invalid sitemaps are logged and skipped. Results come from page `<loc>` entries. The Actor fetches sitemap and discovery files only.

### Pricing

Pay per result. The owner sets the price in the Apify Store.

### Local development

Use Node.js 20 or newer. Run `npm test` for the offline core tests. Run `npm install` and then `npm start` to use the Actor with the Apify SDK. For local storage, place the input JSON in `storage/key_value_stores/default/INPUT.json` before starting.

# Actor input Schema

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

HTTP or HTTPS sitemap, sitemap index, or website root URLs. A website root is checked for /sitemap.xml and Sitemap entries in /robots.txt.

## `maxSitemaps` (type: `integer`):

Maximum number of sitemap URLs to attempt, including indexes and failed requests.

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

Maximum number of dataset rows after filtering and deduplication.

## `pathContains` (type: `string`):

Keep URLs whose path contains this case-sensitive text.

## `modifiedSince` (type: `string`):

Keep URLs with a valid last-modified date on or after this date in YYYY-MM-DD format.

## `dedupe` (type: `boolean`):

Keep the first matching occurrence of each normalized URL across all sitemaps.

## Actor input object example

```json
{
  "startUrls": [
    "https://onerice.getvea.life/sitemap.xml"
  ],
  "maxSitemaps": 50,
  "maxUrls": 5,
  "dedupe": true
}
```

# Actor output Schema

## `urls` (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://onerice.getvea.life/sitemap.xml"
    ],
    "maxUrls": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("kindliest_readiness/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": ["https://onerice.getvea.life/sitemap.xml"],
    "maxUrls": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("kindliest_readiness/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": [
    "https://onerice.getvea.life/sitemap.xml"
  ],
  "maxUrls": 5
}' |
apify call kindliest_readiness/sitemap-url-extractor --silent --output-dataset

```

## MCP server setup

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