A high-performance, Nokogiri-compatible HTML5 parser for Ruby with CSS selector and XPath support.
Nokolexbor is a high-performance HTML5 parser for Ruby that serves as a drop-in replacement for Nokogiri. It uses the Lexbor engine to parse HTML and execute CSS selectors with dramatically improved speed, while also supporting XPath queries. It solves the performance bottlenecks often encountered in web scraping and HTML processing tasks.
Ruby developers who need fast HTML parsing for web scraping, data extraction, or DOM manipulation, especially those currently using Nokogiri and seeking performance improvements.
Developers choose Nokolexbor for its significant performance gains—up to 1352x faster CSS selectors—while maintaining full API compatibility with Nokogiri, allowing easy integration into existing projects without code changes.
High-performance HTML5 parser for Ruby based on Lexbor, with support for both CSS selectors and XPath.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show CSS selectors are up to 1352x faster than Nokogiri, making data extraction from large HTML documents extremely efficient for web scraping.
API is designed to be 1:1 compatible with Nokogiri, allowing existing projects to switch with minimal code changes, as emphasized in the README.
Supports both CSS selectors via Lexbor and XPath via libxml2, providing flexibility for different parsing needs without sacrificing compatibility.
Allows direct selection of text nodes using the ::text pseudo-element in CSS, simplifying content extraction compared to Nokogiri's workarounds.
Some CSS selectors, like :nth-of-type with :not filters, behave differently from Nokogiri and browsers, requiring adjustments as noted in the README.
To use mixed CSS/XPath syntax (e.g., div/text()), the nokogiri_css method requires Nokogiri to be installed, adding complexity and an extra dependency.
Pre-compiled gems only cover common architectures like x86_64 and arm64; others need CMake and manual compilation, which can be a barrier for some environments.
XPath query performance is identical to Nokogiri, so projects relying heavily on XPath won't see speed improvements despite the switch.
Nokolexbor is an open-source alternative to the following products: