# Hpricot problem with free text

**URL:** <https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894>\
**Category:** Ruby\
**Created:** [December 17, 2008, 11:57pm UTC](https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894 "2008-12-17T23:57:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![giantpanda77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@giantpanda77](https://www.ruby-forum.com/u/giantpanda77)\
**Post date:** [December 17, 2008, 11:57pm UTC](https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894/1 "2008-12-17T23:57:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giantpanda77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@giantpanda77](https://www.ruby-forum.com/u/giantpanda77)\
**Post date:** [December 18, 2008, 12:32am UTC](https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894/2 "2008-12-18T00:32:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giantpanda77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@giantpanda77](https://www.ruby-forum.com/u/giantpanda77)\
**Post date:** [December 18, 2008, 1:00am UTC](https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894/3 "2008-12-18T01:00:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![giantpanda77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@giantpanda77](https://www.ruby-forum.com/u/giantpanda77)\
**Post date:** [December 18, 2008, 1:53am UTC](https://www.ruby-forum.com/t/hpricot-problem-with-free-text/155894/4 "2008-12-18T01:53:48Z")

</div>

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.
