Back
Version 72
7/12/2024
// This script val fetches the current weather in Brooklyn using the OpenWeatherAPI.
// It pulls data in JSON format and parses it to extract relevant information.
export default async function() {
// OpenWeather doesn't require a key for fetching basic weather data
const lat = 40.6782;
const lon = -73.9442;
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}¤t_weather=true`;
// Fetching weather data
const response = await fetch(url);
const weatherData = await response.json();
// Returning current weather information
return weatherData;
}
Updated: July 12, 2024