Search code examples
crystal-lang

Are there any HTML parsing libraries?


Hey i'm looking for some html parsing libraries in crystal. Something similar to nokogiri for ruby. I have a working regular expression but would prefer a html parsing library because html + regex == bad. Thanks.


Solution

  • The standard way in the Crystal standard library is XML.parse_html. This will give you an XML::Node which has a pretty nice interface.

    If you need to use CSS selectors, you can use Crystagiri, although otherwise I don't see much benefit over the stdlib's offering.