https://github.com/timharek/d-yr
Access Yr's weather API and Nominatim's API with Deno
https://github.com/timharek/d-yr
deno deno-cli metno-locationforecast weather weather-api yrno
Last synced: 10 days ago
JSON representation
Access Yr's weather API and Nominatim's API with Deno
- Host: GitHub
- URL: https://github.com/timharek/d-yr
- Owner: timharek
- License: mit
- Created: 2022-03-07T20:11:07.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-01T18:54:19.000Z (12 months ago)
- Last Synced: 2025-05-06T09:04:03.415Z (12 days ago)
- Topics: deno, deno-cli, metno-locationforecast, weather, weather-api, yrno
- Language: TypeScript
- Homepage:
- Size: 162 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://deno.land/x/dyr)
[](https://jsr.io/@timharek/d-yr)
[](https://sr.ht/~timharek/d-yr)
[](https://github.com/timharek/d-yr)
[](https://codeberg.org/timharek/d-yr)[](https://builds.sr.ht/~timharek/d-yr)
# 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](https://api.met.no/weatherapi/locationforecast/2.0/documentation) and [Nominatim](https://nominatim.org/).
This project has both a CLI and functions to access Yr.no's API.
## Usage
### Example for current weather
```ts
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
```ts
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
```sh
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:
```sh
# Current weather forecast for location
yr current Bergen
# OR forecast for location
yr forecast Bangkok 5
```