diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-08 23:58:39 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-08 23:58:39 +0000 |
commit | 249166efbb959b92011b3b0ef55ca071983f68db (patch) | |
tree | 07342f90e0f074c5193fa56607438aaac5947ebb /data/rbot/plugins | |
parent | 60c45f4da1d3a299d61698cbf7a1cdd232e6133c (diff) |
weather plugin: refactor HTML cleanup code
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/weather.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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!(/<img\s*[^<>]*?>/,'') txt.gsub!(/<br\s?\/?>/,'') + 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>/) |