Show HN: JustHTML – A pure Python HTML5 parser that just works(github.com)
github.com
Show HN: JustHTML – A pure Python HTML5 parser that just works
https://github.com/EmilStenstrom/justhtml
2 コメント
Super work. (Also: your RSS feed is throwing some errors)
Thanks, just fixed it!
I wanted a Python HTML parser that was both correct and easy to install. The C-based ones (lxml, selectolax) are fast but not HTML5 compliant. The pure Python ones (html.parser, BeautifulSoup's default) are easy to install but choke on real-world HTML. html5lib is 80% correct but painfully slow.
So I wrote JustHTML. It's:
• 100% HTML5 compliant – passes all 8,500+ html5lib tests. If a browser can parse it, JustHTML can.
• Pure Python, zero dependencies – pip install and go. Works on PyPy, Pyodide, anywhere.
• Fast enough – ~0.1s to parse Wikipedia's homepage. Not C-fast, but 50% faster than html5lib.
• Simple API – doc.query("div.foo > p") with CSS selectors. One method to learn.
Example:
I've fuzz-tested it with 3 million malformed documents.
Would love feedback, especially on the API design.