# Help with Hpricot and collect

**URL:** <https://www.ruby-forum.com/t/help-with-hpricot-and-collect/155900>\
**Category:** Ruby\
**Created:** [December 18, 2008, 1:48am UTC](https://www.ruby-forum.com/t/help-with-hpricot-and-collect/155900 "2008-12-18T01:48:55Z")\
**Posts on this page:** 2\
**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 18, 2008, 1:48am UTC](https://www.ruby-forum.com/t/help-with-hpricot-and-collect/155900/1 "2008-12-18T01:48:55Z")

</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 part of the code that I am reading, and I need the part that is  
not in tags:

the file is very large and I need all the objects with the  
class=“det\_movie”.

thanks for any help

|
| |
| |
| 6:25 9:20 p.m. (Mon./Fri.) 4:00 p.m. (No previews) (Sat./Sun./Hol.) 1:00 p.m. (No previews) 3:30 p.m. |
|
| |

---

<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, 11:22am UTC](https://www.ruby-forum.com/t/help-with-hpricot-and-collect/155900/2 "2008-12-18T11:22:30Z")

</div>

require ‘hpricot’

doc=Hpricot(‘The Day  
the Earth Stood StillThe Day the Earth Stood Still’)

links=(doc/“[//a.link](https://a.link)”).collect do |link|  
Â [link[:href],link.inner\_text]  
end

=\> [  
[“detalle\_movie.php?mv\_id=618”, “The Day the Earth Stood Still”],  
[“detalle\_movie.php?mv\_id=618”, “The Day the Earth Stood Still”]  
]
