Defuddle for .NET

Keep the article.
Drop the clutter.

Defuddle finds the main content of a web page, removes sidebars, headers, footers, and other non-essential elements, and returns clean HTML or Markdown with the page's metadata.

Unofficial community port of defuddle by Steph Ango (@kepano). Not an official defuddle product.

dotnet add package Defuddle

It targets net10.0 and netstandard2.0. Defuddle on NuGet.

C#MarkdownExample source
using Defuddle;

var result = DefuddleParser.ParseHtml(
    html,
    new DefuddleOptions
    {
        Url = "https://example.com/blog/tide-pools",
        Markdown = true,
    });

Console.WriteLine(result.Content);
Markdown = true returns Markdown in result.Content

Package

Defuddle

A library and a CLI tool

Targets

net10.0

and netstandard2.0

Upstream

0.19.13

Ported from defuddle

License

MIT

Same as upstream

Why Defuddle

The defuddle extraction pipeline, in the C# you already write.

  • Main content

    DefuddleParser picks the element that holds the content and removes the clutter around it. Set ContentSelector when you already know where it is.

    Options
  • Markdown output

    Set Markdown to get Markdown in Content, or SeparateMarkdown to keep the HTML and fill ContentMarkdown.

    Markdown
  • Metadata

    Title, author, description, publication date, site, images, schema.org data, and meta tags come back on the same response.

    Response
  • Site extractors

    Pages from sites such as GitHub, Reddit, Hacker News, YouTube, Wikipedia, and X have their own extractors, picked by URL.

    Extractors

Get started

From a page of HTML to Markdown, in three steps.

Install the package, parse a page, then read the content and metadata. Each step links to the page that has the rest.

Read the quickstart
  1. Install the package

    Add Defuddle to a project that targets net10.0 or netstandard2.0.

    dotnet add package Defuddle
    Quickstart
  2. Parse a page

    Pass HTML to ParseHtml, or an AngleSharp document to DefuddleParser. Give the page URL so links resolve and site extractors can run.

    var result = DefuddleParser.ParseHtml(html);
    Parse HTML
  3. Or use the terminal

    The Defuddle.Cli tool parses a file, a URL, or standard input.

    dotnet tool install -g Defuddle.Cli
    defuddle parse page.html --markdown
    CLI