rendered paste bodyon *:TEXT:!weather*:#: {
set %od $nick
sockclose weather- $+ $replace($1-,$chr(32),+)
sockopen weather- $+ $replace($2-,$chr(32),+) www.weather.com 80
}
on *:SOCKOPEN:weather*:{
sockwrite -n $sockname GET /weather/local/ $+ $gettok($sockname,2-,45) $+ ?lswe= $+ $gettok($sockname,2-,45) $+ &lwsa=WeatherLocalUndeclared&from=whatwhere HTTP/1.1
sockwrite -n $sockname Host: www.weather.com
sockwrite -n $sockname Connection: close
sockwrite -n $sockname User-Agent: Mozilla/3.0 (compatible)
sockwrite -n $sockname Authorization: Basic
sockwrite -n $sockname $crlf
}
on *:sockread:weather*: {
sockread %temp
if (Updated isin %temp) {
set %we.update $nohtml(%temp) | haltdef
}
if (</B></TD> isin %temp) {
if (</B></TD> isin %temp) {
set %we.cond $remove($nohtml(%temp),$chr(9)) | haltdef
}
}
if (ALIGN="left"><H2 CLASS="moduleTitleBar"><B>Right Now for</B><BR> isin %temp) {
set %we.loc $remove($remove($gettok($nohtml(%temp),3-,32),for),Save this Location) | haltdef
}
if (Feels Like isin %temp) {
set %we.temp $remove($nohtml(%temp),$chr(9)) | set %we.temperature $remove($replace($gettok(%we.temp,1,32),°, $+ $chr(176)),Feels) | set %we.feelslike feels like $replace($gettok(%we.temp,3,32),°, $+ $chr(176)) | haltdef
}
if (*CLASS="obsTextA">*%</td>* iswm %temp) {
set %we.hum %temp | set %we.humidity $gettok($gettok(%we.hum,2,62),1,60) | haltdef
}
if (*CLASS="obsTextA">*mph</td>* iswm %temp) {
set %we.wind %temp | set %we.windex $gettok($gettok(%we.wind,2,62),1,60) | haltdef
}
if (*CLASS="obsTextA">*°*</td>* iswm %temp) {
set %we.dew %temp | set %we.dewpoint $replace($gettok($gettok(%we.dew,2,62),1,60),°, $+ $chr(176)) | haltdef
}
if (sunrise: isin %temp) {
set %we.sunrise $remove($nohtml(%temp),$chr(9),sunrise:)
}
if (sunset: isin %temp) {
set %we.sunset $remove($nohtml(%temp),$chr(9),sunset:)
}
if (*CLASS="obsTextA">*miles</td>* iswm %temp) {
set %we.vis %temp | set %we.visibility $gettok($gettok(%we.vis,2,62),1,60) | haltdef
}
}
on *:SOCKCLOSE:weather*:{
notice %od 10,1(15 Weather10 ) (15 Location10:15 %we.loc $+ 10 ) (15 Tempature10:15 %we.temperature %we.feelslike $+ 10 ) (15 Humidity10:15 %we.humidity $+ 10 ) (15 Visibility10:15 %we.visibility $+ 10 ) (15 Wind10:15 %we.windex $+ 10 ) (15 Dew Point10:15 %we.dewpoint $+ 10 ) (15 Sunrise10:15 %we.sunrise $+ 10 ) (15 Sunset10:15 %we.sunset $+ 10 ) | unset %temp | unset %od | unset %we.*
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
return %x
}