Weather Warnings Scraper
Overview
weatherwarnings
is a Go package that provides a utility for retrieving weather warnings from Met Éireann. It includes a function GetWarnings
that returns a slice of Warning
structs.
Installation
To use this package in your Go project, run:
go get -u github.com/JoeyTatu/weatherwarnings
Example usage:
package main
import (
"fmt"
"log"
"github.com/JoeyTatu/weatherwarnings"
)
func main() {
// Valid requests:
// weatherwarnings.GetWarnings("today")
// weatherwarnings.GetWarnings("tomorrow")
// weatherwarnings.GetWarnings("dayAfterTomorrow")
// weatherwarnings.GetWarnings() // defaults to "today"
weatherWarnings, err := weatherwarnings.GetWarnings("today")
if err != nil {
log.Fatal(err)
}
// Print or use the warnings as needed
for _, w := range weatherWarnings {
fmt.Printf("Title: %s\n", w.Title)
fmt.Printf("Description: %s\n", w.Description)
fmt.Printf("Valid: %s\n", w.Valid)
fmt.Printf("Issued: %s\n", w.Issued)
fmt.Println("-----------")
}
}