diff options
| author | Cormac Morris <cormacmorris@hotmail.com> | 2015-11-13 11:44:58 +0000 | 
|---|---|---|
| committer | Cormac Morris <cormacmorris@hotmail.com> | 2015-11-13 11:44:58 +0000 | 
| commit | ab7f0dac0ad052fc84290af79065bd7fb826ba35 (patch) | |
| tree | 4c37325ba060e3a4d7eedad6334a2494fb4e74f9 /updatebusinfo.py | |
| parent | 22d1aecb11f48838e8f61122b15da82ca6df7eb7 (diff) | |
Updated script to supports buses that use letters and numbers together. Also added support forHEADmaster
using more than one word to search bus stop name.
Diffstat (limited to 'updatebusinfo.py')
| -rw-r--r-- | updatebusinfo.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/updatebusinfo.py b/updatebusinfo.py index 3663d24..ffc38fc 100644 --- a/updatebusinfo.py +++ b/updatebusinfo.py @@ -2,13 +2,16 @@ 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' +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'): +	if id == '7a': +		bus = '/' + id + '/FALSE' +	else: +		bus = '/' + id.upper() + '/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') +	sys.stdout = open(id.upper() + '.txt', 'w')  	print table | 
