Logo Computer scientist,
engineer, and educator
• Articles • Articles about computing • Utility corner

Cygwin logo

bbcweather — a simple command-line utility to retrieve and dump a BBC weather forecast feed

What is this?

bbcweather is a (very) simple command-line utility that dumps a 3-day weather forecast from the BBC Web site with minimal (or no) formatting. It retrieves the information as an RSS feed, parses the XML, and dumps the weather information to the console. The output it produces is lightly formatted (bold and underline) to make it more human-readable, but this formatting can be turned off, so the output can be fed into other scripts or applications.

This utility was written for use with Cygwin, but it builds cleanly on most Linux environments. It will also build under MinGW as a Windows console application, although the text highlighting probably won't work.

bbcweather is completely self-contained, including its own minimal XML parser, and builds into an executable only about 70 kB in size. It therefore loads effectively instantly, and is a much quicker way to get a brief weather forecast than starting a Web browser and looking at the BBC Web site (provided you don't mind using a command prompt).


When run without command-line arguments, bbcweather dumps a 3-day forecast for London, UK. The switch -o selects current observations rather than a forecast.

For other locations, use the -l {location} switch. This takes one of a (rather short) list of city names, or a numeric code. To get a list of supported city names, use bbcweather --list. So far as I know, the BBC does not publish a list of numeric location codes. These code can be found by using the BBC Web site to get a forecast for a specific location, and inspecting the URL used.

The --noemph switch turns off text formatting.

Sample output

$ bbcweather -l sheffield -o
BBC Weather - Observations for  Sheffield, United Kingdom

Wednesday - 20:00 GMT: Clear Sky, 2°C (36°F)
Temperature: 2°C (36°F), Wind Direction: North Westerly, Wind Speed:
9mph, Humidity: 66%, Pressure: 1018mb, Rising, Visibility: Very Good


Most obviously, the BBC could change the format of its weather feeds, or the URL of the feed server, at any time. In either of these eventualities, this utility will need to be modified.

The data in the weather feed is not parsed down into individual components (wind direction, precipitation, etc.) So although it would be easy to make crude changes to the output format (see output_rss in bbcweather.c), it would be difficult to make fine-grained modifications.

Legal, etc

bbcweather is copyright (c)2012 Kevin Boone, distributed according to the GNU Public Licence, version 2. In essence that means that you may do whatever you like with the software, at your own risk, provided that the original authorship remains clear. There is no warranty of any kind.


Source code
Cygwin binary
Copyright © 1994-2015 Kevin Boone. Updated Feb 07 2013