Sitemap URL Extractor: Index, Gzip and robots.txt Sitemaps
Pricing
from $0.50 / 1,000 url extracteds
Sitemap URL Extractor: Index, Gzip and robots.txt Sitemaps
Sitemap URL extractor: list the URLs a site publishes in its XML sitemaps. Finds sitemaps through robots.txt, follows sitemap index files and reads gzip. One flat row per URL with lastmod, changefreq, priority and the sitemap it came from. Reads sitemap files only, never the pages they list.
Pricing
from $0.50 / 1,000 url extracteds
Rating
0.0
(0)
Developer
angel nguyen
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
2 days ago
Last modified
Categories
Features
Share
This sitemap URL extractor returns every URL a website lists in its XML sitemaps, one row per URL. Give it a domain and it reads the site's robots.txt, finds the sitemap files named there, follows sitemap index files down to three levels and reads gzip-compressed sitemaps. Each row carries the site's own lastmod, changefreq and priority hints and the sitemap file the URL came from.
What you get
- One flat row per URL, in the order the sitemaps list them.
- The sitemap file and nesting depth behind every row, so you can see where each URL was published.
- Each URL once per site, even when two sitemaps list it.
- A typed error row for every input or file that could not be read, at no charge.
- A
SUMMARYrecord in the run's key-value store with per-file counts, robots.txt status per host and request counts.
The Actor reads robots.txt and sitemap files only. It never fetches the pages the sitemaps list.
Input
The one required idea is sites. This is a complete input:
{"sites": ["crawlee.dev"]}
The example input below is the one we measured (see "Measured run"):
{"sites": ["crawlee.dev", "nodejs.org", "developer.mozilla.org"], "maxUrls": 20}
| Field | Type | What it does |
|---|---|---|
sites | array of strings | A domain (crawlee.dev), a site URL (reduced to its origin), or the URL of one sitemap file (ending in .xml or .xml.gz, or with sitemap in its last path segment). At most 100 per run. |
includePattern | string, optional | Keep only URLs containing this text, for example /docs/. Plain text, case ignored, not a regular expression. |
lastmodAfter | string, optional | A date YYYY-MM-DD, for example 2025-01-01. Keep only URLs whose lastmod is on or after that date. URLs with no lastmod are left out when you set this. |
maxUrls | integer | Most URL rows per site, 1 to 50,000. Default 1000. Once a site reaches it, no further sitemap file of that site is read. |
How a site's sitemaps are found: first the Sitemap: lines of its robots.txt, in file order. When robots.txt names none, the Actor tries /sitemap.xml and then /sitemap_index.xml.
Output fields
URL rows:
| Field | Type | Meaning |
|---|---|---|
site | string | Origin of the site, e.g. https://crawlee.dev |
url | string | The URL exactly as the sitemap lists it. Use it as the dedupe key. |
lastmod | string | lastmod as published; empty string when absent |
lastmodIso | string or null | lastmod as an ISO 8601 UTC time; null when absent or not a valid date |
changefreq | string | changefreq as published; empty string when absent |
priority | number or null | priority from 0 to 1; null when absent or out of range |
sitemapUrl | string | The sitemap file this URL was read from |
sourceUrl | string | Same as sitemapUrl: the one source of the row |
position | integer | 1-based place of the URL in its sitemap file |
depth | integer | 0 for a sitemap named by robots.txt, a default path or your input; plus one per index level |
isIndexChild | boolean | true when the file was listed by a sitemap index |
discoveredVia | string | robots, default-path or input |
checkedAt | string | ISO 8601 UTC time the sitemap file was read |
Error rows add these fields and keep sitemapUrl:
| Field | Type | Meaning |
|---|---|---|
error | boolean | Always true |
errorCode | string | One of the codes below |
input | string | The input entry the error belongs to |
httpStatus | integer or null | The HTTP status, when there was one |
errorMessage | string | What went wrong |
lastmod, changefreq and priority are hints the site chooses to publish, and many sites leave them out. In our measured run, 20 of 60 rows carried a lastmod, 40 of 60 a changefreq and 20 of 60 a priority.
A real row from the measured run:
{"site": "https://crawlee.dev", "url": "https://crawlee.dev/blog", "lastmod": "", "lastmodIso": null, "changefreq": "weekly", "priority": 0.5, "sitemapUrl": "https://crawlee.dev/sitemap.xml", "sourceUrl": "https://crawlee.dev/sitemap.xml", "position": 1, "depth": 0, "isIndexChild": false, "discoveredVia": "robots", "checkedAt": "2026-11-20T17:34:36.100Z"}
Measured run
On 2026-11-20 we ran the example input above from our own machine (a local run of this code, not on the Apify platform). It returned 60 URL rows, 20 per site, and 0 error rows in 4.6 seconds. For developer.mozilla.org the rows came from the first child of its sitemap index, a file of 14,895 entries.
How the Actor honours robots.txt
Before any other request to a host, the Actor reads that host's robots.txt with its own User-Agent:
sitemap-urls/0.1 (+https://apify.com/praise-most-high/sitemap-urls)
Its product token is sitemap-urls. A robots.txt group for sitemap-urls wins over the group for every agent. The longest matching rule wins, and Allow wins a tie. A sitemap file whose path is disallowed is not read and gives a ROBOTS_DISALLOWED row.
- robots.txt answers 200: its rules apply, and its
Sitemap:lines are used. - robots.txt answers 400 to 499: every path is allowed. RFC 9309 (https://www.rfc-editor.org/rfc/rfc9309.html), section 2.3.1.3: "If a server status code indicates that the robots.txt file is unavailable to the crawler, then the crawler MAY access any resources on the server."
- robots.txt answers 429 or 500 to 599, times out or gives no answer: nothing on that host is read. RFC 9309, section 2.3.1.4: "If the robots.txt file is unreachable due to server or network errors, this means the robots.txt file is undefined and the crawler MUST assume complete disallow."
- A redirect to another host is checked against that host's robots.txt first.
Only point the Actor at sites you have the right to read. URLs are returned exactly as each site publishes them. If a site puts personal names in its URLs, handling that data lawfully is your responsibility.
Limits
- One request at a time, and at least 1 second between two requests to the same host.
- A
Crawl-delayin robots.txt is honoured up to 10 seconds. - At most 100 sites per run and at most 50,000 URLs per site.
- Sitemap files follow the sitemaps.org limits: at most 50,000 entries and 50 MB uncompressed per file. A larger file gives a
SITEMAP_TOO_LARGErow. - Sitemap index files are followed to depth 3.
- XML sitemaps only. HTML sitemaps, RSS or Atom feeds and plain-text URL lists give a
SITEMAP_PARSE_ERRORrow. - No proxy, no cookies, no login.
Error codes
Each failed input or file gives one error row in the dataset. Error rows are never charged.
| Code | When |
|---|---|
NO_INPUT | sites is empty |
INVALID_SITE | An entry is not an http or https URL or domain |
ROBOTS_DISALLOWED | robots.txt disallows the file, or could not be read (429, 5xx, no answer) |
SITEMAP_NOT_FOUND | robots.txt names no sitemap and neither default path holds one |
SITEMAP_HTTP_ERROR | A sitemap answered 404, 410, a second 429, a 5xx after one retry, or another error |
SITEMAP_PARSE_ERROR | The file is not an XML urlset or sitemapindex |
SITEMAP_TOO_LARGE | Over 50,000 entries or over 50 MB after gunzip |
A run that delivers at least one URL row ends SUCCEEDED. A run with no URL row ends FAILED, and its status message names the error codes.
Pricing
- 0.0005 USD per URL delivered (0.50 USD per 1,000 URLs).
- 0.00005 USD per run start, charged by the Apify platform.
Error rows, duplicate URLs and URLs past maxUrls are free. If you set a maximum charge for a run, the Actor stops delivering rows when it is reached.
For AI agents and the Apify MCP server
- One field is enough:
{"sites": ["example.com"]}. - Field names are flat, typed and stable.
urlis the dedupe key. - Branch on
error: a row witherror: truecarrieserrorCodeandinput, so an agent can retry or drop that one input. - Use
maxUrlsto cap cost before the run: the most a run can charge for URL rows is sites timesmaxUrlstimes 0.0005 USD.
Example request body for a run:
{"sites": ["nodejs.org"], "includePattern": "/learn/", "maxUrls": 50}
Support and feedback
Questions, bugs and feature requests go to the Issues tab of this Actor's page. We answer issues within 14 days.