| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Python implementation of Defuddle — extract and clean web content as Markdown.
Pass any HTML string (or a URL via the CLI) and get back clean, readable Markdown with rich metadata extracted from the page.
pip install pydefuddleOr with uv:
uv add pydefuddlefrom pydefuddle import defuddle
with open("page.html") as f:
html = f.read()
result = defuddle(html, url="https://example.com/article")
print(result.title) # "How Python Works"
print(result.author) # "Jane Smith"
print(result.published) # "2024-03-15"
print(result.markdown) # Clean Markdown string| Option | Type | Default | Description |
|---|---|---|---|
| markdown | bool | True | Convert to Markdown (set False for clean HTML only) |
| remove_low_scoring | bool | True | Remove low-signal blocks via content scoring |
| remove_small_images | bool | True | Remove tracking pixels and tiny images |
| remove_hidden_elements | bool | True | Remove elements hidden with CSS |
| content_selector | str | None | Override content discovery with a CSS selector |
| debug | bool | False | Include removal debug info in result |
from pydefuddle import Defuddle, DefuddleOptions
opts = DefuddleOptions(markdown=True, debug=True, content_selector="article")
result = Defuddle(html, url="https://example.com", options=opts).parse()
for removal in result.debug:
print(removal.name, removal.count, removal.selector)result.content # str — clean HTML
result.markdown # str — Markdown (empty if markdown=False)
result.title # str
result.author # str
result.published # str — ISO date / datetime string
result.description # str
result.image # str — URL
result.favicon # str — URL
result.domain # str
result.language # str — BCP 47 (e.g. "en", "fr")
result.site_title # str
result.word_count # int
result.parse_time # float — milliseconds
result.debug # list[DebugRemoval] | Nonepydefuddle fetch https://example.com/some-articleThe Markdown is copied to your clipboard automatically.
pydefuddle fetch <url> --no-clipboard # print to stdout instead
pydefuddle fetch <url> --output out.md # write to file
pydefuddle fetch <url> --preview # render in terminal with rich
pydefuddle fetch <url> --debug # show removal steps
pydefuddle fetch <url> --no-markdown # return clean HTML insteadpydefuddle parse page.html --no-clipboard
pydefuddle parse page.html --output article.mdgit clone https://github.com/phalt/pydefuddle
cd pydefuddle
make install # install deps with uv
make test # run tests with coverage
make format # ruff format + lintBased on Defuddle by Steph Ango (@kepano), which is the JavaScript original powering Obsidian Web Clipper.
MIT
| Back | FazBrowse Home | New Git URL |