SHOW:
|
|
- or go back to the newest paste.
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. |
1 | + | on $*:TEXT:/^[!@]heat/Si:#:{ |
2 | if (!$2) { notice $nick Usage: $1 <zip code> | halt } | |
3 | - | # I want people to type !heat "zipcode) .. like !heat 90210 |
3 | + | var %ticks $ticks |
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>°</div>" |
4 | + | sockopen $+(heatindex.,%ticks) www.weather.com 80 |
5 | - | # In this case the 88 would be what is needed to be seperated. |
5 | + | sockmark $+(heatindex.,%ticks) $+($2,~,msg $chan) |
6 | } | |
7 | - | # The webpage where you can type in a zipcode to search is # # # www.weather.com/common/welcomepage/worldhtml |
7 | + | |
8 | - | # Then once you search.. this is the output URL for my zipcode 35242 |
8 | + | |
9 | - | # http://www.weather.com/weather/today/Birmingham+AL+35242?# # x=4&lswe=35242&lswa=WeatherLocalUndeclared&y=9 |
9 | + | sockwrite -n $sockname GET $+(/weather/today/,$gettok($sock($sockname).mark,1,$asc(~))) HTTP/1.1 |
10 | - | # |
10 | + | sockwrite -n $sockname Host: www.weather.com |
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) |
11 | + | sockwrite -n $sockname $crlf |
12 | } | |
13 | - | # Then as above.. it has the "feels-like-temperature-fahrenheit"> code in there to pull the # number from. |
13 | + | |
14 | if ($sockerr) { %return Socket error $+ $chr(44)) please try again | sockclose $sockname | halt } | |
15 | - | # I know this is simple.. I just can't do it.. :( |
15 | + | else { |
16 | sockread %hi | |
17 | - | # See if you can get this working.. I've got to figure out sock commands.. |
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),°,°) | |
19 | sockclose $sockname | |
20 | } | |
21 | - | on *:TEXT:!Heat*:#: { |
21 | + | } |
22 | } |