DefuddleParser
Namespace: Defuddle
public sealed class DefuddleParserExtracts the main content and the metadata of a page. Maps to the Defuddle class of defuddle.ts.
Inheritance: object
Parsing never changes the document it was given. An instance is not thread safe.
Constructors
Section titled “Constructors”DefuddleParser(IDocument, DefuddleOptions?)
Section titled “DefuddleParser(IDocument, DefuddleOptions?)”public DefuddleParser(IDocument document, DefuddleOptions? options = null)Creates a parser of a document.
Parameters
| Name | Type | Description |
|---|---|---|
document |
IDocument |
The document to parse. It is not modified. |
options |
DefuddleOptions | Options of the parse. |
Methods
Section titled “Methods”Parse()
Section titled “Parse()”public DefuddleResponse Parse()Parses the document and extracts its main content. Asynchronous extractors do not run, and the content is not converted to Markdown.
Returns: DefuddleResponse — The extracted content and metadata.
ParseAsync(CancellationToken)
Section titled “ParseAsync(CancellationToken)”public Task<DefuddleResponse> ParseAsync(CancellationToken cancellationToken = default)Parses the document, running the asynchronous extractors: those that are preferred over the page content (such as
YouTube transcripts) first, and the others when the page has no content. Applies the Markdown options. Maps to the
Node entry point and parseAsync.
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken |
CancellationToken | Cancels the requests of the extractors. |
Returns: Task<DefuddleResponse> — The extracted content and metadata.
ParseHtml(string, DefuddleOptions?)
Section titled “ParseHtml(string, DefuddleOptions?)”public static DefuddleResponse ParseHtml(string html, DefuddleOptions? options = null)Parses an HTML string and extracts its main content, applying the Markdown options.
Parameters
| Name | Type | Description |
|---|---|---|
html |
string | The HTML of the page. |
options |
DefuddleOptions | Options of the parse. |
Returns: DefuddleResponse — The extracted content and metadata.
ParseHtmlAsync(string, DefuddleOptions?, CancellationToken)
Section titled “ParseHtmlAsync(string, DefuddleOptions?, CancellationToken)”public static Task<DefuddleResponse> ParseHtmlAsync(string html, DefuddleOptions? options = null, CancellationToken cancellationToken = default)Parses an HTML string and extracts its main content, running the asynchronous extractors and applying the Markdown options.
Parameters
| Name | Type | Description |
|---|---|---|
html |
string | The HTML of the page. |
options |
DefuddleOptions | Options of the parse. |
cancellationToken |
CancellationToken | Cancels the requests of the extractors. |
Returns: Task<DefuddleResponse> — The extracted content and metadata.
MIT · Copyright 2025 Steph Ango (@kepano) · unofficial community port of defuddle