Skip to content

Options

DefuddleOptions maps to the options object of upstream defuddle. Every property is optional.

Property Type Default Description
Debug bool false Return debug information in the response. See Debugging.
Url string? URL of the page being parsed.
Markdown bool false Convert Content to Markdown.
SeparateMarkdown bool false Keep Content as HTML and return Markdown in ContentMarkdown.
RemoveExactSelectors bool true Remove elements that match exact selectors, such as ads and social buttons.
RemovePartialSelectors bool true Remove elements whose attributes contain a clutter pattern.
RemoveHiddenElements bool true Remove elements hidden with CSS, such as display:none.
RemoveLowScoring bool true Remove non-content blocks by scoring, such as navigation and link lists.
RemoveSmallImages bool true Remove small images, such as icons and tracking pixels.
RemoveImages bool false Remove images.
RemoveContentPatterns bool true Remove content by pattern, such as read time, boilerplate, and article cards.
Standardize bool true Standardize the HTML of footnotes, headings, code blocks, and more.
ContentSelector string? CSS selector of the main content element. It bypasses auto-detection.
UseAsync bool true Allow async extractors to fetch from the network.
Language string? Preferred language (BCP 47, such as en or fr). Sets Accept-Language and selects the transcript language.
IncludeReplies IncludeReplies Extractors Which replies to include.
Profile bool false Return the time spent in each step in Profile on the response.
HttpClient HttpClient? Used for every request that extractors make. It stands for upstream’s fetch option. Without it, they share one client that keeps no cookies.

If the selector matches no element, Defuddle falls back to auto-detection.

var selected = DefuddleParser.ParseHtml(html, new DefuddleOptions { ContentSelector = "article" });

snippet source | anchor

var unfiltered = DefuddleParser.ParseHtml(
html,
new DefuddleOptions
{
RemoveLowScoring = false, // keep blocks that scoring would remove
RemoveHiddenElements = false, // keep hidden elements, such as CSS sidenotes
RemoveSmallImages = false,
}
);

snippet source | anchor

IncludeReplies.Extractors includes replies from site extractors only. IncludeReplies.All includes all replies, including page comment sections. IncludeReplies.None excludes them.

var result = DefuddleParser.ParseHtml(
html,
new DefuddleOptions
{
Url = "https://news.ycombinator.com/item?id=1",
IncludeReplies = IncludeReplies.None,
}
);

snippet source | anchor

When you call ParseAsync or ParseHtmlAsync, some extractors fetch data from the site or from a third-party API. Pass an HttpClient to control timeouts, proxies, and headers. Set UseAsync to false to stop those requests.

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
var result = await DefuddleParser.ParseHtmlAsync(
html,
new DefuddleOptions
{
Url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
Language = "en",
HttpClient = http,
},
cancellationToken
);

snippet source | anchor

// No extractor requests: only the HTML you pass is read.
var result = await DefuddleParser.ParseHtmlAsync(
html,
new DefuddleOptions { Url = "https://x.com/example/status/1", UseAsync = false }
);

snippet source | anchor

MIT · Copyright 2025 Steph Ango (@kepano) · unofficial community port of defuddle