Advertisement
Logikos

Help adam -- trying to get a Heat index from zipcode. -Jare

May 31st, 2014
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. # Adam,.. I have no clue how to go about ths.. I tried to make something, didn't even try to run # it.. I know it won't work. I'm just trying to pull out one line of data from a webpage. From # weather.com.
  2.  
  3. # I want people to type !heat "zipcode) .. like !heat 90210
  4. # And then it to search the site for that zipcode.. and scan the source for that like "Feels # like".. and output that "<span itemprop="feels-like-temperature-# fahrenheit">88</span>&deg;</div>"
  5. # In this case the 88 would be what is needed to be seperated.
  6.  
  7. # The webpage where you can type in a zipcode to search is # # # www.weather.com/common/welcomepage/worldhtml
  8. # Then once you search.. this is the output URL for my zipcode 35242
  9. # http://www.weather.com/weather/today/Birmingham+AL+35242?# # x=4&lswe=35242&lswa=WeatherLocalUndeclared&y=9
  10. #
  11. # But for example if I try to simplify the URL.. and type in www.weather.com/weather/today/35242 # it will output that same page. So seems like we could use the variable $2 to input the zipcode # after the url www.weather.com/weather/today/$2 (for their zipcode)
  12.  
  13. # Then as above.. it has the "feels-like-temperature-fahrenheit"> code in there to pull the # number from.
  14.  
  15. # I know this is simple.. I just can't do it.. :(
  16.  
  17. # See if you can get this working.. I've got to figure out sock commands..
  18.  
  19.  
  20.  
  21. on *:TEXT:!Heat*:#: {
  22.  
  23. on *:sockopen:heatindex*: {
  24. if $sockerr > 0 { echo -a vlc not running | sockclose heatindex }
  25. sockwrite -n $sockname GET www.weather.com/weather/today/ HTTP/1.1
  26. sockwrite -n $sockname Connection: Keep-Alive
  27. sockwrite -n $sockname $crlf
  28. }
  29. on *:sockread:heatindex*: {
  30. if $sockerr > 0 P echo -a error | sockclose heatindex }
  31. sockread %hi
  32. if (*feels-like-temperature*) iswm %hi) {
  33. sockmark heatindex $nohtml (%hi)
  34. sockclose $sockname
  35. }
  36. }
  37.  
  38. on *:sockread:heatindex*: {
  39. if $sockerr > 0 {echo -a error | sockclose heatindex }
  40. sockread %hi
  41. var $find $+(*fahrenheit">,$sock($sockname).mark,"*)
  42. msg $chan [Current Heat Index For $2 Is]: %hi
  43. unset %h*
  44. sockclose $sockname
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement