Show HN: Defuddle, an HTML-to-Markdown alternative to Readability (github.com)
Defuddle is an open-source JS library I built to parse and extract the main content and metadata from web pages. It can also return the content as Markdown.
I built Defuddle while working on Obsidian Web Clipper[1] (also MIT-licensed) because Mozilla's Readability[2] appears to be mostly abandoned, and didn't work well for many sites.
It's still very much a work in progress, but I thought I'd share it today, in light of the announcement that Mozilla is shutting down Pocket. This library could be helpful to anyone building a read-it-later app.
Defuddle is also available as a CLI:
https://github.com/kepano/defuddle-cli
76 comments
[ 3.0 ms ] story [ 123 ms ] threadIn the end I found the python trifatura library to extract the best quality content with accurate meta data.
You might want to compare your implementation to trifatura to see if there is room for improvement.
for the curious: Trafilatura means "extrusion" in Italian.
| This method creates a porous surface that distinguishes pasta trafilata for its extraordinary way of holding the sauce. search maccheroni trafilati vs maccheroni lisci :)
(btw I think you meant trafilatura not trifatura)
If you're using Go, I maintain Go ports of Readability[0] and Trafilatura[1]. They're actively maintained, and for Trafilatura, the extraction performance is comparable to the Python version.
[0]: https://github.com/go-shiori/go-readability
[1]: https://github.com/markusmobius/go-trafilatura
Not that I didn't already implement a read-it-later solution with Obsidian+Dataview, but this definitely makes things simpler!
Note that I'm using a preview (catalyst) version, it will reach stable soon. I'm assuming kepano will submit it here then.
i started working on my own alternative but life (and web clipper) derailed the work.
it's funny. somehow slurp keeps gaining new users even though web clipper exists. so i might have to refactor it to use your library sometime soon even though I don't use slurp myself anymore.
Build the framework for tests and then require anyone who wants to help build the product to write tests with their PRs.
You can't just push some code out there and expect people to "feel free to help", it doesn't happen, and is quite a turnoff.
To the downvoters, this is what I see as valid feedback to a rather flippant response.
I've got a project that has been going for 6 years now and attracted 500 stars and gets 49k downloads a month. It works because it has comprehensive unit tests and people can rely on it. When I was just starting out on that project, I didn't tell people to feel free to help. I put the effort in. It is important to lay the groundwork beyond just writing the utility.
I made a lot of mistakes along the way and one of them was being flippant on my responses to people like that. Just sharing my insights.
1 such bug, find a foreign language with commas in between numbers instead of periods, like Dutch(I think), and a lot of prices on the page. It’ll think all the numbers are relevant text.
And of course I tried to open a pr and get it merged, but they require tests, and of course the tests don’t work on the page Im testing. It’s just very snafu imho
Clearly the comma thing is a bug, it's the lack of wanting to fix it actually that is a bit disheartening, and why I think it is a deadish repo
Even if you are not a obsidian user, the markdown extraction quality is the most reliable Ive seen.
You just get a completely white page (on the iPhone reader). Usually it’s a news website.
Is this the website intentionally obscuring the content to ensure they can serve their ads? If so how do they go about it?
On some websites, those are just modals that obscure the content, something that reader mode can usually deal with just fine, but on others, they're implemented as redirects or rendered server-side.
If reader mode doesn't work, dismiss those first and try again.
- Providing "reader mode" for your visitors
- Using it in a browser extension to add reader mode
- Scrapping
- Plugging it into a [reverse] proxy that automatically removes unnecessary bloat from pages, for e.g. easier access on retro hardware <https://web.archive.org/web/20240621144514/https://humungus....> (archive.org link, because the website goes down regularly)
And with Pocket going away I might have to add save it later to it...
Thank you for picking up this work :-)