Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (21 sloc) 1.54 KB
SMS travel alerts using the website, the incredible BeautifulSoup parser and Twitter DMs that you can choose to have sent as SMS messages.
All you need are a few ruby gems, an oauth token and secret from and a cron job to periodically run the script
- install the twitter and rubyful_soup gems
- setup the .twitter file with your twitter auth details, an example file (dot-twitter-example) is provided
- setup the trains.yml file as required, an example file (trains-example.yml) is provided
- add an entry to your cron file to run the script as often as you'd like
- Early each weekday morning:
30 6 * * 1-5 /usr/bin/ruby /home/suttree/src/twitter/trainee/traintimes.rb >> /dev/null 2>&1
- On the hour, every hour:
@hourly /usr/bin/ruby /home/suttree/src/twitter/trainee/traintimes.rb >> /dev/null 2>&1
- Go to and register an application that you will use to send DMs, and subsequently SMSs, to yourself.
- Then edit your twitter mobile settings at
- Run once, add something about pin entry in the .twitter file too
- Note that the first time you try running this, you'll need to do the OAuth PIN dance. Once you have the relelvant authorisation code, add that to your .twitter file (see dot-twitter-example) to see how it's done. From then on, the script should run without any user intervention.
- A better html parser to only send alerts when the train is delayed, rather than every time it is listed as happens now.