summaryrefslogtreecommitdiff
path: root/README
blob: eb44f1e69b48636b48c6862916012c93b31a248c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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.