Deno module for accessing Yr. Also has a CLI-tool
This repository has been archived on 2026-09-09. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tim Hårek Andreassen b6a486bbd8
ci: Simplify
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
2024-06-01 20:53:56 +02:00
src refactor: Use nominatim module 2024-05-14 16:57:45 +02:00
.build.yml ci: Simplify 2024-06-01 20:53:56 +02:00
.gitignore fix: Remove ignore of json 2023-01-17 22:00:41 +01:00
deno.json chore(release): Bump version 2024-05-14 16:58:03 +02:00
deno.lock refactor: Use nominatim module 2024-05-14 16:57:45 +02:00
deps.ts refactor: Use nominatim module 2024-05-14 16:57:45 +02:00
LICENSE docs: Add a license 2022-03-07 21:11:56 +01:00
mod.d.ts refactor: Move types 2023-10-06 22:25:51 +02:00
mod.ts refactor: Use nominatim module 2024-05-14 16:57:45 +02:00
README.md chore: Prepare for JSR 2024-05-14 12:49:39 +02:00

Latest version JSR 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 { getCurrent } from "jsr:@timharek/d-yr";

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

Example for forecasted weather

import { getForecast } from "jsr:@timharek/d-yr";

const location = "Bergen";
const hoursAhead = 5;

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

CLI

Installation

deno install --allow-net=api.met.no,nominatim.openstreetmap.org \
  -n yr jsr:@timharek/d-yr/cli

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