Get the main content of any page as clean HTML or Markdown, in C#.
It is an unofficial community port of defuddle by Steph Ango (@kepano). It ports upstream 0.19.13. Defuddle finds the main content of a web page and removes clutter such as comments, sidebars, headers, and footers.
To learn more, read the documentation.
Preview the docs site locally:
cd docs-site && npm ci && npm run api && npm run devOpen http://localhost:4321/defuddle-dotnet/ . That URL is the marketing page. Documentation starts at http://localhost:4321/defuddle-dotnet/docs/ . Article sources stay in docs/articles/. See docs-site/README.md.
The package targets net10.0 and netstandard2.0. Run dotnet add package Defuddle.
var result = DefuddleParser.ParseHtml(
html,
new DefuddleOptions { Url = "https://example.com/blog/tide-pools" }
);
Console.WriteLine(result.Content);Console.WriteLine(result.Title);
Console.WriteLine(result.Author);
Console.WriteLine(result.Description);
Console.WriteLine(result.Domain);
Console.WriteLine(result.Language);
Console.WriteLine(result.WordCount);See Response and metadata for every property.
var result = DefuddleParser.ParseHtml(
html,
new DefuddleOptions { Url = "https://example.com/blog/tide-pools", Markdown = true }
);
Console.WriteLine(result.Content); // Markdownvar context = BrowsingContext.New(Configuration.Default);
var document = await context.OpenAsync(request =>
request.Content(html).Address("https://example.com/blog/tide-pools")
);
var parser = new DefuddleParser(
document,
new DefuddleOptions { Url = "https://example.com/blog/tide-pools" }
);
var result = parser.Parse();
Console.WriteLine(result.Title);
Console.WriteLine(result.Content);using var http = new HttpClient();
var html = await http.GetStringAsync(url);
var result = await DefuddleParser.ParseHtmlAsync(
html,
new DefuddleOptions
{
Url = url,
Markdown = true,
HttpClient = http,
}
);
Console.WriteLine(result.Title);
Console.WriteLine(result.Content);var result = DefuddleParser.ParseHtml(html, new DefuddleOptions { Debug = true });
if (result.Debug is { } debug)
{
Console.WriteLine(debug.ContentSelector);
foreach (var removal in debug.Removals)
{
Console.WriteLine($"{removal.Step}: {removal.Reason} {removal.Selector}");
}
}Pages from sites such as GitHub, Reddit, Hacker News, YouTube, Wikipedia, and X have their own extractors, picked from the URL. See Site extractors.
dotnet tool install -g Defuddle.Cli
defuddle parse https://example.com/article --markdown
curl -L https://stephango.com/saw | defuddle parse --jsonThe tool needs the .NET 10 runtime. It parses a file, a URL, or HTML on standard input. See CLI for every option.
Migrating from upstream maps the JavaScript names to the C# ones.
See CONTRIBUTING.md.
MIT. Defuddle is Copyright (c) 2025 Steph Ango (@kepano). The .NET port is Copyright (c) 2026 Darío Kondratiuk. See LICENSE and NOTICE.