CLI
The Defuddle.Cli package is a .NET tool with the defuddle command. It ports the parse command of upstream’s CLI, with the same options, output formats, error messages, and exit codes.
Install
Section titled “Install”The tool needs the .NET 10 runtime.
dotnet tool install -g Defuddle.CliThe source is a file path, a URL, or HTML on standard input. A source that starts with http:// or https:// is a URL.
# Parse a local HTML filedefuddle parse page.html
# Parse a URLdefuddle parse https://example.com/article
# Parse HTML from stdin as Markdowncurl -L https://stephango.com/saw | defuddle parse --markdown
# Output as JSON with metadatadefuddle parse page.html --json
# Prepend YAML frontmatter to the Markdowndefuddle parse page.html --markdown --frontmatter
# Extract a specific propertydefuddle parse page.html --property title
# Save the output to a filedefuddle parse page.html --markdown --output article.md
# Use a custom User-Agent (helps with sites that return 403 to the default one)defuddle parse https://example.com/article --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"When there is no source argument, defuddle parse reads HTML from standard input. You can also pass -.
Options
Section titled “Options”| Option | Alias | Description |
|---|---|---|
--output <file> |
-o |
Write the output to a file instead of standard output. |
--markdown |
-m |
Convert the content to Markdown. |
--md |
Alias for --markdown. |
|
--json |
-j |
Output JSON with metadata and content. |
--frontmatter |
-f |
Prepend YAML frontmatter, such as title, author, and source, to the output. |
--property <name> |
-p |
Print one property, such as title, description, or domain. |
--debug |
Enable debug mode. | |
--lang <code> |
-l |
Preferred language (BCP 47, such as en, fr, or ja). |
--user-agent <string> |
-u |
Custom User-Agent header for HTTP requests. |
defuddle --help, defuddle parse --help, and defuddle --version (-V) print the help and the version.
Output
Section titled “Output”By default the output is the cleaned HTML of the main content, or Markdown with --markdown.
--json prints an object with content, title, description, domain, favicon, image, language, metaTags, parseTime, published, author, site, schemaOrgData, and wordCount. It adds contentMarkdown when --markdown is not set, and variables when a site extractor provides them. With --markdown, content holds the Markdown.
--property takes the same names, and extractorType. It takes precedence over --json. --frontmatter has no effect with --json or --property.
Fetching pages
Section titled “Fetching pages”For a URL source, the tool downloads the page itself:
- The request has a 10 second timeout. The page must be
text/htmlorapplication/xhtml+xml, and at most 5 MB. - The character set comes from the
Content-Typeheader, then from themetatags, and then from the bytes. - The default
User-AgentisMozilla/5.0 (compatible; Defuddle/1.0; +https://defuddle.md). Forgithub.comit ends inbot. - When the page has no content, the tool downloads it again with the bot
User-Agent, unless you set--user-agent. --langsets theAccept-Languageheader.
Proxies
Section titled “Proxies”The tool reads HTTPS_PROXY (for https URLs), HTTP_PROXY, and ALL_PROXY, also in lower case, in that order. NO_PROXY is a comma-separated list of hosts that skip the proxy. A name also matches its subdomains, and * matches every host. A proxy URL without a port, or with the default port of its scheme, uses port 8080. The system proxy settings are not read.
These variables apply to the download of the page. Requests that site extractors make use the default HttpClient of .NET.
Differences from the Node CLI
Section titled “Differences from the Node CLI”The help layout, the commander error messages and the file error messages match upstream’s defuddle 0.19.13 CLI; they were compared side by side with commander 12.1. Two differences are on purpose:
--versionprints the version of this .NET package, not the upstream version.- Node’s
fetchsendsAccept-Language: *when--langis not set. The .NETHttpClientsends noAccept-Languageheader.
Errors and exit codes
Section titled “Errors and exit codes”The exit code is 0 on success and 1 on any error. Errors are written to standard error:
Error: No content could be extracted from stdinError: Failed to fetch: 404 Not FoundError: Not an HTML page (content-type: application/pdf)Error: Page too large (7MB, max 5MB)Error: Timed out fetching page after 10sError: Property "nope" not found in responseMIT · Copyright 2025 Steph Ango (@kepano) · unofficial community port of defuddle