And now for the weather

31 March 2006
5:33 PM

Although I’ve grown enamourered with all things Google, recent experience tells me that Yahoo also has plenty to offer the internet. In the late 90s, I thought Yahoo was an indispensable internet resource. But during a boom phase, Yahoo expanded rapidly in all directions and its front page became so cluttered that you couldn’t find anything—ironic for a tool that is supposed to help you find things. As Google exploded with its now trademark simplicity, I thought the sun was setting on Yahoo. Competition, as it turns out, is indeed a good thing and Yahoo now offers certain things that Google doesn’t. One of these is advanced developer resources. Using Yahoo APIs and RSS, you can fetch information from all sorts of Yahoo services and incorporate them into your own site.

I say all of this by way of introducing a new sidebar item, the weather near me, which is powered by said Yahoo developer tools. I found out about Yahoo’s weather data a couple weeks ago and I have been working to use it since then until today when I got everything worked out. To be honest, the whole process is technically simple, but I was delayed by certain factors (I don’t have access to many of my preferred programs, I don’t have much time to use computers). For the interested, read on. For the rest, just look to the right on the main page and you’ll see the current weather here in Chile.

Yahoo makes all sorts of its data available through API calls and RSS feeds. A complete list is available at Yahoo’s developer site. My little weather module consists of a PHP script that fetches the RSS feed for Colina, Chile, a city close enough to me to be accurate. I used a RSS-parsing class for PHP, MagpieRSS to fetch the feed and extract the relevant information. Since Magpie doesn’t currently support RSS 2.0, I used regular expressions to get some of the information from the raw feed. All the relevant data is cached; Yahoo only updates the data once an hour, so there’s no point in getting the feed more often than that. When my main blog page is called, the data is output from a small cache file and you see the weather on the right. Yahoo also provides the weather image. Those who want to see the script can contact me.