diff --git a/main.py b/main.py index f054537..c9fa5e1 100644 --- a/main.py +++ b/main.py @@ -46,16 +46,17 @@ def download(problem_num, url, title, solution_slug): driver.get(url) # Wait 30 secs or until div with class '_1l1MA' appears element = WebDriverWait(driver, 30).until( - EC.visibility_of_element_located((By.CLASS_NAME, "_1l1MA")) + EC.visibility_of_element_located((By.LINK_TEXT, title)) ) # Get current tab page source html = driver.page_source soup = bs4.BeautifulSoup(html, "html.parser") + problem_div = [item for item in soup.find_all() if "data-track-load" in item.attrs][0] # Construct HTML title_decorator = '*' * n problem_title_html = title_decorator + f'
{title}
' + '\n' + title_decorator - problem_html = problem_title_html + str(soup.find("div", {"class": "_1l1MA"})) + '



' + problem_html = problem_title_html + str(problem_div) + '



' # Append Contents to a HTML file with open("out.html", "ab") as f: