All pastes #896839 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-09 00:12 UTC
rendered paste body
ON $*:TEXT:/^[@!.]weather/Si:#: { 
  Set %postcode $replace($2-,$chr(32),+)
  set %output $iif($left($1,1) == @, msg $chan, notice $nick) 
  sockopen weather bbc.co.uk 80 
} 
ON *:SOCKOPEN:weather: { 
  sockwrite -nt $sockname GET /cgi-perl/weather/search/new_search.pl?search_query= $+ %postcode HTTP/1.1 
  sockwrite -nt $sockname Host: uk.weather.com 
  sockwrite -nt $sockname $crlf 
} 
ON *:SOCKREAD:weather: { 
  var %read
  sockread %read
  if (<title>BBC - Weather Centre - 5 Day Forecast in Celsius for *, *</title> iswm %read) {
    tokenize 45 %read
    set %name $remove($1-,<title>BBC, -, Weather, Centre, 5, Day, Forecast, in, Celsius, for)
  }
}
ON *:SOCKCLOSE:weather: { 
  %output [WEATHER] Location: %name 
  unset %postcode
  unset %output
  unset %name
}