Sitemap URL Extractor: Index, Gzip and robots.txt Sitemaps avatar

Sitemap URL Extractor: Index, Gzip and robots.txt Sitemaps

Pricing

from $0.50 / 1,000 url extracteds

Go to Apify Store
Sitemap URL Extractor: Index, Gzip and robots.txt Sitemaps

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

angel nguyen

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Features

Limited permissions

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 SUMMARY record 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}
FieldTypeWhat it does
sitesarray of stringsA 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.
includePatternstring, optionalKeep only URLs containing this text, for example /docs/. Plain text, case ignored, not a regular expression.
lastmodAfterstring, optionalA 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.
maxUrlsintegerMost 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:

FieldTypeMeaning
sitestringOrigin of the site, e.g. https://crawlee.dev
urlstringThe URL exactly as the sitemap lists it. Use it as the dedupe key.
lastmodstringlastmod as published; empty string when absent
lastmodIsostring or nulllastmod as an ISO 8601 UTC time; null when absent or not a valid date
changefreqstringchangefreq as published; empty string when absent
prioritynumber or nullpriority from 0 to 1; null when absent or out of range
sitemapUrlstringThe sitemap file this URL was read from
sourceUrlstringSame as sitemapUrl: the one source of the row
positioninteger1-based place of the URL in its sitemap file
depthinteger0 for a sitemap named by robots.txt, a default path or your input; plus one per index level
isIndexChildbooleantrue when the file was listed by a sitemap index
discoveredViastringrobots, default-path or input
checkedAtstringISO 8601 UTC time the sitemap file was read

Error rows add these fields and keep sitemapUrl:

FieldTypeMeaning
errorbooleanAlways true
errorCodestringOne of the codes below
inputstringThe input entry the error belongs to
httpStatusinteger or nullThe HTTP status, when there was one
errorMessagestringWhat 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-delay in 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_LARGE row.
  • 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_ERROR row.
  • 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.

CodeWhen
NO_INPUTsites is empty
INVALID_SITEAn entry is not an http or https URL or domain
ROBOTS_DISALLOWEDrobots.txt disallows the file, or could not be read (429, 5xx, no answer)
SITEMAP_NOT_FOUNDrobots.txt names no sitemap and neither default path holds one
SITEMAP_HTTP_ERRORA sitemap answered 404, 410, a second 429, a 5xx after one retry, or another error
SITEMAP_PARSE_ERRORThe file is not an XML urlset or sitemapindex
SITEMAP_TOO_LARGEOver 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. url is the dedupe key.
  • Branch on error: a row with error: true carries errorCode and input, so an agent can retry or drop that one input.
  • Use maxUrls to cap cost before the run: the most a run can charge for URL rows is sites times maxUrls times 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.