Nokogiri is a Ruby gem that allows you to easily search and parse HTML pages. It works by getting a web page and then allowing you to search it for HTML elements by the type of element, class, id, or any other attribute.
To start, you need to install the gem with
gem install Nokogiri, and require both 'nokogiri' and 'open-uri' in your file. Then you can get access to the page with
page = Nokogiri::HTML(open("http://example.com").
You can use the
#css method on this
page to search the HTML elements (e.g.
page.css(".example-class"). This will return a Nokogiri node class, which comes with more methods that can return data (e.g.
#text) or find related elements (e.g.