|
This post originated from an RSS feed registered with Ruby Buzz
by Red Handed.
|
Original Post: Hpricot 0.1
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
|
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded
|
|
gem install hpricot --source code.whytheluckystiff.net
Hpricot is a nice, loose HTML parser for Ruby, written in C. I stole a bunch of code and ideas from HTree, Prototype and JQuery. The gem requires a compiler. It’s 0.1, so it’s kinda wobbly, but hey.
require 'hpricot'
doc = Hpricot.parse("index.html")
(doc/:p/:a).each do |links|
p link.attributes
end
Read: Hpricot 0.1