天气预报API(六):中国气象频道、腾讯天气--“新编码”接口的测试
说明
本文所有测试均以青岛为例。
本文所列接口城市代码(cityid)参数都使用的 “新编码”:
全国城市代码列表(新)
本文接口均不是官方接口,仅供测试使用!
腾讯天气
空气质量指数 (aqi)
http://weather.gtimg.cn/aqi/01012310.json?callback=
返回unicode字符编码,并且数值是浮点数;
- [
- {
- "pm2_5": 0,
- "primary_pollutant": null,
- "co": 0.3,
- "pm10": 0,
- "area": "青岛",
- "o3_8h": 82,
- "o3": 83,
- "o3_24h": 92,
- "station_code": "1307A",
- "quality": "优",
- "co_24h": 0.4,
- "no2_24h": 5,
- "so2": 36,
- "so2_24h": 37,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 0,
- "position_name": "仰口",
- "o3_8h_24h": 87,
- "aqi": 26,
- "pm10_24h": 0,
- "no2": 4
- },
- {
- "pm2_5": 54,
- "primary_pollutant": "细颗粒物(PM2.5)",
- "co": 1.1,
- "pm10": 89,
- "area": "青岛",
- "o3_8h": 20,
- "o3": 4,
- "o3_24h": 61,
- "station_code": "1308A",
- "quality": "良",
- "co_24h": 0.6,
- "no2_24h": 52,
- "so2": 61,
- "so2_24h": 27,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 33,
- "position_name": "李沧区子站",
- "o3_8h_24h": 61,
- "aqi": 74,
- "pm10_24h": 60,
- "no2": 88
- },
- {
- "pm2_5": 40,
- "primary_pollutant": "细颗粒物(PM2.5)",
- "co": 0.8,
- "pm10": 0,
- "area": "青岛",
- "o3_8h": 33,
- "o3": 12,
- "o3_24h": 63,
- "station_code": "1309A",
- "quality": "良",
- "co_24h": 0.5,
- "no2_24h": 33,
- "so2": 25,
- "so2_24h": 30,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 27,
- "position_name": "市北区子站",
- "o3_8h_24h": 61,
- "aqi": 57,
- "pm10_24h": 66,
- "no2": 48
- },
- {
- "pm2_5": 13,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 0.5,
- "pm10": 67,
- "area": "青岛",
- "o3_8h": 22,
- "o3": 12,
- "o3_24h": 51,
- "station_code": "1310A",
- "quality": "良",
- "co_24h": 0.4,
- "no2_24h": 57,
- "so2": 11,
- "so2_24h": 9,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 12,
- "position_name": "市南区东部子站",
- "o3_8h_24h": 43,
- "aqi": 59,
- "pm10_24h": 59,
- "no2": 89
- },
- {
- "pm2_5": 45,
- "primary_pollutant": "细颗粒物(PM2.5)",
- "co": 1.3,
- "pm10": 59,
- "area": "青岛",
- "o3_8h": 34,
- "o3": 13,
- "o3_24h": 68,
- "station_code": "1311A",
- "quality": "良",
- "co_24h": 1,
- "no2_24h": 50,
- "so2": 23,
- "so2_24h": 25,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 29,
- "position_name": "四方区子站",
- "o3_8h_24h": 68,
- "aqi": 63,
- "pm10_24h": 57,
- "no2": 77
- },
- {
- "pm2_5": 30,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 0.8,
- "pm10": 61,
- "area": "青岛",
- "o3_8h": 41,
- "o3": 18,
- "o3_24h": 62,
- "station_code": "1312A",
- "quality": "良",
- "co_24h": 0.6,
- "no2_24h": 45,
- "so2": 26,
- "so2_24h": 25,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 23,
- "position_name": "市南区西部子站",
- "o3_8h_24h": 56,
- "aqi": 56,
- "pm10_24h": 55,
- "no2": 77
- },
- {
- "pm2_5": 37,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 0.7,
- "pm10": 60,
- "area": "青岛",
- "o3_8h": 38,
- "o3": 20,
- "o3_24h": 58,
- "station_code": "1313A",
- "quality": "良",
- "co_24h": 0.5,
- "no2_24h": 33,
- "so2": 37,
- "so2_24h": 26,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 20,
- "position_name": "崂山区子站",
- "o3_8h_24h": 52,
- "aqi": 55,
- "pm10_24h": 35,
- "no2": 65
- },
- {
- "pm2_5": 42,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 0.6,
- "pm10": 122,
- "area": "青岛",
- "o3_8h": 97,
- "o3": 93,
- "o3_24h": 106,
- "station_code": "1314A",
- "quality": "良",
- "co_24h": 0.5,
- "no2_24h": 60,
- "so2": 32,
- "so2_24h": 31,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 32,
- "position_name": "黄岛区子站",
- "o3_8h_24h": 100,
- "aqi": 86,
- "pm10_24h": 85,
- "no2": 79
- },
- {
- "pm2_5": 65,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 2.1,
- "pm10": 146,
- "area": "青岛",
- "o3_8h": 41,
- "o3": 13,
- "o3_24h": 79,
- "station_code": "1315A",
- "quality": "良",
- "co_24h": 1,
- "no2_24h": 37,
- "so2": 56,
- "so2_24h": 38,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 34,
- "position_name": "城阳区子站",
- "o3_8h_24h": 67,
- "aqi": 98,
- "pm10_24h": 66,
- "no2": 71
- },
- {
- "pm2_5": 40,
- "primary_pollutant": "颗粒物(PM10)",
- "co": 0.911,
- "pm10": 86,
- "area": "青岛",
- "o3_8h": 45,
- "o3": 29,
- "o3_24h": 71,
- "station_code": null,
- "quality": "良",
- "co_24h": 0.611,
- "no2_24h": 41,
- "so2": 34,
- "so2_24h": 27,
- "time_point": "2016-12-10T22:00:00Z",
- "pm2_5_24h": 26,
- "position_name": null,
- "o3_8h_24h": 66,
- "aqi": 69,
- "pm10_24h": 60,
- "no2": 66
- }
- ]
城市AQI 排名
http://weather.gtimg.cn/aqi/cityrank.json?callback=cityrank
返回unicode字符编码,并且数值是浮点数;
返回json array 类型,这里只是截图显示下结构:

