DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How to Scrape Weather Data from Free APIs (Node.js)

Weather data is valuable for agriculture, logistics, and energy companies.

Open-Meteo (Best Free Option)

No API key needed:

async function getWeather(lat, lon) {
  const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true&hourly=temperature_2m`;
  const res = await fetch(url);
  return res.json();
}

const weather = await getWeather(40.71, -74.00); // NYC
console.log(weather.current_weather);
Enter fullscreen mode Exit fullscreen mode

Other Free Weather APIs

API Key Free Tier
Open-Meteo None Unlimited
OpenWeatherMap Required 1000 calls/day
WeatherAPI Required 1M calls/month
Visual Crossing Required 1000 results/day

Data Available

  • Current temperature, wind, humidity
  • Hourly and daily forecasts
  • Historical weather data
  • UV index, air quality
  • Sunrise/sunset times

Use Cases

  1. Agriculture planning
  2. Logistics and shipping
  3. Energy demand forecasting
  4. Event planning
  5. Insurance risk assessment

Resources


Need weather data at scale? $20. Email: Spinov001@gmail.com | Hire me

Top comments (0)