On a rainy day here I wondered exactly when I should book a ticket up to Durham for another term. Most of the booking websites will help you, but not much: it’s tiresome to check a few days to see what the price variation is—and it can be fairly enormous. I was also curious as to what the long term trends might be: they don’t just seem to go down. All of which suggested some code to screenscrape all the tickets from somewhere and analyse them. It seems the national rail website encodes the query straight into the url (though not as an http query) and then sticks the results, in json, in the page served, presumably for some javascript to parse later. So all we need is to generate the url:
[Read More]Anything involving the straightforward writing of code, without worrying about what runs it later, ends up here.
I’m very much an amateur, and mostly write in Python, so be kind to me ;)