http://www.nmc.gov.cn 中国气象局国家气象中心
http://www.weather.com.cn 中国气象局公共气象服务中心
天气预报接口,网上所述的中央气象台的各种接口,大多数的数据是旧的。 wearther.com.cn 这个网站还提供了天气插件,需要注册后使用。但内容太简单。有兴趣的可以去看: http://cj.weather.com.cn
http://mobile.weather.com.cn/city/101010100.html 移动版
http://www.weather.com.cn/weather/101010100.shtml PC版
——苦寻接口不得,实在不成的,去网站扒网页吧!
baidu车联网API (这个能用。但信息太少,只有未来3天的预报,没有分时天气预报。)
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript"> $(function(){ var WEATHER = { //http://api.map.baidu.com/telematics/v3/weather?location=114.02,32.98&output=json&ak=DuEpzTxLS2kjy7T7KAxhFwOl init:function() { var requestUrl="http://api.map.baidu.com/telematics/v3/weather?callback=?"; $.ajax({ type : "post", async:true, url : requestUrl, //data : "location=114.02,32.98&output=json&ak=DuEpzTxLS2kjy7T7KAxhFwOl", data : "location=北京&output=json&ak=DuEpzTxLS2kjy7T7KAxhFwOl", dataType : "jsonp", success :function(data){ console.log("-------------success"); WEATHER.initHTML(data); }, error:function(data){ console.log("error:"+data[0]); } }); }, initHTML:function(d) { var html=''; var date=d.date;//日期 var city=d.results[0].currentCity;//城市 var pm25=d.results[0].pm25;//pm25 console.log(date); console.log(city); console.log(pm25); html+='<h3>'+date+"</h3>"; html+='<h3>'+city+"</h3>"; html+='<h3>pm25: '+pm25+"</h3>"; var data=d.results[0].index; for(var i=0;i<data.length;i++){ var title=data[i].title; var zs=data[i].zs; var tipt=data[i].tipt; var des=data[i].des; //console.log(s); html+='<li>'; html+=title+": "+zs; html+="-----------"; html+=tipt+": "+des; html+='</li>'; } var data=d.results[0].weather_data; for(var i=0;i<data.length;i++){ var date=data[i].date; var dayPictureUrl=data[i].dayPictureUrl; var nightPictureUrl=data[i].nightPictureUrl; var weather=data[i].weather; var wind=data[i].wind; var temperature=data[i].temperature; //console.log(s); html+='<li>'; html+='<h3>'+date+"</h3>"; html+='<img src="'+dayPictureUrl+'"> '; html+='<img src="'+nightPictureUrl+'"> '; html+=weather+" "; html+=wind+" "; html+=temperature+"<br>"; html+='</li>'; } $("#WEATHER_HTML_box").html(html); }, }; WEATHER.init(); }); </script> </head> <body> <div id="WEATHER_HTML_box"></div> </body> </html>
33个天气小图标
晴 <img src="http://api.map.baidu.com/images/weather/day/qing.png"> <img src="http://api.map.baidu.com/images/weather/night/qing.png"><br> 多云 <img src="http://api.map.baidu.com/images/weather/day/duoyun.png"> <img src="http://api.map.baidu.com/images/weather/night/duoyun.png"><br> 阴 <img src="http://api.map.baidu.com/images/weather/day/yin.png"> <img src="http://api.map.baidu.com/images/weather/night/yin.png"><br> 阵雨 <img src="http://api.map.baidu.com/images/weather/day/zhenyu.png"> <img src="http://api.map.baidu.com/images/weather/night/zhenyu.png"><br> 雷阵雨 <img src="http://api.map.baidu.com/images/weather/day/leizhenyu.png"> <img src="http://api.map.baidu.com/images/weather/night/leizhenyu.png"><br> 雷阵雨伴有冰雹 <img src="http://api.map.baidu.com/images/weather/day/leizhenyubanyoubingbao.png"> <img src="http://api.map.baidu.com/images/weather/night/leizhenyubanyoubingbao.png"><br> 雨夹雪 <img src="http://api.map.baidu.com/images/weather/day/yujiaxue.png"> <img src="http://api.map.baidu.com/images/weather/night/yujiaxue.png"><br> 小雨 <img src="http://api.map.baidu.com/images/weather/day/xiaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/xiaoyu.png"><br> 中雨 <img src="http://api.map.baidu.com/images/weather/day/zhongyu.png"> <img src="http://api.map.baidu.com/images/weather/night/zhongyu.png"><br> 大雨 <img src="http://api.map.baidu.com/images/weather/day/dayu.png"> <img src="http://api.map.baidu.com/images/weather/night/dayu.png"><br> 暴雨 <img src="http://api.map.baidu.com/images/weather/day/baoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/baoyu.png"><br> 大暴雨 <img src="http://api.map.baidu.com/images/weather/day/dabaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/dabaoyu.png"><br> 特大暴雨 <img src="http://api.map.baidu.com/images/weather/day/tedabaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/tedabaoyu.png"><br> 阵雪 <img src="http://api.map.baidu.com/images/weather/day/zhenxue.png"> <img src="http://api.map.baidu.com/images/weather/night/zhenxue.png"><br> 小雪 <img src="http://api.map.baidu.com/images/weather/day/xiaoxue.png"> <img src="http://api.map.baidu.com/images/weather/night/xiaoxue.png"><br> 中雪 <img src="http://api.map.baidu.com/images/weather/day/zhongxue.png"> <img src="http://api.map.baidu.com/images/weather/night/zhongxue.png"><br> 大雪 <img src="http://api.map.baidu.com/images/weather/day/daxue.png"> <img src="http://api.map.baidu.com/images/weather/night/daxue.png"><br> 暴雪 <img src="http://api.map.baidu.com/images/weather/day/baoxue.png"> <img src="http://api.map.baidu.com/images/weather/night/baoxue.png"><br> 雾 <img src="http://api.map.baidu.com/images/weather/day/wu.png"> <img src="http://api.map.baidu.com/images/weather/night/wu.png"><br> 冻雨 <img src="http://api.map.baidu.com/images/weather/day/dongyu.png"> <img src="http://api.map.baidu.com/images/weather/night/dongyu.png"><br> 沙尘暴 <img src="http://api.map.baidu.com/images/weather/day/shachenbao.png"> <img src="http://api.map.baidu.com/images/weather/night/shachenbao.png"><br> 小雨转中雨 <img src="http://api.map.baidu.com/images/weather/day/xiaoyuzhuanzhongyu.png"> <img src="http://api.map.baidu.com/images/weather/night/xiaoyuzhuanzhongyu.png"><br> 中雨转大雨 <img src="http://api.map.baidu.com/images/weather/day/zhongyuzhuandayu.png"> <img src="http://api.map.baidu.com/images/weather/night/zhongyuzhuandayu.png"><br> 大雨转暴雨 <img src="http://api.map.baidu.com/images/weather/day/dayuzhuanbaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/dayuzhuanbaoyu.png"><br> 暴雨转大暴雨 <img src="http://api.map.baidu.com/images/weather/day/baoyuzhuandabaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/baoyuzhuandabaoyu.png"><br> 大暴雨转特大暴雨 <img src="http://api.map.baidu.com/images/weather/day/dabaoyuzhuantedabaoyu.png"> <img src="http://api.map.baidu.com/images/weather/night/dabaoyuzhuantedabaoyu.png"><br> 小雪转中雪 <img src="http://api.map.baidu.com/images/weather/day/xiaoxuezhuanzhongxue.png"> <img src="http://api.map.baidu.com/images/weather/night/xiaoxuezhuanzhongxue.png"><br> 中雪转大雪 <img src="http://api.map.baidu.com/images/weather/day/zhongxuezhuandaxue.png"> <img src="http://api.map.baidu.com/images/weather/night/zhongxuezhuandaxue.png"><br> 大雪转暴雪 <img src="http://api.map.baidu.com/images/weather/day/daxuezhuanbaoxue.png"> <img src="http://api.map.baidu.com/images/weather/night/daxuezhuanbaoxue.png"><br> 浮尘 <img src="http://api.map.baidu.com/images/weather/day/daxuezhuanbaoxue.png"> <img src="http://api.map.baidu.com/images/weather/night/daxuezhuanbaoxue.png"><br> 扬沙 <img src="http://api.map.baidu.com/images/weather/day/fuchen.png"> <img src="http://api.map.baidu.com/images/weather/night/fuchen.png"><br> 强沙尘暴 <img src="http://api.map.baidu.com/images/weather/day/qiangshachenbao.png"> <img src="http://api.map.baidu.com/images/weather/night/qiangshachenbao.png"><br> 霾 <img src="http://api.map.baidu.com/images/weather/day/mai.png"> <img src="http://api.map.baidu.com/images/weather/night/mai.png"><br>