Sitemap::Fetcher
NAME
Sitemap::Fetcher - Fetch sitemaps from remote servers
SUBS
fetch(Str $url, Bool :$ssl-verify, Bool :$verbose, Str :$user-agent --> Str)
Fetch a sitemap from a URL and return its content. Handles automatic gzip decompression.
get-decompressed-content(Str $url, $response, Bool :$verbose --> Str)
Decompress content from an HTTP response, handling gzip encoding. Checks Content-Encoding
header and gzip magic bytes.
output-filename(Str $input, Str :$format, Str :$output-override --> Str)
Generate output filename from URL, adding path context (e.g., sitemap-blog.xml
for https://example.com/blog/sitemap.xml).
:$format- output extension/format (e.g.,xml,txt):$output-override- explicit output filename; used as-is when non-empty
fetch-recursive(Str $sitemap-url, Str :$format = 'xml', Str :$output = '', Bool :$force, Bool :$ssl-verify, Bool :$verbose, Int :$concurrency, Bool :$follow-foreign-children, Int :$max-children)
Fetch a sitemap index and all child sitemaps. Creates a descriptive directory with path-aware filenames.
:$format- output format (default:xml):$output- output filename (default: derived from the URL):$force- delete existing output directory first:$concurrency- bounds the parallel child fetches (default: 10):$follow-foreign-children- (default False) allows child sitemaps on other hosts; leaving it off enforces the same-origin guard (SSRF protection):$max-children- caps how many child sitemaps are downloaded (default: 1000)
format-output(@items, Str $fmt, Str $title, Str $link, :$pretty --> Str)
Format sitemap items into the specified format (html, txt, rss, atom, mrss).
Note: xml is not a valid $fmt here ā for XML output write the parsed
items via Sitemap::Builder instead.
discover-sitemap(Str $domain, Bool :$ssl-verify, Bool :$verbose --> Str)
Discover a sitemap URL from a domain. Checks robots.txt first, then falls back to
/sitemap.xml. Returns the URL or dies if not found.