diff --git a/uoftscrapers/scrapers/calendar/utm.py b/uoftscrapers/scrapers/calendar/utm.py index d5bd387..752cff7 100644 --- a/uoftscrapers/scrapers/calendar/utm.py +++ b/uoftscrapers/scrapers/calendar/utm.py @@ -4,14 +4,39 @@ import json import os import requests +import datetime +now = datetime.datetime.now() class UTMCalendar: - host = 'http://www.artsandscience.utoronto.ca/ofr/calendar/' + host1 = 'http://m.utm.utoronto.ca/importantDates.php?mode=full&session={0}5&header=' + host2 = 'http://m.utm.utoronto.ca/importantDates.php?mode=full&session={0}9&header=' @staticmethod - def scrape(location='.'): + def scrape(location='.', year=None): + year = year or now.year + Scraper.logger.info('UTMCalendar initialized.') - Scraper.logger.info('Not implemented.') - Scraper.logger.info('UTMCalendar completed.') + + html = Scraper.get(UTMCalendar.host1.format(year)) + soup = BeautifulSoup(html, 'html.parser') + content = soup.find('div', class_='content') + dates = content.find_all('div', class_='title') + i = 0 + currentDate = dates[i] + while(i=len(dates)): + break; + if(i