WUnderground Free API is closed.

Have been used Weather Underground free API for my personal use for the last couple of years. However, it has been broken since yesterday. Unable to retrieve weather data and only thing I got from the response is “invalidkey”. Then I logged in to my weather underground developer account, there was an error message: “the API key has been disabled manually”.

So, what is wrong? I only use this key to show local weather information in my place, designed to fetch information every 15 minutes from wunderground.com, way below the limits. (Free API can have 500 calls per day, 10 calls per minute.)

Later, I found there is a message appeared on the homepage of WeatherUnderground API says “we will no longer provide free API keys“. Also there is a post on the official community website says “Your subscriptions, and therefore access, will continue to work through 12/31/2018.(https://apicommunity.wunderground.com/weatherapi/topics/end-of-service-for-the-weather-underground-api?topic-reply-list[settings][page]=4#topic-reply-list)

I also Googled, there were discussions about this since mid-2018. Looks like, they have planned for a long time. However, I searched my inbox, there is nothing sent from weather underground in the last year.

It is time switch to another weather API provider now.



本来就有文件名过滤的方法用于将JSON中的非法字符给替换掉。不过最近JSON格式略有改变,有些title里会加入转义字符(Escape sequence),比如 “ \t ”。这么一来如果在Windows下直接将这种title用于目标文件名是会报错的。已有的替换方法会将JSON中常见的非法字符替换为全角字符(比如 “ * ” 变成 “*” 这样),于是我就轻车熟路加上了对于 \t 的处理语句(其实只要清掉它即可)。不过没留神的是,因为 C# 里面平时替换反斜杠(backslash)的时候是用 2 条反斜杠作为 keyword 进行字符串替换。于是在加入这个新东西的时候,习惯性的输入 String.Replace(“\\t”, “”);

于是程序就很有个性的无视了源数据里面的那个\t,搞得我调试了好一会儿,最后发现是自己秀逗了,应该用 “\t” 作为关键字而非 “\\t”。因为 \t 已经是 C# 中自带的转义字符了[1],若在此使用 2 条反斜杠反而适得其反,使得意义完全不同了。

(环境:VS Express 2013 for Desktop)

[1] https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/h21280bw(v=vs.120)