diff options
author | Nick White <git@njw.name> | 2021-02-05 15:12:14 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2021-02-05 15:20:07 +0000 |
commit | b2bb70e0a13f459e6b50c075e1be44309ba48918 (patch) | |
tree | af5240623e5aee80f7e48f66354e435320694f5e /README | |
parent | e346933cf5f3e2a652e89f3a3467c569b0330291 (diff) | |
download | weather-b2bb70e0a13f459e6b50c075e1be44309ba48918.tar.bz2 weather-b2bb70e0a13f459e6b50c075e1be44309ba48918.zip |
Add README and usage
Diffstat (limited to 'README')
-rw-r--r-- | README | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,44 @@ +# 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 + +It only makes one HTTPS request to a provider's json, using the +same URL structures that they use on their websites. + +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. |