Advertisement
illpastethat

Heat Index jared

Jun 1st, 2014
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on $*:TEXT:/^[!@]heat/Si:#:{
  2.   if (!$2) { notice $nick Usage: $1 <zip code> | halt }
  3.   var %ticks $ticks
  4.   sockopen $+(heatindex.,%ticks) www.weather.com 80
  5.   sockmark $+(heatindex.,%ticks) $+($2,~,msg $chan)
  6. }
  7.  
  8. on *:sockopen:heatindex*: {
  9.   sockwrite -n $sockname GET $+(/weather/today/,$gettok($sock($sockname).mark,1,$asc(~))) HTTP/1.1
  10.   sockwrite -n $sockname Host: www.weather.com
  11.   sockwrite -n $sockname $crlf
  12. }
  13. on *:sockread:heatindex*: {
  14.   if ($sockerr) { %return Socket error $+ $chr(44)) please try again | sockclose $sockname | halt }
  15.   else {
  16.     sockread %hi
  17.     if (*feels-like-temperature* iswm %hi) {
  18.       $gettok($sock($sockname).mark,2,$asc(~)) The heat index for $gettok($sock($sockname).mark,1,$asc(~))  is $replace($nohtml(%hi),&deg;,°)
  19.       sockclose $sockname
  20.     }
  21.   }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement