All pastes #455842 Raw Edit

Stuff

public text v1 · immutable
#455842 ·published 2007-04-24 14:16 UTC
rendered paste body
alias weather { 
  if ($1 == -s) { 
    set %wzip $2- 
    set %wway msg $active 
    %wway opening socket - weather.com: $+ %wzip 
    sockopen weather weather.com 80 
  } 
  else { 
    set %wzip $1- 
    set %wway echo -ta 
    %wway opening socket - weather.com: $+ %wzip 
    sockopen weather weather.com 80 
  } 
} 
on *:sockopen:weather:{ 
  sockwrite -nt $sockname GET /weather/local/ $+ %wzip HTTP/1.1 
  sockwrite -nt $sockname Host: weather.com 
  sockwrite -nt $sockname $crlf 
} 
on *:sockread:weather:{ 
  if ($sockerr) { 
    echo -ta Error: $sockerr 
  } 
  else { 
    var %ee 
    sockread %ee 
    if (*<B CLASS=obsTextA>Feels Like<BR>* iswm %ee) { 
      tokenize 32 %ee 
      %wway $htmlfree($1-) 
      sockclose weather 
    } 
  } 
} 
alias htmlfree { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
}