Fixed get_course_by_tag name logic error (#14)

This commit is contained in:
Boyan 2024-11-21 11:17:10 +01:00
parent a1104522f1
commit 6a781ad238

View File

@ -53,11 +53,9 @@ class Year:
soup = BeautifulSoup(response.text, "lxml") soup = BeautifulSoup(response.text, "lxml")
title_element = soup.find("h1") title_elements = soup.find_all("a", class_="fill accent large")
if not title_element: if title_elements:
title_elements = soup.find_all("a", class_="fill accent large") title_element = title_elements[-1]
if title_elements:
title_element = title_elements[-1]
if title_element: if title_element:
course_title = title_element.get_text(strip=True) course_title = title_element.get_text(strip=True)