views:

17

answers:

2

Hi Friends, I have to parse only the 'current temperature' value in a webpage and display it. Kindly help me out please.

A: 
require 'open-uri'

data =''
open("http://some.site/page/address") do |f| // adjust URI here
  data << f.read while !f.eof?
end
temp = data[/current temperature: [0-9]+/]   // and regex here
p temp
zed_0xff
+1  A: 

I highly recommend you using Nokogiri. Here's a good overview.

Simone Carletti