广州天气
雅虎天气接口
查询时base_url:
https://query.yahooapis.com/v1/public/yql?q= , 公共查询接口,有限制查询次数
https://query.yahooapis.com/v1/yql?q= , 注册后获取ApkId,有限制查询次数但是已经足够使用了,10万次/天
第一步,手机端定位用户的位置(根据IP查询,或者。。。。),得到用户所在城市名称,或者城市名称的拼音,或者经纬度
第二步,根据用户所在城市的中文、英文、经纬度,获取woeid:
1,这里text键值可以用 中文、英文、经纬度。如
1): select * from geo.placefinder where text="Guangzhou"
2): select * from geo.placefinder where text="北京"
3): select * from geo.placefinder where text="39.9919336,116.3404132" and gflags = "R"
2,使用如下url查询城市的woeid:三种方法均可使用
https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="39.9919336,116.3404132" and gflags = "R"&format=json
https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="北京"&format=json
https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="Guangzhou"&format=json
注意使用经纬度获取woeid时一直取不到,后来才知道时缺少一个参数 fglags参数。,必须加 and gflags = "R"这一串才行
返回的xml格式的数据:
浙公网安备 33010602011771号