From 93d092e8ea05a6c1ae38de0520385cd8fd5df811 Mon Sep 17 00:00:00 2001 From: Hanchen Wang Date: Tue, 19 Apr 2016 19:34:50 -0400 Subject: [PATCH] Use campus tag instead of the full name --- uoftscrapers/scrapers/events/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uoftscrapers/scrapers/events/__init__.py b/uoftscrapers/scrapers/events/__init__.py index 492944e..b52b92c 100644 --- a/uoftscrapers/scrapers/events/__init__.py +++ b/uoftscrapers/scrapers/events/__init__.py @@ -10,6 +10,8 @@ class Events: """A scraper for Events at the University of Toronto.""" host = 'https://www.events.utoronto.ca/' + campuses_tags = {'St. George': 'UTSG', 'U of T Mississauga': 'UTM', 'U of T Scarborough': 'UTSC'} + @staticmethod def scrape(location='.'): Scraper.logger.info('Events initialized.') @@ -74,7 +76,8 @@ def get_event_doc(url_tail): event_campus = '' if evt_bar.select('dd')[0].b != None: - event_campus = evt_bar.select('dd')[0].b.text + campus_full_name = evt_bar.select('dd')[0].b.text + event_campus = Events.campuses_tags[campus_full_name] event_address = '' address_block = evt_bar.select('dd')[0]