Hi and thanks for the help, I am new to ruby and I am trying to get some
data from a website using the Hpricot library.I am doing this: links =
Hpricot(index_page).search(“td.det_movie”).collect{ |link| link[“href”]
} to get an array of data but the thing is that right now I need some
text out of tags and the previous version only works with tags.
This is the code that I am reading, and I need the part “The Day the
Earth Stood Still”
The Day the Earth
Stood Still
thanks for any help
require ‘hpricot’
doc=Hpricot(‘The Day
the Earth Stood Still’)
doc.search("//a").each do |link|
 puts “#{link[:href]}”
 puts “#{link.inner_text}”
end
detalle_movie.php?mv_id=618
The Day the Earth Stood Still
Hi John,
I haven’t used Hpricot much, but you may want to dig through the API
documentation a bit more. Also, why’s website has a few good tutorials
on how to grab data in different ways.
I believe the method you want to be looking at is “innerHTML” (or some
such name).
HTH
John Zoldiark wrote:
Hi and thanks for the help, I am new to ruby and I am trying to get some
data from a website using the Hpricot library.I am doing this: links =
Hpricot(index_page).search(“td.det_movie”).collect{ |link| link[“href”]
} to get an array of data but the thing is that right now I need some
text out of tags and the previous version only works with tags.
This is the code that I am reading, and I need the part “The Day the
Earth Stood Still”
The Day the Earth
Stood Still
thanks for any help
Thanks for the idea but I have already try innerHTML but is returning
the data but not in an array structure. I need something similar to
innerHTML.collect or something like that. I have read a lot of
documentation about Hpricot but I have not see something to fix my
problem.