天气API整理,返回的数据格式为json对象
中国天气的API惨遭封杀,不得已更换其他的API使用吧。
这里大部分API来自APP的数据包截取或者反汇编,所以各开发使用者不得用于商业用途,否则后果自负!
1.金山网址导航
来源:http://www.duba.com/tianqiyubao.html
API地址:http://weather.123.duba.net/static/weather_info/101010100.html
数据格式:JSON
数据包含:PM2.5,7天天气详细数据等
DEMO:
weather_callback({
"weatherinfo": {
"city": "北京",
"city_en": "beijing",
"date_y": "2015年2月17日",
"date": "",
"week": "星期二",
"fchh": "11",
"cityid": "101010100",
"temp1": "12℃~-2℃",
"temp2": "10℃~-2℃",
"temp3": "9℃~-1℃",
"temp4": "6℃~0℃",
"temp5": "11℃~0℃",
"temp6": "9℃~-2℃",
"tempF1": "53.6℉~28.4℉",
"tempF2": "50℉~28.4℉",
"tempF3": "48.2℉~30.2℉",
"tempF4": "42.8℉~32℉",
"tempF5": "51.8℉~32℉",
"tempF6": "48.2℉~28.4℉",
"weather1": "晴",
"weather2": "晴转霾",
"weather3": "霾转阴",
"weather4": "小雨转雨夹雪",
"weather5": "晴",
"weather6": "晴",
"img1": "0",
"img2": "99",
"img3": "0",
"img4": "53",
"img5": "53",
"img6": "2",
"img7": "7",
"img8": "6",
"img9": "0",
"img10": "99",
"img11": "0",
"img12": "99",
"img_single": "0",
"img_title1": "晴",
"img_title2": "晴",
"img_title3": "晴",
"img_title4": "霾",
"img_title5": "霾",
"img_title6": "阴",
"img_title7": "小雨",
"img_title8": "雨夹雪",
"img_title9": "晴",
"img_title10": "晴",
"img_title11": "晴",
"img_title12": "晴",
"img_title_single": "晴",
"wind1": "北风3-4级转微风",
"wind2": "微风",
"wind3": "微风",
"wind4": "微风",
"wind5": "北风4-5级转3-4级",
"wind6": "北风3-4级转微风",
"fx1": "北风",
"fx2": "微风",
"fl1": "3-4级转小于3级",
"fl2": "小于3级",
"fl3": "小于3级",
"fl4": "小于3级",
"fl5": "4-5级转3-4级",
"fl6": "3-4级转小于3级",
"index": "较冷",
"index_d": "建议着厚外套加毛衣等服装。年老体弱者宜着大衣、呢外套加羊毛衫。",
"index48": "",
"index48_d": "",
"index_uv": "中等",
"index48_uv": "",
"index_xc": "较适宜",
"index_tr": "适宜",
"index_co": "较舒适",
"st1": "11",
"st2": "-2",
"st3": "10",
"st4": "0",
"st5": "9",
"st6": "-1",
"index_cl": "较不宜",
"index_ls": "基本适宜",
"index_ag": "极不易发",
"index_ct": "冷",
"index_ct_d": "建议着棉衣加羊毛衫等冬季服装",
"index_yd": "较不宜",
"index_yd_d": "天气寒冷,推荐您进行室内运动",
"index_xc_d": "无雨且风力较小,易保持清洁度",
"index_pp": "滋润保湿",
"index_pp_d": "请选用滋润保湿型化妆品",
"index_gm": "易发",
"index_gm_d": "昼夜温差很大,注意预防感冒",
"index_uv_d": "涂擦SPF大于15、PA+防晒护肤品",
"index_co_d": "白天晴好,早晚偏凉,午后舒适",
"index_gj": "较适宜",
"index_gj_d": "风稍大,出门逛街前记得给秀发定型",
"index_mf": "一般",
"index_mf_d": "注意清洁,建议选用防晒滋润型护发品",
"index_ys": "不带伞",
"index_ys_d": "天气较好,不用带雨伞",
"index_jt": "良好",
"index_jt_d": "气象条件良好,车辆可以正常行驶",
"index_lk": "干燥",
"index_lk_d": "天气较好,路面比较干燥,路况较好",
"index_cl_d": "室外锻炼请注意避免迎风锻炼",
"index_dy": "较适宜",
"index_dy_d": "天气稍凉会对垂钓产生一定影响",
"index_hc": "较适宜",
"index_hc_d": "风大天凉,需注意及时添衣",
"index_yh": "较适宜",
"index_yh_d": "不用担心天气来调皮捣乱而影响了兴致",
"index_ls_d": "天气不错,抓紧时机让衣物晒太阳吧",
"index_fs": "中等",
"index_fs_d": "适合涂擦SPF大于15,PA+护肤品",
"index_ag_d": "无需担心过敏,可放心外出,享受生活",
"rc1": "7:00",
"rl1": "17:28",
"rc2": "7:00",
"rl2": "17:28",
"pm": "28",
"pm-level": "优",
"pm-num": "1",
"pm-url": "http:\/\/pm25.mojichina.com\/33",
"pm-pubtime": "2015-02-17 16:00:00"
},
"update_time": "2015-02-17 17:25:01",
"t": 1424166379,
"from": "cache"
})
2.小米APP天气接口(注意编码,默认是GBK,但实际是UTF8)
来源:小米天气APP
API地址:http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101121301
数据格式:JSON
数据包含:7天天气详细数据等
DEMO:
{
"forecast": {
"city": "威海",
"city_en": "weihai",
"cityid": "101121301",
"date": "",
"date_y": "2015年02月17日",
"fchh": "08",
"fl1": "5-6级",
"fl2": "5-6级",
"fl3": "5-6级转4-5级",
"fl4": "4-5级",
"fl5": "4-5级",
"fl6": "微风",
"fx1": "北风",
"fx2": "北风",
"img1": "",
"img10": "",
"img11": "",
"img12": "",
"img2": "",
"img3": "",
"img4": "",
"img5": "",
"img6": "",
"img7": "",
"img8": "",
"img9": "",
"img_single": "",
"img_title1": "多云",
"img_title10": "阴",
"img_title11": "晴",
"img_title12": "晴",
"img_title2": "晴",
"img_title3": "晴",
"img_title4": "多云",
"img_title5": "晴",
"img_title6": "多云",
"img_title7": "晴",
"img_title8": "多云",
"img_title9": "小雨",
"img_title_single": "",
"index": "寒冷",
"index48": "",
"index48_d": "",
"index48_uv": "",
"index_ag": "极不易发",
"index_cl": "不宜",
"index_co": "较不舒适",
"index_d": "",
"index_ls": "不太适宜",
"index_tr": "较不宜",
"index_uv": "最弱",
"index_xc": "较不宜",
"st1": "",
"st2": "",
"st3": "",
"st4": "",
"st5": "",
"st6": "",
"temp1": "3℃~-1℃",
"temp2": "3℃~-2℃",
"temp3": "4℃~-1℃",
"temp4": "10℃~6℃",
"temp5": "12℃~3℃",
"temp6": "0℃~0℃",
"tempF1": "",
"tempF2": "",
"tempF3": "",
"tempF4": "",
"tempF5": "",
"tempF6": "",
"weather1": "多云转晴",
"weather2": "晴转多云",
"weather3": "晴转多云",
"weather4": "晴转多云",
"weather5": "小雨转阴",
"weather6": "晴",
"week": "星期二",
"wind1": "北风",
"wind2": "北风",
"wind3": "北风",
"wind4": "南风",
"wind5": "南风",
"wind6": "微风"
},
"realtime": {
"SD": "61%",
"WD": "西北风",
"WS": "4级",
"WSE": "",
"city": "",
"cityid": "101121301",
"isRadar": "1",
"radar": "JC_RADAR_AZ9010_JB",
"temp": "3",
"time": "17:35",
"weather": "晴"
},
"alert": [],
"aqi": {
"city": "威海",
"city_id": "101121301",
"pub_time": "2015-02-17 17:00",
"aqi": "52",
"pm25": "26",
"pm10": "52",
"so2": "6",
"no2": "12",
"src": "中国环境监测总站",
"spot": ""
},
"index": [
{
"code": "fs",
"details": "属弱紫外辐射天气,长期在户外,建议涂擦SPF在8-12之间的防晒护肤品。",
"index": "弱",
"name": "防晒指数",
"otherName": ""
},
{
"code": "ct",
"details": "天气寒冷,建议着厚羽绒服、毛皮大衣加厚毛衣等隆冬服装。年老体弱者尤其要注意保暖防冻。",
"index": "寒冷",
"name": "穿衣指数",
"otherName": ""
},
{
"code": "yd",
"details": "天气较好,但考虑风力很大,推荐您进行室内运动,若在户外运动请注意避风保暖和防晒。",
"index": "较不宜",
"name": "运动指数",
"otherName": ""
},
{
"code": "xc",
"details": "较不宜洗车,未来一天无雨,风力较大,如果执意擦洗汽车,要做好蒙上污垢的心理准备。",
"index": "较不宜",
"name": "洗车指数",
"otherName": ""
},
{
"code": "ls",
"details": "风力较大,不太适宜晾晒,若需要晾晒,请注意选择防风的地点晾晒并夹牢衣物。",
"index": "不太适宜",
"name": "晾晒指数",
"otherName": ""
}
],
"accu_cc": {
"EpochTime": "1424165700",
"LocalObservationDateTime": "2015-02-17T17:35:00+08:00",
"Pressure": "1021.8",
"RealFeelTemperature": "-4.3",
"RelativeHumidity": "61",
"UVIndex": "0",
"Visibility": "16.1",
"WindDirectionDegrees": "315",
"WindSpeed": "28.0"
},
"accu_f5": {
"EffectiveEpochDate": "1424559600",
"EffectiveDate": "2015-02-22T07:00:00+08:00",
"DailyForecasts": [
{
"Date": "2015-02-17T07:00:00+08:00",
"EpochDate": "1424127600",
"Sun_Rise": "2015-02-17T06:39:00+08:00",
"Sun_EpochRise": "1424126340",
"Sun_Set": "2015-02-17T17:32:00+08:00",
"Sun_EpochSet": "1424165520",
"PrecipitationProbability": "2"
},
{
"Date": "2015-02-18T07:00:00+08:00",
"EpochDate": "1424214000",
"Sun_Rise": "2015-02-18T06:38:00+08:00",
"Sun_EpochRise": "1424212680",
"Sun_Set": "2015-02-18T17:33:00+08:00",
"Sun_EpochSet": "1424251980",
"PrecipitationProbability": "0"
},
{
"Date": "2015-02-19T07:00:00+08:00",
"EpochDate": "1424300400",
"Sun_Rise": "2015-02-19T06:37:00+08:00",
"Sun_EpochRise": "1424299020",
"Sun_Set": "2015-02-19T17:34:00+08:00",
"Sun_EpochSet": "1424338440",
"PrecipitationProbability": "0"
},
{
"Date": "2015-02-20T07:00:00+08:00",
"EpochDate": "1424386800",
"Sun_Rise": "2015-02-20T06:36:00+08:00",
"Sun_EpochRise": "1424385360",
"Sun_Set": "2015-02-20T17:35:00+08:00",
"Sun_EpochSet": "1424424900",
"PrecipitationProbability": "0"
},
{
"Date": "2015-02-21T07:00:00+08:00",
"EpochDate": "1424473200",
"Sun_Rise": "2015-02-21T06:35:00+08:00",
"Sun_EpochRise": "1424471700",
"Sun_Set": "2015-02-21T17:37:00+08:00",
"Sun_EpochSet": "1424511420",
"PrecipitationProbability": "60"
}
]
},
"today": {
"cityCode": "101121301",
"date": "2015-02-17",
"humidityMax": 93,
"humidityMin": 59,
"precipitationMax": 0,
"precipitationMin": -999,
"tempMax": 3,
"tempMin": 0,
"weatherEnd": "多云",
"weatherStart": "多云",
"windDirectionEnd": "西风",
"windDirectionStart": "西风",
"windMax": 5,
"windMin": 2
},
"yestoday": {
"cityCode": "101121301",
"date": "2015-02-16",
"humidityMax": 100,
"humidityMin": 77,
"precipitationMax": 0,
"precipitationMin": -999,
"tempMax": 6,
"tempMin": 1,
"weatherEnd": "多云",
"weatherStart": "小雨",
"windDirectionEnd": "西风",
"windDirectionStart": "北风",
"windMax": 6,
"windMin": 0
}
}
3.中央天气预报(可以获取详细和简略的数据)
来源:中央天气预报APP
API地址:http://weather.51wnl.com/weatherinfo/GetMoreWeather?cityCode=101040100&weatherType=0
http://weather.51wnl.com/weatherinfo/GetMoreWeather?cityCode=101040100&weatherType=1
数据格式:JSON
数据包含:7天天气详细数据等
DEMO:
{
"weatherinfo": {
"city": "重庆",
"city_en": "",
"date_y": "2015年02月17日",
"date": "",
"week": "",
"fchh": 0,
"cityid": 101040100,
"temp1": "9℃~20℃",
"temp2": "12℃~18℃",
"temp3": "13℃~17℃",
"temp4": "13℃~17℃",
"temp5": "13℃~17℃",
"temp6": "12℃~16℃",
"tempF1": "",
"tempF2": "",
"tempF3": "",
"tempF4": "",
"tempF5": "",
"tempF6": "",
"weather1": "晴转多云",
"weather2": "阴",
"weather3": "阴",
"weather4": "阴",
"weather5": "阴转小雨",
"weather6": "小雨转多云",
"img1": "0",
"img2": "1",
"img3": "2",
"img4": "2",
"img5": "2",
"img6": "2",
"img7": "2",
"img8": "2",
"img9": "2",
"img10": "7",
"img11": "7",
"img12": "1",
"img_single": 0,
"img_title1": "",
"img_title2": "",
"img_title3": "",
"img_title4": "",
"img_title5": "",
"img_title6": "",
"img_title7": "",
"img_title8": "",
"img_title9": "",
"img_title10": "",
"img_title11": "",
"img_title12": "",
"img_title_single": "",
"wind1": "",
"wind2": "",
"wind3": "",
"wind4": "",
"wind5": "",
"wind6": "",
"fx1": "",
"fx2": "",
"fl1": "",
"fl2": "",
"fl3": "",
"fl4": "",
"fl5": "",
"fl6": "",
"index": "",
"index_d": "",
"index48": "",
"index48_d": "",
"index_uv": "",
"index48_uv": "",
"index_xc": "",
"index_tr": "",
"index_co": "",
"st1": 0,
"st2": 0,
"st3": 0,
"st4": 0,
"st5": 0,
"st6": 0,
"index_cl": "",
"index_ls": "",
"index_ag": ""
}
}
天气API整理,返回的数据格式为json对象的更多相关文章
- jquery扩展方法(表单数据格式化为json对象)
1.jquery扩展方法(表单数据格式化为json对象) <script type="text/javascript"> // 将表单数据序列化为一个json对象,例如 ...
- API设计中响应数据格式用json的优点
通常我们再设计api返回时,都使用json格式返回,相比xml,他又有什么优点呢? 更直观易懂 占用空间更小 能与JavaScript跟好的兼容.js通过eval()进行Json读取. 支持多种语言. ...
- 免费的天气API测试接口
网上几乎所有的天气接口都需要注册key,然后还各种频率限制,每天调用次数才几百次? 太坑爹了吧 一个简单的天气预报功能, 为什么要搞的这么复杂, 收什么费? 推荐一个真正免费的天气API接口, 返回j ...
- ajax返回json对象的两种写法
1. 前言 dataType: 要求为String类型的参数,预期服务器返回的数据类型.如果不指定,JQuery将自动根据http包mime信息返回responseXML或responseText,并 ...
- 【荐】使用eval()、new Function()将JSON字符串转换为JSON对象
在JS中将JSON的字符串解析成JSON数据格式,一般有两种方式: 1.一种为使用eval()函数. 2. 使用Function对象来进行返回解析. 第一种解析方式:使用eval函数来解析,并且使用j ...
- js中把JSON字符串转换成JSON对象最好的方法
在JS中将JSON的字符串解析成JSON数据格式,一般有两种方式: 1.一种为使用eval()函数. 2. 使用Function对象来进行返回解析. 第一种解析方式:使用eval函数来解析,并且使用j ...
- Js中把JSON字符串转换为JSON对象(eval()、new Function())
在JS中将JSON的字符串解析成JSON数据格式,一般有两种方式: 1.一种为使用eval()函数. 2. 使用Function对象来进行返回解析. 第一种解析方式:使用eval函数来解析,并且使用j ...
- jackson java对象和json对象的互相转换
概述 Jackson框架是基于Java平台的一套数据处理工具,被称为“最好的Java Json解析器”. Jackson框架包含了3个核心库:streaming,databind,annotation ...
- JSON对象和JSON字符串以及JSON.parse 函数的使用
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
随机推荐
- Highcharts条形与柱形同时显示
var chart; $(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'chart_combo' //关联页面元素di ...
- MVVM模式的一个小例子
使用SilverLight.WPF也有很长时间了,但是知道Binding.Command的基本用法,对于原理性的东西,一直没有深究.如果让我自己建一个MVVM模式的项目,感觉还是无从下手,最近写了一个 ...
- LoadRunner报26612错误的解决方案
LoadRunner压力测试时,一直会报12261错误,错误内容大概如下: Error -26612: HTTP Status-Code=500 (Internal Server Error) for ...
- java实现合并两个已经排序的列表
相对于C++来说,Java的最大特点之一就是没有令人困惑的指针,但是我们不可否认,在某些特定的情境下,指针确实算的上一把利刃.虽然Java中没有明确定义出指针,但是由于类的思想,我们可以使用class ...
- php集成开发环境IDE
ZendStudio EclipsePHP PhpStorm NetBeans
- Linux C C语言库的创建和调用
C语言库的创建和调用 简介: 假如,你有一个庞大的工程,代码量达到数百兆甚至是数G,你经常会遇到好多重复或常用的地方.每次使用到这些地方时如果都重新写一份基本相同的代码,这当然可以,不过这样会大大地降 ...
- nodejs小问题:express不是内部或外部命令(转载)
安装express之后发现居然提示express不是内部或外部命令. 工具/原料 Node.js安装包 方法/步骤 1 首先下载Node.js安装包,此处我用的是官方最新的v0.10.27 32位版: ...
- Eclipse启动的时候窗口一闪就关的解决办法(转)
有时候会碰到如题这种问题,从网上查知解决办法,非常管用 为eclipse.exe创建一个快捷方式,然后快捷方式上右键-属性,在目标栏填入 E:\eclipse\eclipse.exe -vm &quo ...
- 在SQL SErver中实现数组功能
T-SQL象数组一样处理字符串.分割字符串 在日常的编程过程中,数组是要经常使用到的.在利用SQL对数据库进行操作时,有时就想在SQL使用数组,比如将1,2,3,4,5拆分成数组.可惜的是在T- ...
- java性能优化策略
1. 尽量使用局部变量代替成员变量,循环中对成员变量.方法的调用不超过2次 2. ArrayList如果知道大小,初始化时应指明 3. HashMap的遍历,用Entry 4. 如果确定类不可继承尽量 ...