Public feed
#892818
ON $*:TEXT:/^[@!.]weather/Si:#: {
Set %postcode1 $2
set %postcode2 $3
set %output $iif($left($1,1) == @, msg $chan, notice $nick)
sockopen weather3 uk.weather.com 80
}
ON *:SOCKOPEN:weather3: {
sockwrite -nt $sockname GET /weather/local/ $+ %postcode1 $+ ?x=12&where2= $+ %postcode2 HTTP/1.1
sockwrite -nt $sockname Host: uk.weather.com
sockwrite -nt $sockname $crlf
}
ON *:SOCKREAD:weather3: {
var %read
sockread %read
if (<TD BGCOLOR="#CCCCFF" VALIGN="top" COLSPAN="2" CLASS="sectionTitle" iswn %read) {
tokenize 62 %read
set %name $remove($1,<br>)
}
if (<TR><TD CLASS="obsTempText" ALIGN="CENTER"><B iswn %read) {
tokenize 62 %read
set %deg $remove($1,<br>)
sockclose $sockname
}
}
ON *:SOCKCLOSE:weather3: {
%output [WEATHER] Location: %name $chr(124) Temp: %deg $+ °C
unset %postcode1
unset %postcode2
unset %output
unset %name
unset %deg
}