# HTML extraction using ruby

**URL:** <https://www.ruby-forum.com/t/html-extraction-using-ruby/162721>\
**Category:** Ruby\
**Created:** [March 13, 2009, 6:31am UTC](https://www.ruby-forum.com/t/html-extraction-using-ruby/162721 "2009-03-13T06:31:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [March 13, 2009, 6:31am UTC](https://www.ruby-forum.com/t/html-extraction-using-ruby/162721/1 "2009-03-13T06:31:49Z")

</div>

Hi,  
Can anybody tell me how to extract all the hyperlinks given in the  
url:[http://scores.sify.com/match/archive/archive.shtml](http://scores.sify.com/match/archive/archive.shtml) using ruby. I  
want the those urls having the class ‘com\_blue com\_size12 com\_arial12’.  
ie. to be more precise  
, these are the type  
of urls i want to have.  
Please help. I’ll be really greatfull.

 

Regards,  
Arun K. .C.M.

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [March 13, 2009, 3:36pm UTC](https://www.ruby-forum.com/t/html-extraction-using-ruby/162721/2 "2009-03-13T15:36:07Z")

</div>

Arun K. wrote:

> Hi,  
> Can anybody tell me how to extract all the hyperlinks given in the  
> url:[http://scores.sify.com/match/archive/archive.shtml](http://scores.sify.com/match/archive/archive.shtml) using ruby. I  
> want the those urls having the class ‘com\_blue com\_size12 com\_arial12’.  
> ie. to be more precise  
> , these are the type  
> of urls i want to have.

 

Use doc = Nokogiri::HTML( my\_html ), then something like  
doc.css(‘a.com\_blue’).each

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [March 14, 2009, 4:43am UTC](https://www.ruby-forum.com/t/html-extraction-using-ruby/162721/3 "2009-03-14T04:43:30Z")

</div>

Phlip wrote:

> Arun K. wrote:
> 
> > Hi,  
> > Can anybody tell me how to extract all the hyperlinks given in the  
> > url:[http://scores.sify.com/match/archive/archive.shtml](http://scores.sify.com/match/archive/archive.shtml) using ruby. I  
> > want the those urls having the class ‘com\_blue com\_size12 com\_arial12’.  
> > ie. to be more precise  
> > , these are the type  
> > of urls i want to have.
> 
>  
> 
> Use doc = Nokogiri::HTML( my\_html ), then something like  
> doc.css(‘a.com\_blue’).each

 

Sorry that doesn’t work. Showing an error like this.

 

uninitialized constant Nokogiri (NameError)

 

Regards  
Arun K.

---

<div class="post-metadata">

**Author:** ![arunvoip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@arunvoip](https://www.ruby-forum.com/u/arunvoip)\
**Post date:** [March 14, 2009, 5:20am UTC](https://www.ruby-forum.com/t/html-extraction-using-ruby/162721/4 "2009-03-14T05:20:43Z")

</div>

Arun K. wrote:

> Sorry that doesn’t work. Showing an error like this.
> 
> uninitialized constant Nokogiri (NameError)

You are going to need to learn more Ruby before asking high-level  
questions  
about it.

What did Google tell you about Nokogiri, or RubyGems?
