From 249166efbb959b92011b3b0ef55ca071983f68db Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 8 Nov 2007 23:58:39 +0000 Subject: weather plugin: refactor HTML cleanup code --- data/rbot/plugins/weather.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'data/rbot/plugins') diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 4ff92769..c241daa8 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -214,16 +214,20 @@ class WeatherPlugin < Plugin end end - def wu_weather_filter(stuff) + def wu_clean(stuff) txt = stuff txt.gsub!(/[\n\s]+/,' ') - data = Hash.new txt.gsub!(/ /, ' ') txt.gsub!(/°/, ' ') # degree sign txt.gsub!(/<\/?b>/,'') txt.gsub!(/<\/?span[^<>]*?>/,'') txt.gsub!(/]*?>/,'') txt.gsub!(//,'') + txt + end + + def wu_weather_filter(stuff) + txt = wu_clean(stuff) result = Array.new if txt.match(/<\/a>\s*Updated:\s*(.*?)\s*Observed at\s*(.*?)\s*<\/td>/) -- cgit v1.2.3