Way to use hpricot to search using a range of elements?

Hello!

I need to write a scraper using Hpricot, and unfortunately the forum I’m
trying to scrape is…odd. So this is what it looks like:


John D.
Just a quick simple question by John D. on Jun 16, 2011 at 6:41:11 pm

I need to write a scraper using Hpricot, and unfortunately the site I'm trying to scrape is...odd.

Jane Smith
Re: Just a quick simple question
by John D. on Jun 16, 2011 at 6:41:11 pm

Use the search! Use Nokogiri! You suck!

John D.
Re: Just a quick simple question
by John D. on Jun 16, 2011 at 6:41:11 pm

I Googled till my head exploded! I HAVE to use Hpricot! And finally..pic?

So I need grab each “a[@name]” and “table[@class]” pair. So is it
possible to do a search using a range of elements…something like

doc.search(“a[@name]…table[@class]”).each do |post| puts “HELP ME
PLEASE!” end

?

Grab the tag, then use the tag’s next_sibling() method to get
the

.

7stud – wrote in post #1005827:

Grab the tag, then use the tag’s next_sibling() method to get
the

.

Oy…I completely started over because I found another way to access
the page with somewhat better HTML. But regardless, thank you! I’ll
use it for the next project.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs