[+] courseinfo: Remove duplicate course codes from course name
This commit is contained in:
@@ -7,6 +7,7 @@ def get_course_info(id: str):
|
|||||||
link = f'https://artsci.calendar.utoronto.ca/course/{id}'
|
link = f'https://artsci.calendar.utoronto.ca/course/{id}'
|
||||||
html = requests.get(link).text
|
html = requests.get(link).text
|
||||||
name: str = re.findall(r'(?<=<h1 class="title page-title">).*(?=<)', html)[0]
|
name: str = re.findall(r'(?<=<h1 class="title page-title">).*(?=<)', html)[0]
|
||||||
|
name = ': '.join(name.split(': ')[1:])
|
||||||
hours: str = re.findall(r'(?<=<div class="field__item"><p>).*(?=<)', html)[0]
|
hours: str = re.findall(r'(?<=<div class="field__item"><p>).*(?=<)', html)[0]
|
||||||
hours = '/'.join([str(int(it[:-1]) / 12) + it[-1] for it in hours.split('/')])
|
hours = '/'.join([str(int(it[:-1]) / 12) + it[-1] for it in hours.split('/')])
|
||||||
return {'id': id, 'name': name, 'link': link, 'hours': hours,
|
return {'id': id, 'name': name, 'link': link, 'hours': hours,
|
||||||
|
|||||||
Reference in New Issue
Block a user