weather.tcl
Update: This script is now part of the eggtcl project.
Today, after I decided to hang out in #eggtcl on EFnet, someone asked the following:
<daILLeST> anyine know of a weather tcl that actually works? All the ones I find are outdated, or in another language…
I decided it was time that I updated my old weather.tcl based on a script by Ycarus for eggdrop bots.
Before, many scripts used weather underground (wunderground.com) to gather their feed.
I believe this is because there were many existing TCL based software that used this site to gather their data via telnet.
Telnet access to their server stopped working correctly, so scripts began using their http site to gather data. This too eventually stopped working as once they changed their site, the scripts could no longer parse the html for the data.
Enter Google.
Google has a weather API that they use for their “iGoogle“, which is very handy.
Although it appears to be undocumented by Google, working with the API is easy enough…
The query string contains a “weather” parameter, which is generally city or postcode and the “hl” parameter which is the language.
This will return an XML formatted result for the city of “London, England”.
We can then parse the data we want from this and return it accordingly.
So, put it all together, a bit of TCL care (get it?), and we’re done…
- Download weather.tcl
It works well, and returns a result similar to this:
> .wz london
<Bot> HM2K, * Weather: London, England: Mostly Cloudy, 8ºC Humidity: 87% Wind: W at 9 mph
Hope you find this useful.
What I may do next time…
Since Google’s Weather API is completely officially undocumented it’s worth noting that in future it may be wise to use Yahoo’s weather API, which is fully and officially documented.
Warning: Declaration of Social_Walker_Comment::start_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::start_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 18
Warning: Declaration of Social_Walker_Comment::end_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::end_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 42
i’m looking for instructions on installing weather.tcl to eggdrop and other tcls such as weather426.tcl . i’m new to this here and wanting to learn how.
any instruction cmds will be appricated
There is no way to have it said in fahrenheit and not celcius?
@Harold http://www.egghelp.org/enhance.htm#tclscripts
@Will http://code.google.com/p/hm2k/source/diff?spec=svn115&r=115&format=side&path=/trunk/code/tcl/weather.tcl
set wz(temp) “C”; # temperature scale [C/F]
very simple to change from C to F
How does it display C + F ?
i’m told
Unknown option -urlencoding, must be: -accept, -proxyfilter, -proxyhost, -proxyport, -useragent when trynig .wz city. what s
How do i go about this tcllib on windows?
I tried just adding htmlparse in my scripts but that needs stack struct cmdline, but i wouldnt know where to put them since i cant load those.
I’m at a dead end it seems.
apparantly you can fix that by putting the directories of the needed modules in /lib/tcl8.5/
but it doesnt respond and i don’t see any logs of it