天气API (https://www.tianqiapi.com) 提供的是真正免费的天气api接口
接口没有调用次数、频率、IP等限制!
提供的接口完全满足广大开发者的日常需求, 而且使用接口无需注册, 不需要key, 一行代码就可以搞定
curl "https://www.tianqiapi.com/api/?version=v1"
7日天气 / 15日天气 / 40日天气 / 全球天气 / 每小时预报 /
生活指数 / 空气质量 / 预警信息 / 机场天气 / 每日气象云图 /
白天天气 / 晚上天气 / 每日日出 / 每日日落 / 湿度 / 气压 等等
调用接口可选参数
cityid | String | 否 | 城市ID, 官网提供json和sql数据 |
city | String | 否 | 城市名称, 不要带市和区; 如: 青岛 , 微山 |
ip | String | 否 | IP所在城市天气, 默认返回当前IP地区天气 |
看一下预警信息字段, 类型, 等级, 详细内容
alarm: { alarm_type: "大风", alarm_level: "蓝色", alarm_content: "济南市气象台2019年04月03日16时00分发布大风蓝色预警信号:预计3日夜间至6日我市将出现大风天气,其中3日夜间至5日南风短时东北风4~5级阵风7级,6日北风4~5级阵风7级,森林火险等级极高。(预警信息来源:国家预警信息发布中心)" }
目前平台收集了14种天气图标素材供大家下载使用, 大家可以去官网下载
实况天气, 最近1小时左右天气, 返回字段很全很实用
{ cityid: "101120101", date: "2019-04-04", week: "星期四", update_time: "07:40", city: "济南", country: "China", wea: "晴", wea_img: "qing", tem: "15", win: "南风", win_speed: "3级", win_meter: "<12km/h", humidity: "52%", visibility: "17.68km", pressure: "997", air: "97", air_pm25: "97", air_level: "良", air_tips: "空气好,可以外出活动,除极少数对污染物特别敏感的人群以外,对公众没有危害!", alarm: { alarm_type: "大风", alarm_level: "蓝色", alarm_content: "济南市气象台2019年04月03日16时00分发布大风蓝色预警信号:预计3日夜间至6日我市将出现大风天气,其中3日夜间至5日南风短时东北风4~5级阵风7级,6日北风4~5级阵风7级,森林火险等级极高。(预警信息来源:国家预警信息发布中心)" } }
在看下7日天气接口返回的内容吧
{ cityid: "101110101", city: "西安", update_time: "2019-04-04 05:30:00", data: [ { day: "04日(星期四)", date: "2019-04-04", week: "星期四", wea: "晴", wea_img: "qing", wea_day: "晴", wea_night: "晴", tem1: "23", tem2: "9", win: [ "西南风", "西南风" ], win_speed: "<3级", sunrise: "06:29", sunset: "19:06", air: "54", air_level: "良", air_tips: "空气好,可以外出活动,除极少数对污染物特别敏感的人群以外,对公众没有危害!", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "11", win: "西南风", win_speed: "<3级" }, { hours: "09时", wea: "晴", tem: "13", win: "西南风", win_speed: "6-7级" }, { hours: "10时", wea: "晴", tem: "16", win: "西南风", win_speed: "6-7级" }, { hours: "11时", wea: "晴", tem: "18", win: "西南风", win_speed: "<3级" }, { hours: "12时", wea: "晴", tem: "20", win: "西南风", win_speed: "<3级" }, { hours: "13时", wea: "晴", tem: "21", win: "西南风", win_speed: "<3级" }, { hours: "14时", wea: "晴", tem: "22", win: "西南风", win_speed: "<3级" } ], index: [ { title: "紫外线指数", level: "中等", desc: "涂擦SPF大于15、PA+防晒护肤品。" }, { title: "减肥指数", level: "五颗星", desc: "小长假将至,突击甩肉忙。天气较舒适,快去运动吧。" }, { title: "血糖指数", level: "较易波动", desc: "血糖较易波动,注意监测。" }, { title: "穿衣指数", level: "较舒适", desc: "建议穿薄外套或牛仔裤等服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "中", desc: "易感人群应适当减少室外活动。" } ] }, { day: "05日(星期五)", date: "2019-04-05", week: "星期五", wea: "晴", wea_img: "qing", wea_day: "晴", wea_night: "晴", tem1: "27", tem2: "9", win: [ "西南风", "南风" ], win_speed: "3-4级转<3级", sunrise: "06:27", sunset: "19:06", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "12", win: "西南风", win_speed: "<3级" }, { hours: "09时", wea: "晴", tem: "16", win: "西南风", win_speed: "<3级" }, { hours: "10时", wea: "晴", tem: "19", win: "西南风", win_speed: "<3级" }, { hours: "11时", wea: "晴", tem: "22", win: "西南风", win_speed: "3-4级" }, { hours: "12时", wea: "晴", tem: "24", win: "西南风", win_speed: "3-4级" }, { hours: "13时", wea: "晴", tem: "26", win: "西南风", win_speed: "3-4级" }, { hours: "14时", wea: "晴", tem: "27", win: "西南风", win_speed: "3-4级" } ], index: [ { title: "紫外线指数", level: "强", desc: "涂擦SPF大于15、PA+防晒护肤品。" }, { title: "减肥指数", level: "三颗星", desc: "风有点大,可选择室内运动燃脂。" }, { title: "血糖指数", level: "较易波动", desc: "血糖较易波动,注意监测。" }, { title: "穿衣指数", level: "较舒适", desc: "建议穿薄外套或牛仔裤等服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "良", desc: "气象条件有利于空气污染物扩散。" } ] }, { day: "06日(星期六)", date: "2019-04-06", week: "星期六", wea: "晴", wea_img: "qing", wea_day: "晴", wea_night: "晴", tem1: "32", tem2: "12", win: [ "西南风", "北风" ], win_speed: "3-4级转<3级", sunrise: "06:26", sunset: "19:07", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "12", win: "南风", win_speed: "<3级" }, { hours: "09时", wea: "晴", tem: "16", win: "西南风", win_speed: "5-6级" }, { hours: "10时", wea: "晴", tem: "21", win: "西南风", win_speed: "4-5级" }, { hours: "11时", wea: "晴", tem: "26", win: "西南风", win_speed: "3-4级" }, { hours: "12时", wea: "晴", tem: "28", win: "西南风", win_speed: "3-4级" }, { hours: "13时", wea: "晴", tem: "29", win: "西南风", win_speed: "3-4级" }, { hours: "14时", wea: "晴", tem: "31", win: "西南风", win_speed: "3-4级" } ], index: [ { title: "紫外线指数", level: "很强", desc: "涂擦SPF20以上,PA++护肤品,避强光。" }, { title: "减肥指数", level: "一颗星", desc: "天热风大,可选择低强度运动。" }, { title: "血糖指数", level: "易波动", desc: "血糖易波动,注意监测。" }, { title: "穿衣指数", level: "炎热", desc: "建议穿短衫、短裤等清凉夏季服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "良", desc: "气象条件有利于空气污染物扩散。" } ] }, { day: "07日(星期日)", date: "2019-04-07", week: "星期日", wea: "晴转阴", wea_img: "yin", wea_day: "晴", wea_night: "阴", tem1: "31", tem2: "17", win: [ "东南风", "东北风" ], win_speed: "<3级转3-4级", sunrise: "06:25", sunset: "19:08", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "15", win: "北风", win_speed: "<3级" }, { hours: "11时", wea: "晴", tem: "23", win: "西南风", win_speed: "<3级" }, { hours: "14时", wea: "晴", tem: "30", win: "东南风", win_speed: "<3级" }, { hours: "17时", wea: "晴", tem: "27", win: "东风", win_speed: "<3级" }, { hours: "20时", wea: "晴", tem: "23", win: "东南风", win_speed: "<3级" }, { hours: "23时", wea: "多云", tem: "23", win: "东南风", win_speed: "3-4级" }, { hours: "02时", wea: "阴", tem: "20", win: "东北风", win_speed: "3-4级" } ], index: [ { title: "紫外线指数", level: "强", desc: "涂擦SPF大于15、PA+防晒护肤品。" }, { title: "减肥指数", level: "一颗星", desc: "天气有点热,运动多补水。" }, { title: "血糖指数", level: "易波动", desc: "血糖易波动,注意监测。" }, { title: "穿衣指数", level: "热", desc: "适合穿T恤、短薄外套等夏季服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "中", desc: "易感人群应适当减少室外活动。" } ] }, { day: "08日(星期一)", date: "2019-04-08", week: "星期一", wea: "阴转小雨", wea_img: "yin", wea_day: "阴", wea_night: "小雨", tem1: "26", tem2: "9", win: [ "东北风", "东北风" ], win_speed: "4-5级转3-4级", sunrise: "06:23", sunset: "19:09", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "阴", tem: "19", win: "东北风", win_speed: "3-4级" }, { hours: "11时", wea: "多云", tem: "22", win: "东风", win_speed: "4-5级" }, { hours: "14时", wea: "多云", tem: "26", win: "东北风", win_speed: "4-5级" }, { hours: "17时", wea: "多云", tem: "22", win: "东北风", win_speed: "4-5级" }, { hours: "20时", wea: "阴", tem: "19", win: "东北风", win_speed: "4-5级" }, { hours: "23时", wea: "小雨", tem: "14", win: "南风", win_speed: "4-5级" }, { hours: "02时", wea: "多云", tem: "12", win: "东北风", win_speed: "3-4级" } ], index: [ { title: "紫外线指数", level: "最弱", desc: "辐射弱,涂擦SPF8-12防晒护肤品。" }, { title: "减肥指数", level: "三颗星", desc: "风有点大,可选择室内运动燃脂。" }, { title: "血糖指数", level: "易波动", desc: "气温多变,血糖易波动,注意监测血糖变化。" }, { title: "穿衣指数", level: "较舒适", desc: "建议穿薄外套或牛仔裤等服装。" }, { title: "洗车指数", level: "不宜", desc: "有雨,雨水和泥水会弄脏爱车。" }, { title: "空气污染扩散指数", level: "良", desc: "气象条件有利于空气污染物扩散。" } ] }, { day: "09日(星期二)", date: "2019-04-09", week: "星期二", wea: "多云转晴", wea_img: "yun", wea_day: "多云", wea_night: "晴", tem1: "22", tem2: "13", win: [ "东北风", "东北风" ], win_speed: "<3级", sunrise: "06:22", sunset: "19:09", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "11", win: "东北风", win_speed: "<3级" }, { hours: "11时", wea: "多云", tem: "16", win: "东北风", win_speed: "<3级" }, { hours: "14时", wea: "多云", tem: "21", win: "东北风", win_speed: "<3级" }, { hours: "17时", wea: "晴", tem: "21", win: "东北风", win_speed: "<3级" }, { hours: "20时", wea: "晴", tem: "18", win: "东北风", win_speed: "<3级" }, { hours: "23时", wea: "晴", tem: "16", win: "东风", win_speed: "<3级" }, { hours: "02时", wea: "晴", tem: "15", win: "东北风", win_speed: "<3级" } ], index: [ { title: "紫外线指数", level: "弱", desc: "辐射较弱,涂擦SPF12-15、PA+护肤品。" }, { title: "减肥指数", level: "五颗星", desc: "天气较舒适,减肥正当时。" }, { title: "血糖指数", level: "较易波动", desc: "血糖较易波动,注意监测。" }, { title: "穿衣指数", level: "较舒适", desc: "建议穿薄外套或牛仔裤等服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "中", desc: "易感人群应适当减少室外活动。" } ] }, { day: "10日(星期三)", date: "2019-04-10", week: "星期三", wea: "晴", wea_img: "qing", wea_day: "晴", wea_night: "晴", tem1: "23", tem2: "9", win: [ "东北风", "东北风" ], win_speed: "<3级", sunrise: "06:21", sunset: "19:10", air: "", air_level: "", air_tips: "", alarm: { alarm_type: "", alarm_level: "", alarm_content: "" }, hours: [ { hours: "08时", wea: "晴", tem: "15", win: "东北风", win_speed: "<3级" }, { hours: "11时", wea: "晴", tem: "20", win: "东北风", win_speed: "<3级" }, { hours: "14时", wea: "晴", tem: "22", win: "东北风", win_speed: "<3级" }, { hours: "17时", wea: "晴", tem: "22", win: "东北风", win_speed: "<3级" }, { hours: "20时", wea: "晴", tem: "14", win: "东北风", win_speed: "<3级" }, { hours: "23时", wea: "晴", tem: "13", win: "东南风", win_speed: "<3级" }, { hours: "02时", wea: "晴", tem: "12", win: "东北风", win_speed: "<3级" } ], index: [ { title: "紫外线指数", level: "中等", desc: "涂擦SPF大于15、PA+防晒护肤品。" }, { title: "减肥指数", level: "五颗星", desc: "天气较舒适,减肥正当时。" }, { title: "血糖指数", level: "较易波动", desc: "血糖较易波动,注意监测。" }, { title: "穿衣指数", level: "较舒适", desc: "建议穿薄外套或牛仔裤等服装。" }, { title: "洗车指数", level: "较适宜", desc: "无雨且风力较小,易保持清洁度。" }, { title: "空气污染扩散指数", level: "中", desc: "易感人群应适当减少室外活动。" } ] } ] }
欢迎小伙伴们对接, 有问题联系网站技术QQ就可以了, 随时解答~
原文地址:https://www.cnblogs.com/ccjin/p/10652832.html
时间: 2024-10-29 10:22:54