NAME

WWW::Crawl4AI::Request - builds Crawl4AI /crawl and /md request payloads

VERSION

version 0.001

SYNOPSIS

my $req = WWW::Crawl4AI::Request->new(
  urls           => 'https://example.com',
  browser_params => { enable_stealth => JSON::MaybeXS::true() },
  crawler_params => { wait_until => 'networkidle' },
);

my $payload = $req->to_crawl_payload;
# { urls => [...], browser_config => { type => 'BrowserConfig', params => {...} },
#   crawler_config => { type => 'CrawlerRunConfig', params => {...} } }

DESCRIPTION

A small value object that turns crawl options into the nested browser_config/crawler_config shape the Crawl4AI Docker REST API expects. Each WWW::Crawl4AI::Strategy produces one of these with its own browser/crawler parameters; WWW::Crawl4AI::Client serializes it.

Sensible defaults are merged in unless overridden: headless for the browser, stream => false and cache_mode => 'bypass' for the crawler.

urls

Required. A single URL string or an arrayref of URLs (coerced to an arrayref).

browser_params

Hashref of BrowserConfig parameters (e.g. enable_stealth, browser_mode, cdp_url, user_agent_mode). Merged over the defaults.

crawler_params

Hashref of CrawlerRunConfig parameters (e.g. wait_until, cache_mode). Merged over the defaults.

filter

Optional /md filter strategy: fit, raw, bm25 or llm.

query

Optional query string for bm25/llm /md filtering.

cache

Optional /md cache flag.

JSON_true

JSON_false

Return the shared JSON::MaybeXS boolean singletons, so payload booleans serialize as JSON true/false rather than 1/0.

to_crawl_payload

Returns the hashref body for POST /crawl (and POST /crawl/job).

to_md_payload

Returns the hashref body for POST /md (single URL).

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-crawl4ai/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.