城市基本天气信息
http://weather.gtimg.cn/city/01012310.js
这个js文件不是纯json格式,需要处理一下才能使用
var __weather_city = {"bi_name": "青岛", "zs_xc": "2", "h3": {"rt": "2016-12-10 20:00:00", "0": [{"wd": "4", "ts": "2016-12-10 23:00:00", "tp": "2", "wkd": "6", "wt": "00", "wp": "0", "te": "2016-12-11 2:00:00"}, {"wd": "4", "ts": "2016-12-11 2:00:00", "tp": "2", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 5:00:00"}, {"wd": "4", "ts": "2016-12-11 5:00:00", "tp": "2", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 8:00:00"}, {"wd": "4", "ts": "2016-12-11 8:00:00", "tp": "3", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 11:00:00"}, {"wd": "4", "ts": "2016-12-11 11:00:00", "tp": "7", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 14:00:00"}, {"wd": "4", "ts": "2016-12-11 14:00:00", "tp": "8", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 17:00:00"}, {"wd": "4", "ts": "2016-12-11 17:00:00", "tp": "7", "wkd": "7", "wt": "00", "wp": "0", "te": "2016-12-11 20:00:00"}, {"wd": "4", "ts": "2016-12-11 20:00:00", "tp": "8", "wkd": "7", "wt": "00", "wp": "1", "te": "2016-12-11 23:00:00"}, {"wd": "4", "ts": "2016-12-11 23:00:00", "tp": "8", "wkd": "7", "wt": "00", "wp": "1", "te": "2016-12-12 2:00:00"}, {"wd": "4", "ts": "2016-12-12 2:00:00", "tp": "8", "wkd": "1", "wt": "00", "wp": "0", "te": "2016-12-12 5:00:00"}, {"wd": "4", "ts": "2016-12-12 5:00:00", "tp": "9", "wkd": "1", "wt": "00", "wp": "0", "te": "2016-12-12 8:00:00"}, {"wd": "4", "ts": "2016-12-12 8:00:00", "tp": "9", "wkd": "1", "wt": "00", "wp": "0", "te": "2016-12-12 11:00:00"}, {"wd": "8", "ts": "2016-12-12 11:00:00", "tp": "10", "wkd": "1", "wt": "02", "wp": "1", "te": "2016-12-12 14:00:00"}, {"wd": "8", "ts": "2016-12-12 14:00:00", "tp": "10", "wkd": "1", "wt": "03", "wp": "0", "te": "2016-12-12 17:00:00"}, {"wd": "8", "ts": "2016-12-12 17:00:00", "tp": "9", "wkd": "1", "wt": "03", "wp": "0", "te": "2016-12-12 20:00:00"}, {"wd": "8", "ts": "2016-12-12 20:00:00", "tp": "8", "wkd": "1", "wt": "03", "wp": "0", "te": "2016-12-12 23:00:00"}]}, "zs_cy": "7", "zs_rt": "2016-12-10 8:00:00", "zs_zs": "0", "zs_kqwr": "2", "zs_gj": "1", "zs_xq": "2", "zs_gm": "1", "zs_pj": "1", "zs_cl": "3", "zs_ysh": "2", "sk_vb": "NULL", "zs_lk": "1", "zs_kt": "5", "sk_ws": "1.4", "bi_sid": "54857", "zs_dy": "2", "sk_ps": "1022", "sk_tp": "3", "zs_mf": "2", "bi_cid": "01012310", "zs_yd": "3", "sk_wda": "98", "news_txt": [{"rt": "2014-5-11 9:30:00", "ac": "青岛市气象台2014年05月11日09时30分发布大雾黄色预警信号:目前我市沿海地区已出现能见度小于500米的大雾,预计今天白天雾仍将持续,请注意防范。", "pv": "山东省", "url": "http://3g.mywtv.cn", "uv": "http://mobile.mywtv.cn/video20/zhaowen3_android.3gp", "al": "黄色", "cny": "", "at": "大雾", "ulc": "更多预警信息点击...", "rlt": "", "ds": "青岛市"}], "wk": {"rt": "2016-12-10 20:00:00", "0": [{"wd": "4", "tmin": "2", "tmax": "NULL", "wkd": "6", "ts": "2016-12-10 20:00:00", "wt": "00", "wp": "1", "te": "2016-12-11 8:00:00"}, {"wd": "4", "tmin": "NULL", "tmax": "9", "wkd": "6", "ts": "2016-12-11 8:00:00", "wt": "00", "wp": "1", "te": "2016-12-11 20:00:00"}, {"wd": "4", "tmin": "7", "tmax": "NULL", "wkd": "7", "ts": "2016-12-11 20:00:00", "wt": "00", "wp": "1", "te": "2016-12-12 8:00:00"}, {"wd": "8", "tmin": "NULL", "tmax": "11", "wkd": "7", "ts": "2016-12-12 8:00:00", "wt": "00", "wp": "1", "te": "2016-12-12 20:00:00"}, {"wd": "8", "tmin": "4", "tmax": "NULL", "wkd": "1", "ts": "2016-12-12 20:00:00", "wt": "03", "wp": "1", "te": "2016-12-13 8:00:00"}, {"wd": "8", "tmin": "NULL", "tmax": "5", "wkd": "1", "ts": "2016-12-13 8:00:00", "wt": "03", "wp": "3", "te": "2016-12-13 20:00:00"}, {"wd": "8", "tmin": "-2", "tmax": "NULL", "wkd": "2", "ts": "2016-12-13 20:00:00", "wt": "00", "wp": "3", "te": "2016-12-14 8:00:00"}, {"wd": "8", "tmin": "NULL", "tmax": "2", "wkd": "2", "ts": "2016-12-14 8:00:00", "wt": "00", "wp": "2", "te": "2016-12-14 20:00:00"}, {"wd": "8", "tmin": "-2", "tmax": "NULL", "wkd": "3", "ts": "2016-12-14 20:00:00", "wt": "00", "wp": "2", "te": "2016-12-15 8:00:00"}, {"wd": "8", "tmin": "NULL", "tmax": "4", "wkd": "3", "ts": "2016-12-15 8:00:00", "wt": "00", "wp": "2", "te": "2016-12-15 20:00:00"}, {"wd": "8", "tmin": "-1", "tmax": "NULL", "wkd": "4", "ts": "2016-12-15 20:00:00", "wt": "00", "wp": "2", "te": "2016-12-16 8:00:00"}, {"wd": "4", "tmin": "NULL", "tmax": "5", "wkd": "4", "ts": "2016-12-16 8:00:00", "wt": "00", "wp": "2", "te": "2016-12-16 20:00:00"}, {"wd": "4", "tmin": "1", "tmax": "NULL", "wkd": "5", "ts": "2016-12-16 20:00:00", "wt": "00", "wp": "2", "te": "2016-12-17 8:00:00"}, {"wd": "4", "tmin": "NULL", "tmax": "8", "wkd": "5", "ts": "2016-12-17 8:00:00", "wt": "00", "wp": "2", "te": "2016-12-17 20:00:00"}]}, "sk_rt": "2016-12-10 23:50:00", "zs_fs": "3", "zs_yh": "2", "zs_zwx": "3", "sk_hd": "54", "zs_ys": "1", "zs_fh": "8", "bi_sr": "06:59", "bi_ss": "16:44", "bi_lat": "36.088", "zs_ly": "3", "zs_te": "2016-12-11 8:00:00", "sk_wd": "2", "bi_long": "120.343", "zs_ffz": "3", "zs_ls": "3", "zs_jt": "1", "zs_hz": "1", "sk_wp": "1", "zs_ts": "2016-12-10 8:00:00", "zs_ssd": "1", "sk_wt": "01", "zs_hc": "2"};
中国气象频道
城市天气信息
重要的是Cookie里面的参数
GET /getSkData.do;jsessionid=D83B3F61E769A31DD5141C5BBB267AC8?cityCode=01012310 HTTP/1.1
Host: 3g.tianqi.cn
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
Cookie: Hm_lvt_ce10d82ee6d6df088908bc379b31906d=1481369909; Hm_lpvt_ce10d82ee6d6df088908bc379b31906d=1481387987; cityCode=01012310; cityName=%E9%9D%92%E5%B2%9B
Proxy-Connection: keep-alive
Referer: http://3g.tianqi.cn/index.html
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)
X-Requested-With: XMLHttpRequest
- {
- "weather": "00",
- "weatherDecoder": "晴",
- "weatherPic": "images/weatherPng/n00.png",
- "temperature": "3.1",
- "feelTemperature": "3",
- "windDir": "1",
- "windDirDecoder": "东北风",
- "windPower": "0",
- "windPowerDecoder": "微风",
- "windDirAngle": "56",
- "windSpeed": "1",
- "humidity": "52.0",
- "pressure": "1030.1",
- "visibility": "18",
- "sunrise": "06:56",
- "sunset": "16:45",
- "lunar": "12/11 冬月十三 周日",
- "solarTerm": "大雪",
- "publicTime": "23",
- "threeTimea": "今日2时",
- "threeWeatherPica": "images/weatherPng/n01.png",
- "threeWeatherDecodera": "多云",
- "threeWeathera": "3.7",
- "threeTimeb": "今日5时",
- "threeWeatherPicb": "images/weatherPng/n01.png",
- "threeWeatherDecoderb": "多云",
- "threeWeatherb": "4.4",
- "threeTimec": "今日8时",
- "threeWeatherPicc": "images/weatherPng/d02.png",
- "threeWeatherDecoderc": "阴",
- "threeWeatherc": "7.8",
- "threeTimed": "今日11时",
- "threeWeatherPicd": "images/weatherPng/d02.png",
- "threeWeatherDecoderd": "阴",
- "threeWeatherd": "9.3",
- "beans":[],
- "tmax": "6",
- "tmin": "2"
- }
结束语
这里只是提供个入口,是一定有办法获取能看到所有信息的。
具体方法我就不给出了,可以和我交流讨论。
天气预报API(六):中国气象频道、腾讯天气--“新编码”接口的测试的更多相关文章
- 天气预报API(四):全国城市代码列表(“新编码”)
说明 天气预报API系列文章涉及到的天气网站10个左右,只发现了中国气象频道和腾讯天气城市代码参数特别: 暂且称 中国气象频道.腾讯天气使用的城市代码为 "新编码" 注:中国气象频 ...
- 天气预报API(一):全国城市代码列表(“旧编码”)
说明 2016-12-09 补充 (后来)偶然发现中国天气网已经有城市ID列表的网页... 还发现城市编码有两种,暂且称中国天气网这些编码为旧标准 "旧编码"的特征是 9个字符长度 ...
- 天气预报API(三):免费接口测试(“旧编码”)
说明 我以参考文章为引子,自己测试并扩展,努力寻找更多的气象API... 本文所有测试均以青岛为例. 本文所列接口城市代码(cityid)参数都使用的 "旧编码": 全国城市代码列 ...
- 天气预报API(五):城市代码--“新编码”和“旧编码” 对比
参考一些博客.文章 来查找 测试 接口,后来发现两套城市编码标准,有点想法,故拿来对比分析. 注:新旧编码是个人主观叫法,只是为了方便称呼,可能有不当之处,请留言更正. 暂且称 中国天气网等网站使用的 ...
- 中国气象网 气象数据开放平台 API用法 (Android)
因为要做个天气应用.须要找个天气的API.上网上搜了下都是那几个,并且基本都过时了.百度有个天气API,只是貌似仅仅能提供当天的.网上提到的中国气象接口的文章,大都用的时旧API,有的被封了,有的永远 ...
- 天气预报API开发
天气预报API开发 一. 寻觅篇 最近想要跟着视频练习一下利用API开发一个天气预报系统,就在网上找了一下可以用的API,结果好多都已经失效了... 1. 百度车联网天气预报 ...
- 天气预报API(二):全球城市、景点代码列表(“旧编码”)
说明 2016-12-10 补充 (后来)偶然发现中国天气网已经有城市ID列表的网页...还发现城市编码有两种,暂且称中国天气网这些编码为旧标准"旧编码"的特征是 9个字符长度; ...
- Android访问中央气象台的天气预报API得到天气数据
最新说明:该接口已失效! 2014-03-04 可申请它公布的API,需申请:http://smart.weather.com.cn/wzfw/smart/weatherapi.shtml 在用A ...
- 聚合数据全国天气预报api接口
查询天气预报在APP中常用的一个常用功能,聚合数据全国天气预报api接口可以根据根据城市名/id查询天气.根据IP查询天气.据GPS坐标查询天气.查询城市天气三小时预报,并且支持全国不同城市天气预报查 ...
随机推荐
- Web开发必知的八种隔离级别
ACID性质是数据库理论中的奠基石,它定义了一个理论上可靠数据库所必须具备的四个性质:原子性,一致性,隔离性和持久性.虽然这四个性质都很重要,但是隔离性最为灵活.大部分数据库都提供了一些可供选择的隔离 ...
- 【Android端 APP 启动时长获取】启动时长获取方案及具体实施
一.什么是启动时长? 1.启动时长一般包括三种场景,分别是:新装包的首次启动时长,冷启动时长.热启动时长 冷启动 和 热启动 : (1)冷启动:当启动应用时,后台没有该程序的进程,此时启动的话系统会分 ...
- Xcode8 安装插件
关闭Xcode 一.进入https://github.com/inket/update_xcode_plugins下载 二.打开终端,输入sudo gem install update_xcode_p ...
- web开发工具软件使用问题记录
一.右键 - 添加Git Bash Here菜单 转自:http://blog.csdn.net/u014527912/article/details/51723735 步骤: 1.通过在“运行”中输 ...
- jQuery停止动画——stop()方法的使用
很多时候需要停止匹配元素正在进行的动画,比如,当鼠标选入元素时显示菜单,鼠标离开时隐藏下拉菜单,如果鼠标移入移出过快的话就会导致动画效果与鼠标的动作不一致的情况,此时stop()就派上用场了. sto ...
- jQuery Mobile 可折叠
可折叠的内容块 可折叠(Collapsibles)允许您隐藏或显示内容 - 对于存储部分信息很有用. 如需创建可折叠的内容块,请向某个容器分配 data-role="collapsible& ...
- js基础到精通全面教程--JS教程
适合阅读范围:对JavaScript一无所知-离精通只差一步之遥的人 基础知识:HTML JavaScript就这么回事1:基础知识 1 创建脚本块 1: <script language=”J ...
- myql数据库在cmd下,中文乱码的问题原因
使用navicat把数据导入数据库,这些数据都是中文,导入成功,显式也正常,但是在mysql cmd下都是乱码.检查了我的mysql配置,字符编码都是utf8,包括navicat连接时候也设置过是ut ...
- SPFA+寻路(行路难,洛谷2832)
啊啊啊这道难题总算是做出来了,首先是帅比浮云的题解发出来一下:http://www.cnblogs.com/fuyun-boy/p/5922742.html 原题目地址:https://www.luo ...
- JSP目录
JSP目录 课时1 jsp概述和背后原理31:11 课时2 三种jsp的scriptlet语法27:29 课时3 jsp的注释14:00 课时4 JSP4个域对象的作用域3 ...