XML Sitemap URL Extractor icon

SEO & ads intelligence · Developer tools

XML Sitemap URL Extractor

Point it at a list of sites and get every URL their sitemaps publish, in one dataset — including sitemap index files, gzip sitemaps, and robots.txt-only listings.

Free Apify credit covers a first run. No credit card to try.

What this Actor scrapes

Give it a list of site URLs and it discovers every sitemap the site publishes — first by trying /sitemap.xml directly, then by parsing Sitemap: lines out of robots.txt (a 200 response on either is not treated as proof of a real sitemap; the Actor checks the Content-Type and looks like real sitemap XML before it commits to parsing it). Sitemap index files (<sitemapindex>) are expanded recursively up to a configurable depth, gzip-compressed sitemaps (.xml.gz) are decompressed transparently, and redirects are followed. Every leaf <url> entry becomes one dataset row tagged with the sitemap file and source site it came from.

What we handle for you

  • 🛡️ Browser fingerprint rotationcurl-cffi impersonates real Chrome / Firefox / Safari TLS handshakes so the target sees a browser, not Python.
  • 🌐 Residential proxy rotation via Apify Proxy — fresh session and exit IP on every block.
  • 🔁 Retries with exponential backoff on 408 / 429 / 5xx — up to 5 attempts per page, Retry-After honoured.
  • 🧱 Rate-limit-aware pacing — when the target pushes back, we slow down instead of getting banned.
  • 🧊 Clean, typed dataset rows — Pydantic-validated, ISO-8601 timestamps, stable IDs, JSON / CSV / Excel export straight from the Apify Console.
  • 💰 Pay-Per-Event pricing — you only pay for results that hit your dataset. No data, no charge.

Use cases

  • SEO content audits — pull a site's full published-URL inventory in one pass, no crawling required.
  • Site migration checks — diff sitemap output before/after a replatform to confirm nothing silently dropped.
  • Competitive research — see how many pages a competitor publishes and how often they update (lastmod, changefreq).
  • Freshness monitoring — schedule runs and diff lastmod values to catch stale or newly-published pages.

Input

Paste this into the Apify Console, or send it as the run input over the API. Proxy settings are on by default; you rarely need to touch them.

FieldTypeRequiredWhat it does
siteUrls array yes Root or homepage URLs to scan, one per line. For each, the Actor tries `/sitemap.xml` directly and parses `Sitemap:` lines from `/robots.txt`.
maxUrlsPerSite integer no Stop emitting rows for one site after this many URLs. Also lets the Actor stop fetching further sitemap files for that site once reached.
maxSitemapDepth integer no How many levels of nested `` to follow. A depth-1 index pointing at leaf sitemaps is depth 1; an index of indexes is depth 2. Enforced with a visited-URL set, so a self-referencing or circular index cannot loop forever.
maxTotalUrls integer no Hard ceiling on rows emitted across every site in this run, regardless of `maxUrlsPerSite`. Bandwidth is our biggest cost driver, so this is the last line of defense against an unbounded crawl.
{
  "siteUrls": [
    "https://www.cloudflare.com",
    "https://apify.com"
  ],
  "maxUrlsPerSite": 10,
  "maxSitemapDepth": 3,
  "maxTotalUrls": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}

Output

One row per result, schema-validated before it is written. Export JSON, CSV, Excel or XML from the run, or read it over the API.

loclastmodchangefreqprioritysitemap_urlsource_site

{
  "loc": "https://apify.com/about",
  "lastmod": null,
  "changefreq": null,
  "priority": null,
  "sitemap_url": "https://apify.com/sitemap/pages.xml",
  "source_site": "https://apify.com"
}

Pricing

EventPriceWhen
Actor start$0.20Once per run, covers warm-up and proxy session setup.
Result emitted$0.0020Per result written to the dataset.

You pay only for results that land. Cap any run with maxTotalChargeUsd. See pricing & billing for worked examples.

Limitations

  • We read what a site's sitemap files declare — we don't crawl or discover pages a site doesn't list in a sitemap.
  • The standard sitemap protocol caps a single leaf file at 50,000 URLs; large sites split across many files via a sitemap index, which we follow up to maxSitemapDepth.
  • maxUrlsPerSite and maxTotalUrls are hard caps by design (bandwidth control) — raise them if you need a fuller export, within the input limits.

FAQ

What if a site has no sitemap.xml or robots.txt Sitemap entry?
That site contributes zero rows and the run still SUCCEEDS — the status message reports how many of the input sites actually yielded a sitemap. This is a completed search that found nothing, not a failure.
Does it handle sitemap index files?
Yes — <sitemapindex> files are expanded recursively up to maxSitemapDepth. A visited-URL set stops circular or self-referencing indexes from looping.
Does it handle gzip-compressed sitemaps?
Yes, transparently — both .xml.gz URLs and sitemaps served with Content-Encoding: gzip (or just gzip magic bytes regardless of headers) are decompressed before parsing.
What happens if one site is unreachable or its sitemap is malformed?
That one site or sitemap file is skipped with a logged warning; the rest of the run continues. One bad target never fails the whole run.
Why did I get an HTML page instead of sitemap data for a site?
Some sites return a 200 HTML page (a redirect landing page, a CMS 404-as-200) at the sitemap path. The Actor checks the Content-Type and the actual root XML tag before parsing — an HTML shell is logged and skipped, not force-parsed as XML.

Ready to run it?

Open the listing on Apify, paste the input above, and watch rows land. If it ever breaks, it is our problem before it is yours.

Related Actors

Teams that run this also run