baidu-weather-query

Fetches China weather data by district code or coordinates via JSON.

23|4|Updated May 7, 2026
One-click install
npx skills add https://github.com/qq5855144/GitHubM --skill baidu-weather-query
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baidu-weather-query
Source: https://github.com/qq5855144/GitHubM/tree/main/.skills/baidu-weather-query
Command: npx skills add https://github.com/qq5855144/GitHubM --skill baidu-weather-query

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

解决需要反复查询百度地图天气接口、处理不同定位方式和响应结构的开发工作,让应用快速获取国内城市或坐标位置的实时天气与预报。

Core Features & Use Cases

  • 支持按行政区划代码查询实时天气和未来7天预报,适合城市天气卡片、出行提醒和管理后台。
  • 支持按经纬度查询实时天气、未来7天预报和24小时逐小时预报,适合定位天气、地图应用和移动端场景。
  • 提供前后端调用示例、Edge Function 代理方式和错误处理建议,便于在 Web 或 MiniProgram 中稳定接入。

Quick Start

请根据用户提供的行政区划代码或经纬度,调用对应天气接口并返回实时天气、7天预报以及经纬度场景下的24小时逐小时预报。

Frequently Asked Questions about baidu-weather-query

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get real-time weather and 7-day forecasts using Baidu Maps API?

Fetch real-time weather and 7-day forecasts using Baidu Maps API by sending GET requests with either a district code or latitude-longitude parameters. The response requires JSON parsing of location, now, and forecasts fields to retrieve current conditions and short-term predictions.

Can I query weather data by latitude and longitude for location-aware mini programs?

Yes, you can query weather data by latitude and longitude for location-aware mini programs. This method returns real-time conditions, 7-day forecasts, and 24-hour hourly predictions, making it ideal for mobile apps and geolocation-based services.

Does the Baidu weather API support Edge Functions for proxying requests?

The Baidu weather API supports Edge Functions for proxying requests. The Skill provides frontend and backend examples, including Edge Function proxy methods and error handling suggestions, ensuring stable integration in Web or mini program environments.

What's the best way to integrate a city weather dashboard using district codes?

Integrate a city weather dashboard by querying the Baidu weather API with administrative district codes. This approach retrieves real-time weather and 7-day forecasts, fitting city weather cards, travel reminders, and management backends without needing geolocation data.

Do I need platform_managed authorization to fetch domestic China weather data?

Yes, platform_managed authorization is required to fetch domestic China weather data. GET requests must include this authorization alongside district_id or latitude-longitude parameters to successfully retrieve and parse location, now, and forecast response fields.

Why does my Baidu weather API request return parsing errors for hourly forecasts?

Baidu weather API request parsing errors for hourly forecasts occur when response fields like location, now, forecasts, and hourly are not correctly mapped. Ensure proper JSON parsing of these specific fields, as hourly data is only available for latitude-longitude queries.