Gather weatherdata from Yr.no with built using Deno with TS.
  • TypeScript 100%
Tim Hårek Andreassen bede14ec37
chore: Bump version
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
2023-02-04 22:36:24 +01:00
src chore: Bump version 2023-02-04 22:36:24 +01:00
.build.yml ci: Add email notification 2023-01-27 21:27:06 +01:00
.gitignore fix: Remove ignore of json 2023-01-17 22:00:41 +01:00
deno.json refactor: Simply display output 2023-02-03 23:16:11 +01:00
deno.lock fix: Allow jsonOutput 2023-02-04 14:44:57 +01:00
deps.ts chore: Add text output 2023-02-03 23:51:28 +01:00
LICENSE docs: Add a license 2022-03-07 21:11:56 +01:00
mod.d.ts feat: Add today command 2023-02-04 21:53:50 +01:00
mod.ts chore: Update examples 2023-02-04 15:02:58 +01:00
README.md chore: Update examples 2023-02-04 15:02:58 +01:00

sourcehut GitHub mirror Codeberg mirror

builds.sr.ht status

d-yr

Access Yr's weather API and Nominatim's names API for getting weather details about a specific location.

You can read more about the API's on met.yr.no and Nominatim.

This project has both a CLI and functions to access Yr.no's API.

Usage

Example for current weather

import { getCurrentWeather } from "https://deno.land/x/dyr/mod.ts";

const currentWeather = getCurrentWeather("Bergen");
// do what you need to do with the weather data.

Example for forecasted weather

import { getForecastedWeather } from "https://deno.land/x/dyr/mod.ts";

const location = "Bergen";
const hoursAhead = 5;
const jsonOutput = true; // The returned response as JSON

const currentWeather = getForecastedWeather(location, hoursAhead, jsonOutput);
// do what you need to do with the weather data.

CLI

Installation

deno install --allow-net=api.met.no,nominatim.openstreetmap.org \
  -n yr https://deno.land/x/dyr/src/cli.ts

You have now installed d-yr as yr.

Usage

Run the CLI with:

# Current weather forecast for location
yr current Bergen
# OR forecast for location
yr forecast Bangkok 5