docs: 会议室架构规划 + MSN hourlyforecast 端点更新
- 新增 docs/会议室架构计划书.md 完整架构方案(主持者+子Agent+task+cache+记忆) - 更新 taolun.md 追加 2026-05-11 讨论历史 - 更新 AGENTS.md 规范(type, cache 字段) - 更新 architecture.md 后续演进章节 - 更新 changelog.md 架构规划里程碑 - 修复 MSN 天气接口文档:新增 hourlyforecast,标记 weathertrends 已失效 - 更新 skills/msn-weather-api/SKILL.md 新增 hourlyforecast 端点 - 更新 agents/weather-agent.md 支持逐小时查询
This commit is contained in:
@@ -19,13 +19,14 @@
|
||||
|
||||
| 接口 | URL | 功能 | 稳定性 |
|
||||
|------|-----|------|--------|
|
||||
| **当前天气** | `https://assets.msn.cn/service/weather/current` | 获取实时天气 | ✅ 稳定可用 |
|
||||
| **每日预报** | `https://assets.msn.cn/service/weather/dailyforecast` | 未来10天预报 | ✅ 稳定可用 |
|
||||
| **天气趋势** | `https://assets.msn.cn/service/weather/weathertrends` | 历史+趋势+日历 | ✅ 可用(参数复杂) |
|
||||
| **当前天气** | `https://assets.msn.cn/service/weather/current` | 获取实时天气+nowcasting | ✅ 稳定可用 |
|
||||
| **逐小时预报** | `https://assets.msn.cn/service/weather/hourlyforecast` | 未来10天逐小时预报 | ✅ 稳定可用(新增) |
|
||||
| **每日预报** | `https://assets.msn.cn/service/weather/dailyforecast` | 未来10天每日汇总 | ✅ 稳定可用 |
|
||||
| **天气趋势** | `https://assets.msn.cn/service/weather/weathertrends` | 历史+趋势+日历 | ❌ 已失效(500错误) |
|
||||
| api.msn.cn 当前 | `https://api.msn.cn/weather/current` | 用城市名获取 | ✅ 可用(但城市名不准) |
|
||||
| api.msn.cn 预报 | `https://api.msn.cn/weather/forecast` | 预报 | ❌ 500错误 |
|
||||
|
||||
**推荐**:只用 `assets.msn.cn` 的两个接口即可满足大部分需求。
|
||||
**推荐**:只用 `assets.msn.cn` 的三个接口(current + hourlyforecast + dailyforecast)即可满足大部分需求。
|
||||
|
||||
---
|
||||
|
||||
@@ -90,6 +91,16 @@ foreach ($day in $days) {
|
||||
$d = $day.daily
|
||||
Write-Host " $($d.valid.ToString().Substring(0,10)): $($d.tempLo)-$($d.tempHi)C, 降水$($d.precip)%, 风速$($d.windMax)km/h"
|
||||
}
|
||||
|
||||
# 获取逐小时预报(今天剩余小时 + 后续几天)
|
||||
$uri_hourly = "https://assets.msn.cn/service/weather/hourlyforecast?apiKey=$apiKey&lat=39.904172&lon=116.407417&units=C&locale=zh-cn"
|
||||
$hourlyResp = Invoke-RestMethod -Uri $uri_hourly -Headers $headers
|
||||
$todayHourly = $hourlyResp.value[0].responses[0].weather[0].days[0].hourly
|
||||
|
||||
Write-Host "`n今天逐小时预报:"
|
||||
foreach ($h in $todayHourly) {
|
||||
Write-Host " $($h.valid.ToString("HH:mm")): $($h.temp)C, $($h.cap), 体感$($h.feels)C, 降水$($h.precip)%, 湿度$($h.rh)%, 风速$($h.windSpd)km/h"
|
||||
}
|
||||
```
|
||||
|
||||
### curl 示例
|
||||
@@ -104,6 +115,11 @@ curl -H "User-Agent: Mozilla/5.0" \
|
||||
curl -H "User-Agent: Mozilla/5.0" \
|
||||
-H "Referer: https://www.msn.com/zh-cn/weather" \
|
||||
"https://assets.msn.cn/service/weather/dailyforecast?apiKey=j5i4gDqHL6nGYwx5wi5kRhXjtf2c5qgFX9fzfk0TOo&lat=39.904172&lon=116.407417&units=C&locale=zh-cn&days=7"
|
||||
|
||||
# 逐小时预报(今天剩余+未来几天)
|
||||
curl -H "User-Agent: Mozilla/5.0" \
|
||||
-H "Referer: https://www.msn.com/zh-cn/weather" \
|
||||
"https://assets.msn.cn/service/weather/hourlyforecast?apiKey=j5i4gDqHL6nGYwx5wi5kRhXjtf2c5qgFX9fzfk0TOo&lat=39.904172&lon=116.407417&units=C&locale=zh-cn"
|
||||
```
|
||||
|
||||
---
|
||||
@@ -180,6 +196,52 @@ curl -H "User-Agent: Mozilla/5.0" \
|
||||
}
|
||||
```
|
||||
|
||||
### hourlyforecast 接口响应
|
||||
|
||||
```json
|
||||
{
|
||||
"@odata.context": "api.msn.com/weather/$metadata#hourlyforecast",
|
||||
"value": [{
|
||||
"responses": [{
|
||||
"weather": [{
|
||||
"days": [
|
||||
{
|
||||
// days[0] = 今天,从当前小时开始到23点
|
||||
// days[1..9] = 未来9天,每天24个整点
|
||||
"hourly": [
|
||||
{
|
||||
"valid": "2026-05-11T07:00:00+08:00", // 时间
|
||||
"temp": 19.0, // 温度 °C
|
||||
"feels": 23.0, // 体感温度 °C
|
||||
"cap": "晴", // 天气描述
|
||||
"precip": 0.0, // 降水概率 %
|
||||
"rh": 61.0, // 相对湿度 %
|
||||
"baro": 1009.0, // 气压 hPa
|
||||
"windSpd": 4.0, // 风速 km/h
|
||||
"windDir": 355, // 风向(度)
|
||||
"windGust": 18.0, // 阵风 km/h
|
||||
"uv": 1.0, // 紫外线指数
|
||||
"cloudCover": 6.0, // 云量 %
|
||||
"vis": 10.0, // 能见度 km
|
||||
"dewPt": 11.0, // 露点 °C
|
||||
"rainAmount": 0.0, // 降雨量 mm
|
||||
"snowAmount": 0.0, // 降雪量 mm
|
||||
"icon": 1, // 图标代码
|
||||
"symbol": "d000", // 天气符号
|
||||
"sky": "CLR" // 天空状况代码
|
||||
}
|
||||
// ... 更多小时
|
||||
]
|
||||
}
|
||||
]
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
> **注意**:`days[0].daily` 为 null(今天尚未结束),逐小时数据从 `days[0].hourly` 获取。
|
||||
|
||||
---
|
||||
|
||||
## 六、多城市验证结果
|
||||
@@ -246,15 +308,21 @@ function Get-MSNWeather {
|
||||
$forecastUri = "https://assets.msn.cn/service/weather/dailyforecast?apiKey=$apiKey&lat=$Lat&lon=$Lon&units=C&locale=$Locale&days=7"
|
||||
$forecast = Invoke-RestMethod -Uri $forecastUri -Headers $headers
|
||||
|
||||
# 逐小时预报
|
||||
$hourlyUri = "https://assets.msn.cn/service/weather/hourlyforecast?apiKey=$apiKey&lat=$Lat&lon=$Lon&units=C&locale=$Locale"
|
||||
$hourly = Invoke-RestMethod -Uri $hourlyUri -Headers $headers
|
||||
|
||||
return @{
|
||||
Current = $current.value[0].responses[0].weather[0].current
|
||||
Forecast = $forecast.value[0].responses[0].weather[0].days
|
||||
Hourly = $hourly.value[0].responses[0].weather[0].days
|
||||
}
|
||||
}
|
||||
|
||||
# 使用示例
|
||||
$weather = Get-MSNWeather -Lat 39.904172 -Lon 116.407417
|
||||
$weather.Current.temp # 当前温度
|
||||
$weather.Hourly[0].hourly # 今天逐小时数据
|
||||
```
|
||||
|
||||
---
|
||||
@@ -290,8 +358,15 @@ http://img-s-msn-com.akamaized.net/tenant/amp/entityid/AAehR3S.img
|
||||
| 是否有免费 API | ✅ 有(非公开内部接口) |
|
||||
| 国内速度 | ✅ 快(msn.cn 国内节点) |
|
||||
| 稳定性 | ⚠️ 未知(非官方,随时可能变) |
|
||||
| 数据完整性 | ✅ 完整(当前+预报+AQI+紫外线等) |
|
||||
| 数据完整性 | ✅ 完整(当前+逐小时+每日预报+AQI+紫外线+nowcasting) |
|
||||
| 推荐用途 | 个人项目、内部工具、原型开发 |
|
||||
| 不推荐用途 | 商业产品、长期运行服务 |
|
||||
|
||||
## 现状更新
|
||||
|
||||
**2026-05-11 更新:**
|
||||
- `weathertrends` 接口已失效(500 Internal Server Error)
|
||||
- 新发现 `hourlyforecast` 接口,提供未来 10 天逐小时预报数据,与 `current`、`dailyforecast` 同样稳定
|
||||
- 云图(卫星/雷达)无 REST API 可用,MSN 网页使用 tile 图片服务(`assets.msn.com/weathermapdata/`),不适合程序化调用
|
||||
|
||||
**建议**:如果用于生产环境,推荐同时准备备用方案(如和风天气、OpenWeatherMap 等)。
|
||||
|
||||
Reference in New Issue
Block a user