diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-05-09 11:47:26 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-05-09 11:47:26 +0200 |
commit | 29f36f867923faccc8e99863e059ee4a36b279b3 (patch) | |
tree | 704019a67d11278e781ff509b701b3b6c1f83869 /data/rbot/plugins/weather.rb | |
parent | 88590b85a4dcd20a91b9844dfff353996bc81119 (diff) |
weather: fix url detection for multiple stations/sites
Diffstat (limited to 'data/rbot/plugins/weather.rb')
-rw-r--r-- | data/rbot/plugins/weather.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 8f59a9ba..0d3abee2 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -211,7 +211,7 @@ class WeatherPlugin < Plugin m.reply "couldn't parse weather data from #{where}" end wu_out_special(m, xml) - when /<a href="\/(?:global\/stations|US\/\w\w)\// + when /<a href="\/auto\/mobile[^\/]+\/(?:global\/stations|[A-Z][A-Z])\// wu_weather_multi(m, xml) else debug xml @@ -224,7 +224,7 @@ class WeatherPlugin < Plugin def wu_weather_multi(m, xml) # debug xml - stations = xml.scan(/<td>\s*(?:<a href="([^?"]+\?feature=[^"]+)"\s*[^>]*><img [^>]+><\/a>\s*)?<a href="\/(?:global\/stations|US\/(\w\w))\/([^"]*?)\.html">(.*?)<\/a>\s*:\s*(.*?)<\/td>/m) + stations = xml.scan(/<td>\s*(?:<a href="([^?"]+\?feature=[^"]+)"\s*[^>]*><img [^>]+><\/a>\s*)?<a href="\/auto\/mobile[^\/]+\/(?:global\/stations|([A-Z][A-Z]))\/([^"]*?)\.html">(.*?)<\/a>\s*:\s*(.*?)<\/td>/m) # debug stations m.reply "multiple stations available, use 'weather station <code>' or 'weather <city, state>' as appropriate, for one of the following (current temp shown):" stations.map! { |ar| |