updated file prevents nonsense displayed when Yahoo returns invalid values.
Now… regarding reliability of this block.
I did a test, I set 10 locations and then set the cache to 0s – to force the script to re-download the data each page refresh. I then refreshed the page 10 times, here is the number of cities Yahoo returned upon each try (out of the 10):
4, 8, 8, 4, 1, 10, 10, 8, 10, 7
Some of you were asking why I don’t use an alternative source. Here is the problem. There are only a few forecast APIs that are free – Yahoo, WU, DarkSky, YrNo and a few others. There are only 2 that I know of that do not require an API key – Yahoo and YrNo. In this particular case this is crucial because if an API requires an API key, it means you have limited number of calls per day (in the free alternative) and so it can only be used for forecast for your particular location, which is cached and only called once a day/hour.
So we are left with two. However, YrNo, despite the fact it has no API key, tracks your IP address and also checks how many times you call it and bulk downloads are strictly forbidden – not to mention that they are not even supported – the script would have to get each location’s forecast separately (which would also take quite a while to load).
So we are left with one – Yahoo – the only one with unrestricted number of calls and the only one which allows to retrieve data for several locations at once. The other only have this option in the paid plans. If you know about a different API that allows this, please let me know! Until then… not much we can do.