Ruby nokigiri: Difference between revisions

From wikinotes
No edit summary
 
 
Line 13: Line 13:
require 'nokigiri'
require 'nokigiri'


html = '<html><title>foo</title></html>
html = '<html><title>foo</title></html>'
doc = Nokigiri::HTML.parse(html)
doc = Nokigiri::HTML.parse(html)
doc.css("title")  # css-select elements
</source>
</source>

Latest revision as of 20:01, 14 September 2021

nokigiri is an html parser

Documentation

website https://nokogiri.org/
require 'nokigiri'

html = '<html><title>foo</title></html>'
doc = Nokigiri::HTML.parse(html)
doc.css("title")  # css-select elements