crawl4ai
crawl4ai copied to clipboard
docs(cli): clarify `--output json` behavior when no extraction strategy is provided
Problem
Running crawl4ai CLI with -o json without specifying an extraction strategy (--extractor / JsonCssExtractionStrategy) yields raw unparsed HTML or empty JSON payloads depending on the depth level.
Suggested Improvement
Add a note in CLI docs or command help indicating that structured -o json export expects an extraction schema/strategy to be configured, otherwise defaulting to markdown/HTML output with a helpful warning.
Thanks for reporting this @ege-arhan
There are 3 PRs targeting this issue, One targets fixes the help test, one fixes the documentation and one fixes the code:
- #2362 (code fix):
-o jsonwithout an extraction strategy (-jor-e) now stops before the crawl starts, with a clear error:
It also removes the duplicate JSON print, fixes the brokenError: -o json needs an extraction strategy (-j or -e). Use -o all for the full crawl result.-o jsonexample incrwl examples, and removes thejsonchoice from the profile crawl menu. - #2335 (help text): clarifies the
--outputhelp in the CLI. - #2348 (docs): updates the CLI docs and replaces the misleading
-o jsonexamples.
All three apply cleanly and can be merged together once the review on the 2 PRs have been addressed.