Sitemap Extractor avatar

Sitemap Extractor

Pricing

Pay per usage

Go to Apify Store
Sitemap Extractor

Sitemap Extractor

Extracts and parses XML sitemaps from websites. Handles sitemap indexes, image sitemaps, robots.txt discovery, and outputs structured URL data for SEO audits, content inventories, and site migrations.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Luck Vergouwen

Luck Vergouwen

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Features

Limited permissions

Share

Extract every URL from any website's XML sitemaps — including sitemap indexes, image sitemaps, and deeply nested sitemap trees. Built for SEO teams, content auditors, and site migration engineers who need a clean, structured inventory of all indexed pages.

What it does

For each input URL, the actor:

  1. Fetches robots.txt and reads all Sitemap: directives.
  2. Falls back to probing common sitemap paths (/sitemap.xml, /sitemap_index.xml, /wp-sitemap.xml, and others) if robots.txt yields nothing.
  3. Detects sitemap index files and recursively fetches all child sitemaps.
  4. Parses each <urlset> sitemap and extracts: loc, lastmod, changefreq, priority.
  5. Optionally extracts image URLs from image sitemaps (image:loc).
  6. Outputs one dataset record per domain.

Gzipped sitemaps (.xml.gz) are detected and skipped with a note in the errors array — they require a decompression library not bundled in this lightweight actor.

Input

{
// Required. One or more website or direct sitemap URLs.
"urls": ["https://example.com", "https://another-site.com/sitemap.xml"],
// Optional. Extract image URLs from image sitemaps. Default: false.
"includeImages": false,
// Optional. Maximum URLs to collect per domain. 0 = unlimited. Default: 50000.
"maxUrls": 50000
}
FieldTypeRequiredDefaultDescription
urlsstring[]Yes—Root domain URLs or direct sitemap paths
includeImagesbooleanNofalseInclude image:loc entries in output
maxUrlsintegerNo50000Per-domain URL cap (0 = unlimited)

You can pass either a root domain (https://example.com) or a direct sitemap URL (https://example.com/sitemap.xml). The actor handles both.

Output

One dataset record per input domain:

{
"domain": "example.com",
"inputUrl": "https://example.com",
"sitemapUrls": [
"https://example.com/sitemap_index.xml",
"https://example.com/sitemap-posts.xml",
"https://example.com/sitemap-pages.xml"
],
"totalUrls": 1842,
"urls": [
{
"loc": "https://example.com/blog/post-1",
"lastmod": "2024-11-01",
"changefreq": "weekly",
"priority": "0.8",
"images": ["https://example.com/img/hero.jpg"] // only if includeImages: true
}
// ... more entries
],
"errors": [],
"scannedAt": "2024-11-18T12:34:56.789Z"
}
FieldTypeDescription
domainstringHostname extracted from the input URL
inputUrlstringOriginal URL as provided in input
sitemapUrlsstring[]All sitemap files fetched (root + child sitemaps)
totalUrlsintegerCount of URL entries in the urls array
urlsobject[]Extracted URL entries (see below)
errorsstring[]Non-fatal errors encountered during extraction
scannedAtstringISO 8601 timestamp when extraction ran

URL entry fields

FieldTypeDescription
locstringThe page URL (always present)
lastmodstring|nullLast modified date as declared in the sitemap
changefreqstring|nullChange frequency hint (daily, weekly, etc.)
prioritystring|nullPriority score between 0.0 and 1.0
imagesstring[]|undefinedImage URLs (only present when includeImages: true)

Common use cases

SEO audit

Run against your domain to get a full picture of what Google is being told to crawl. Cross-reference with your analytics to find pages that are sitemapped but receive no traffic, or pages that rank but are missing from the sitemap.

Content inventory

Export the dataset to CSV (via the Apify console) and sort by lastmod to find stale content. Filter by URL patterns to categorise content types (blog posts vs. product pages vs. landing pages).

Site migration

Run the actor before and after a migration. Compare the two URL lists to verify that all URLs have been properly redirected and that no pages were accidentally dropped from the new sitemap.

Competitor research

Input a competitor's domain to get a rough inventory of their content structure and publishing cadence (via lastmod and changefreq values).

Limitations

  • Gzipped sitemaps (.xml.gz) are detected and skipped. A note is added to the errors array for each skipped sitemap.
  • Non-standard XML that is heavily malformed may not parse correctly. Standard WordPress, Yoast, Rank Math, and Google-generated sitemaps are fully supported.
  • JavaScript-rendered sitemaps are not supported — the actor fetches raw HTTP responses only.
  • Password-protected or IP-restricted sitemaps will return a non-200 status and be reported in errors.

Pricing

This actor uses per-event charging. You are charged $0.01 per domain processed, regardless of how many sitemaps or URLs are extracted. There is no charge for failed domains where no sitemaps could be found.

Technical details

  • Runtime: Node.js 22 on apify/actor-node:22 (lightweight, no browser)
  • XML parsing: regex-based (no external parser dependency)
  • Dependencies: apify SDK only
  • Memory: 128 MB minimum, 256 MB recommended for large sites (100k+ URLs)
  • Timeout: 30 seconds per HTTP request; actors run with Apify's default run timeout