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 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.

Sitemap v0.0.3

Sitemap generator for Raku

Authors

  • Sasha Abbott

License

CC0-1.0

Dependencies

Cro::HTTP:auth<zef:cro>:api<0>URI:auth<zef:raku-community-modules>LibXML:auth<zef:dwarring>LibXML::Writer:auth<zef:dwarring>Compress::ZlibJSON::Fast:auth<zef:timo>YAMLish:auth<zef:leont>DateTime::Format:auth<zef:raku-community-modules>Syndicate:auth<zef:sasha>

Test Dependencies

Provides

  • Sitemap
  • Sitemap::Builder
  • Sitemap::Config
  • Sitemap::Crawler
  • Sitemap::DirScanner
  • Sitemap::Extraction
  • Sitemap::Fetcher
  • Sitemap::Format::Atom
  • Sitemap::Format::FeedBuilder
  • Sitemap::Format::HTML
  • Sitemap::Format::MRSS
  • Sitemap::Format::RSS
  • Sitemap::Format::TXT
  • Sitemap::Grammar::LinkExtract
  • Sitemap::Grammar::RobotsTxt
  • Sitemap::Grammar::SitemapSniff
  • Sitemap::InputParser
  • Sitemap::Item
  • Sitemap::JsonLd
  • Sitemap::Parser
  • Sitemap::SiteTree
  • Sitemap::Subscribable

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.