From c66d1e5d1fdc48641743e953e0134a5318459a18 Mon Sep 17 00:00:00 2001 From: Cormac Morris Date: Mon, 9 Nov 2015 13:40:59 +0000 Subject: First instance of script --- updatebusinfo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 updatebusinfo.py (limited to 'updatebusinfo.py') diff --git a/updatebusinfo.py b/updatebusinfo.py new file mode 100644 index 0000000..3663d24 --- /dev/null +++ b/updatebusinfo.py @@ -0,0 +1,14 @@ +import sys +from bs4 import BeautifulSoup +import urllib2 + +for id in ('1', '1A', '1G', '2', '2A', '3', '4', '5', '7', '7a', '8', '9', '12', '13', '15', '16', '19', '21', '22', 'x22', '23', '28'): + bus = '/' + id + '/FALSE' + url = 'http://libertybus.je/routes_times/timetables' + bus + page = urllib2.urlopen(url) + soup = BeautifulSoup(page) + table = soup.findAll(['tr', 'h2']) + sys.stdout = open(id + '.txt', 'w') + print table + + -- cgit v1.2.3