国外天气api 国际天气预报今天、未来3天、未来7天的天气预报信息接口
提供世界199个国家,5900多个城市的天气预报,包括今天、未来3天、未来7天的天气预报信息。
官方文档 https://www.tianqiapi.com/?action=v5
使用说明
1. 先注册一个账号, 获取到appid和appsecret
https://www.pyingquan.com/console/register
2. 获取接口数据
https://www.tianqiapi.com/api/?version=v5&cityid=601010100&appid=1001&appsecret=1046
接口说明
GET参数
参数 类型 必填 备注
appid String 是 账户ID
appsecret String 是 账户密钥
version String 是 接口标识, 固定值: v5
city String 是 城市名称 如: 堪培拉, 济南
cityid String 是 城市ID
callback String 否 jsonp参数, 如: jQuery.Callbacks
返回数据说明
参数名 说明
cityid 当前城市ID
country 国家
update_time 更新时间
tem1 高温
tem2 低温
wea 天气情况
wea_img 天气对应图标(xue, lei, shachen, wu, bingbao, yun, yu, yin, qing)
win 风向
win_speed 风速
hours 小时天气
返回json数据
{
"cityid":"601010100",
"city":"堪培拉",
"cityEn":"Canberra",
"country":"澳大利亚",
"countryEn":"Australia",
"update_time":"2019-04-28 11:30:00",
"data":[
{
"wea":"晴",
"wea_img":"qing",
"tem1":"17",
"tem2":"5",
"win":[
"西风",
"南风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"28日07时",
"wea":"晴",
"wea_img":"qing",
"tem":"3",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"28日10时",
"wea":"晴",
"wea_img":"qing",
"tem":"13",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"28日13时",
"wea":"晴",
"wea_img":"qing",
"tem":"15",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"28日16时",
"wea":"晴",
"wea_img":"qing",
"tem":"16",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"28日19时",
"wea":"晴",
"wea_img":"qing",
"tem":"10",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"28日22时",
"wea":"晴",
"wea_img":"qing",
"tem":"6",
"win":"西南风",
"win_speed":"<3级"
},
{
"hours":"29日01时",
"wea":"晴",
"wea_img":"qing",
"tem":"6",
"win":"南风",
"win_speed":"<3级"
},
{
"hours":"29日04时",
"wea":"晴",
"wea_img":"qing",
"tem":"5",
"win":"南风",
"win_speed":"<3级"
}
]
},
{
"wea":"晴",
"wea_img":"qing",
"tem1":"18",
"tem2":"5",
"win":[
"东风",
"东风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"29日07时",
"wea":"晴",
"wea_img":"qing",
"tem":"5",
"win":"南风",
"win_speed":"<3级"
},
{
"hours":"29日10时",
"wea":"晴",
"wea_img":"qing",
"tem":"12",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"29日13时",
"wea":"晴",
"wea_img":"qing",
"tem":"17",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"29日16时",
"wea":"晴",
"wea_img":"qing",
"tem":"17",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"29日19时",
"wea":"晴",
"wea_img":"qing",
"tem":"12",
"win":"东风",
"win_speed":"<3级"
},
{
"hours":"29日22时",
"wea":"晴",
"wea_img":"qing",
"tem":"9",
"win":"东风",
"win_speed":"<3级"
},
{
"hours":"30日01时",
"wea":"晴",
"wea_img":"qing",
"tem":"9",
"win":"东风",
"win_speed":"<3级"
},
{
"hours":"30日04时",
"wea":"晴",
"wea_img":"qing",
"tem":"9",
"win":"东北风",
"win_speed":"<3级"
}
]
},
{
"wea":"阴",
"wea_img":"yin",
"tem1":"21",
"tem2":"8",
"win":[
"北风",
"北风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"30日07时",
"wea":"晴",
"wea_img":"qing",
"tem":"8",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"30日10时",
"wea":"晴",
"wea_img":"qing",
"tem":"14",
"win":"北风",
"win_speed":"<3级"
},
{
"hours":"30日13时",
"wea":"阴",
"wea_img":"yin",
"tem":"19",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"30日16时",
"wea":"阴",
"wea_img":"yin",
"tem":"19",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"30日19时",
"wea":"阴",
"wea_img":"yin",
"tem":"14",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"30日22时",
"wea":"阴",
"wea_img":"yin",
"tem":"13",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"01日01时",
"wea":"阴",
"wea_img":"yin",
"tem":"13",
"win":"北风",
"win_speed":"<3级"
},
{
"hours":"01日04时",
"wea":"阴",
"wea_img":"yin",
"tem":"12",
"win":"西北风",
"win_speed":"<3级"
}
]
},
{
"wea":"阴",
"wea_img":"yin",
"tem1":"21",
"tem2":"11",
"win":[
"北风",
"东南风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"01日07时",
"wea":"阴",
"wea_img":"yin",
"tem":"12",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"01日10时",
"wea":"阴",
"wea_img":"yin",
"tem":"15",
"win":"北风",
"win_speed":"<3级"
},
{
"hours":"01日16时",
"wea":"阴",
"wea_img":"yin",
"tem":"21",
"win":"北风",
"win_speed":"<3级"
},
{
"hours":"01日22时",
"wea":"多云",
"wea_img":"yun",
"tem":"13",
"win":"北风",
"win_speed":"<3级"
},
{
"hours":"02日04时",
"wea":"多云",
"wea_img":"yun",
"tem":"12",
"win":"北风",
"win_speed":"<3级"
}
]
},
{
"wea":"阴转小雨",
"wea_img":"yu",
"tem1":"22",
"tem2":"12",
"win":[
"东北风",
"西北风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"02日10时",
"wea":"阴",
"wea_img":"yin",
"tem":"18",
"win":"东南风",
"win_speed":"<3级"
},
{
"hours":"02日16时",
"wea":"阴",
"wea_img":"yin",
"tem":"20",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"02日22时",
"wea":"阴",
"wea_img":"yin",
"tem":"15",
"win":"东北风",
"win_speed":"<3级"
},
{
"hours":"03日04时",
"wea":"小雨",
"wea_img":"yu",
"tem":"12",
"win":"东北风",
"win_speed":"<3级"
}
]
},
{
"wea":"小雨",
"wea_img":"yu",
"tem1":"22",
"tem2":"7",
"win":[
"西北风",
"西风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"03日10时",
"wea":"小雨",
"wea_img":"yu",
"tem":"15",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"03日16时",
"wea":"小雨",
"wea_img":"yu",
"tem":"20",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"03日22时",
"wea":"小雨",
"wea_img":"yu",
"tem":"11",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"04日04时",
"wea":"晴",
"wea_img":"qing",
"tem":"8",
"win":"西北风",
"win_speed":"<3级"
}
]
},
{
"wea":"小雨",
"wea_img":"yu",
"tem1":"16",
"tem2":"5",
"win":[
"西风",
"西南风"
],
"win_speed":"<3级",
"hours":[
{
"hours":"04日10时",
"wea":"中雨",
"wea_img":"yu",
"tem":"12",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"04日16时",
"wea":"小雨",
"wea_img":"yu",
"tem":"16",
"win":"西风",
"win_speed":"<3级"
},
{
"hours":"04日22时",
"wea":"小雨",
"wea_img":"yu",
"tem":"8",
"win":"西北风",
"win_speed":"<3级"
},
{
"hours":"05日04时",
"wea":"小雨",
"wea_img":"yu",
"tem":"6",
"win":"西北风",
"win_speed":"<3级"
}
]
}
]
}
————————————————
版权声明:本文为CSDN博主「Cc琎」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_38832501/article/details/89643384