Skip to content

Commit d191583

Browse files
committed
Fix problem description not fetching due to markup change in leetcode
1 parent b36896b commit d191583

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

main.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ def download(problem_num, url, title, solution_slug):
4545

4646
driver.get(url)
4747
# Wait 20 secs or until div with id initial-loading disappears
48-
element = WebDriverWait(driver, 20).until(
49-
EC.invisibility_of_element_located((By.ID, "initial-loading"))
50-
)
48+
element = WebDriverWait(driver, 30).until(
49+
EC.visibility_of_element_located((By.CLASS_NAME, "_1l1MA")))
5150
# Get current tab page source
5251
html = driver.page_source
5352
soup = bs4.BeautifulSoup(html, "html.parser")
@@ -56,7 +55,7 @@ def download(problem_num, url, title, solution_slug):
5655
title_decorator = '*' * n
5756
problem_title_html = title_decorator + f'<div id="title">{title}</div>' + '\n' + title_decorator
5857
problem_html = problem_title_html + str(
59-
soup.find("div", {"class": "content__u3I1 question-content__JfgR"})) + '<br><br><hr><br>'
58+
soup.find("div", {"class": "_1l1MA"})) + '<br><br><hr><br>'
6059

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

0 commit comments

Comments
 (0)