Forum: Ruby HTML extraction using ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Arun K. (Guest)
on 2009-03-13 07:31
Hi,
Can anybody tell me how to extract all the hyperlinks given in the
url: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
<a class="com_blue com_size12 com_arial12" href="">, these are the type
of urls i want to have.
Please help. I'll be really greatfull.

Regards,
Arun K. .C.M.
Phlip (Guest)
on 2009-03-13 16:36
(Received via mailing list)
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 using ruby. I
> want the those urls having the class 'com_blue com_size12 com_arial12'.
> ie. to be more precise
> <a class="com_blue com_size12 com_arial12" href="">, 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
Arun K. (Guest)
on 2009-03-14 05:43
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 using ruby. I
>> want the those urls having the class 'com_blue com_size12 com_arial12'.
>> ie. to be more precise
>> <a class="com_blue com_size12 com_arial12" href="">, 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.
Phlip (Guest)
on 2009-03-14 06:20
(Received via mailing list)
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?
This topic is locked and can not be replied to.