diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 72 |
1 files changed, 41 insertions, 31 deletions
@@ -1,31 +1,41 @@ -# njw.name/weather package - -This package is a command that prints the weather forecast for a -location, using either the Met Office or BBC as a source. - -This is a Go package, and can be installed in the standard go way, -by running `git clone https://git.njw.name/bbcschedule` and -`go install .` from the bbcschedule directory. - -Note that the location must be set manually from the Go code, see -`metdefid` and `bbcdefid`. Relatedly, note that this was the first -Go program I wrote. Look elsewhere for examples of best practise. - -## Usage - - Usage: weather [-b] [-n int] [-v] - - -b use bbc as data source (default true) - -n int - number of days to show (default 2) - -v verbose: show all weather details - -## Contributions - -Any and all comments, bug reports, patches or pull requests would -be very welcomely received. Please email them to <git@njw.name>. - -## License - -This package is licensed under the GPLv3. See the LICENSE file for -more details. +# Weather - a simple tool to look up weather forecasts + +Weather is far faster than any browser based forecast request; +the weather websites nowadays are so full of surveillance +that each forecast takes around 650KB for Met Office or +8MB for BBC. Much better to just make a single request for the +forecast data in JSON format and display it, which is what this +tool does. + +Weather currently requires a location ID for the location to look +up. The defaults are hardcoded at the top of weather.go (bbcdefid +and metdefid), and I encourage you to set them to your own home +location. Otherwise, you can set the location ID with an argument +to the program. + +## Finding your location ID + +The Met Office and BBC weather providers each use different IDs, +but each are easy to discover. + +For the BBC, go to the forecast page for your location and the +ID is the final part of the page URL, for example 2653266 is the +location ID for Chelmsford, which has this page on the BBC website: +https://www.bbc.com/weather/2653266. You could also look it up with +their JSON location service, using the 'containerId' field from a +request like this: +https://open.live.bbc.co.uk/locator/locations?s=chelmsford&format=json + +For the Met Office, look up your location and use the ID from the +'nearestSspaId' field from this URL, substituting "Chelmsford" +for the location you want: +https://www.metoffice.gov.uk/plain-rest-services/location-search/Chelmsford/?max=5 + +## Notes + +Weather doesn't use any API keys or anything silly like that, +instead relying on the URLs the organisations use with their own +Javascript. + +The Met Office unfortunately forbids requests through tor, but BBC +allow them. |