Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

weather: fix url detection for multiple stations/sites

  • Loading branch information...
commit 29f36f867923faccc8e99863e059ee4a36b279b3 1 parent 88590b8
@Oblomov Oblomov authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 data/rbot/plugins/weather.rb
View
4 data/rbot/plugins/weather.rb
@@ -211,7 +211,7 @@ def wu_weather(m, where, units)
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 @@ def wu_weather(m, where, units)
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|
Please sign in to comment.
Something went wrong with that request. Please try again.