I've tried to work with the various forks of some ancient codebase that ported readability to Python. The lack of tests, unused regex's, and commented out sections of code in other Python ports just drove me nuts.
I put forth an effort to bring in several of the better forks into one code base, but they've diverged so much that I just can't work with it.
So what's any sane person to do? Re-port it with my own repo, add some tests, infrastructure, and try to make this port better. OSS FTW (and yea, NIH FML, but oh well I did try)
This is a pretty straight port of the JS here:
This does depend on lxml so you'll need some C headers in order to install things from pip so that it can compile.
$ [sudo] apt-get install libxml2-dev libxslt-dev $ [sudo] pip install git+git://github.com/bookieio/breadability.git
$ pytest tests
$ breadability http://wiki.python.org/moin/BeginnersGuide
from __future__ import print_function from breadability.readable import Article if __name__ == "__main__": document = Article(html_as_text, url=source_url) print(document.readable)
Yep, I've got some catching up to do. I don't do pagination, I've got a lot of custom tweaks I need to get going, there are some articles that fail to parse. I also have more tests to write on a lot of the cleaning helpers, but hopefully things are setup in a way that those can/will be added.
Fortunately, I need this library for my tools:
so I really need this to be an active and improving project.
Off the top of my heads TODO list: