def getCurYearSeason(): html = urlopenPath("home").read() soup = BeautifulSoup(html) for tag in soup.select("p > a"): if tag.get_text().lower() == "class schedule": path = tag.get("href") html = utils.urlopenUA("https://my.illinois.edu" + path) soup = BeautifulSoup(html) for tag in soup.select("a[href]"): url = tag.get("href") if url.startswith("https://courses.illinois.edu/cisapp/dispatcher/schedule/"): _, year, season = url.rsplit("/", 2) return (int(year), season) return None
def urlopenPath(path): if not path.startswith("/"): path = "/" + path return utils.urlopenUA("https://courses.illinois.edu/cisapp/dispatcher" + path)