Skip to content

Commit

Permalink
Parse current enrolment, include count in result
Browse files Browse the repository at this point in the history
  • Loading branch information
kashav committed Sep 2, 2016
1 parent cd668fd commit ee95cf9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions uoftscrapers/scrapers/courses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def scrape(location='.'):
worker.start()

Scraper.logger.info('Queued %d courses.' % total)
for x in urls:
for x in urls[:10]:
course_id = re.search('offImg(.*)', x[0]).group(1).split('"')[0]
url = '%s/courseSearch/coursedetails/%s' % (
Courses.host,
Expand Down Expand Up @@ -183,6 +183,11 @@ def parse_course_html(course_id, html):

class_size = tds[4].get_text().strip()

try:
current_enrolment = tds[5].get_text().strip()
except (IndexError, AttributeError) as e:
current_enrolment = 0

time_data = []
for i in range(len(times)):
info = times[i].split(" ")
Expand Down Expand Up @@ -215,7 +220,7 @@ def parse_course_html(course_id, html):
("instructors", instructors),
("times", time_data),
("size", int(class_size)),
("enrolment", 0)
("enrolment", int(current_enrolment))
])

sections.append(data)
Expand Down

0 comments on commit ee95cf9

Please sign in to comment.