Install the CLI:
go install github.com/dotcommander/defuddle/cmd/defuddle@latestOr add the library to your project:
go get github.com/dotcommander/defuddleExtract the main content from any web page:
defuddle parse https://example.com/articleConvert to markdown:
defuddle parse https://example.com/article --markdownGet structured JSON output with metadata:
defuddle parse https://example.com/article --jsonpackage main
import (
"context"
"fmt"
"log"
"github.com/dotcommander/defuddle"
)
func main() {
result, err := defuddle.ParseFromURL(
context.Background(),
"https://example.com/article",
nil,
)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Title)
fmt.Println(result.Content)
}Every parse returns a Result containing:
- Content -- clean HTML with ads, navigation, and clutter removed
- Title, Author, Published -- extracted from meta tags, Schema.org, and page structure
- Domain, Favicon, Image -- site identity and social sharing image
- WordCount -- CJK-aware word count of the extracted content
- SchemaOrgData -- parsed JSON-LD structured data, when present
- ParseTime -- extraction time in milliseconds
Defuddle scores every block element in the page by word count, structure, and proximity to headings. The highest-scoring content block becomes your extracted content. Ads, sidebars, navigation, and boilerplate are stripped away automatically.
For major platforms -- YouTube, Reddit, GitHub, ChatGPT, Claude, and others -- Defuddle uses purpose-built extractors that understand each site's DOM structure. When a URL matches a known platform, the site extractor runs instead of the general-purpose algorithm.
List all supported extractors:
defuddle extractorsCheck which extractor matches a URL:
defuddle extractors --match https://www.youtube.com/watch?v=dQw4w9WgXcQRequest markdown output to get clean, readable text suitable for LLMs, note-taking, or further processing:
result, err := defuddle.ParseFromURL(ctx, url, &defuddle.Options{
Markdown: true,
})
fmt.Println(*result.ContentMarkdown)defuddle parse https://example.com --markdownParse multiple URLs concurrently:
echo -e "https://example.com/a\nhttps://example.com/b" | defuddle batchresults := defuddle.ParseFromURLs(ctx, urls, &defuddle.Options{
MaxConcurrency: 10,
})- CLI Reference -- all commands, flags, and usage patterns
- Library Usage -- Go API with examples
- Extractors -- supported platforms and custom extraction
- Configuration -- all options, defaults, and tuning