Sitemap to JSON — sitemap.xml to structured URL list avatar

Sitemap to JSON — sitemap.xml to structured URL list

Under maintenance

Pricing

Pay per usage

Go to Apify Store
Sitemap to JSON — sitemap.xml to structured URL list

Sitemap to JSON — sitemap.xml to structured URL list

Under maintenance

Parse sitemap.xml and sitemap indexes into structured JSON or CSV: url, lastmod, changefreq, priority. Follows sitemap indexes one level deep, zero parsing dependencies, no API keys. Great for SEO audits, crawl seeding, content inventories and site migrations.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Tang

Tang

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

12 days ago

Last modified

Features

Limited permissions

Share

Sitemap to JSON / CSV

Parse sitemap.xml and sitemap indexes into structured data. Zero parsing dependencies: Node http/https + regex XML parsing (only runtime dependency is the Apify platform SDK).

Output

json mode — one dataset record per URL

{
"sitemapUrl": "https://example.com/sitemap.xml",
"url": "https://example.com/page-1",
"lastmod": "2026-11-01",
"changefreq": "daily",
"priority": "0.8"
}

csv mode — one record per sitemap

{
"sitemapUrl": "https://example.com/sitemap.xml",
"urlCount": 123,
"csv": "url,lastmod,changefreq,priority\r\n\"https://...\",2026-11-01,daily,0.8",
"fetchedAt": "..."
}

CSV follows RFC4180 (quotes fields containing comma/quote/newline; rows end with \r\n).

Input

FieldTypeDefaultDescription
sitemapUrlsarray of strings— (required)Sitemap or sitemap-index URLs (local path / file:// works locally)
maxUrlsinteger500Total URL entries to output (1–50000)
outputModejson / csvjsonPer-URL records or per-sitemap CSV

Behavior

  • Sitemap index recursion is one level deep (index → child sitemaps; child indexes are not followed again).
  • Supports gzip (Content-Encoding or .gz extension) and follows up to 5 HTTP redirects.
  • Missing lastmod / changefreq / priority are returned as null.
  • Per-source failures are logged; other sitemaps continue. In csv mode a failed source returns { sitemapUrl, error }.
  • maxUrls caps the total emitted across all sitemaps; child sitemaps stop being fetched once the cap is reached.

Local run

npm install
mkdir -p storage/key_value_stores/default
echo '{"sitemapUrls":["https://example.com/sitemap.xml"],"maxUrls":50}' > storage/key_value_stores/default/INPUT.json
node src/main.js
# results: storage/datasets/default/*.json

Verified locally with a fixture sitemap index (2 child sitemaps, 5 URLs) in both json and csv modes.

Limitations

  • Not a crawler: it only reads sitemaps, it does not fetch the listed pages.
  • Text-layer only: no rendering, no JS, no link discovery outside sitemaps.
  • Very large sitemaps are capped by maxUrls and 50 child sitemaps per index.
  • Compressed sitemaps inside a .tar.gz bundle are not supported (plain .xml.gz is).

Platform notes

  • .actor/actor.json: actorSpecification: 1, version: "0.0", input/readme copies inside .actor/.
  • package.json main/start = src/main.js; only dependency is apify.
  • Dockerfile: node:22-slim + npm ci --omit=dev + CMD node src/main.js.
  • When creating the Actor, pass source file contents as plain text, not base64.