Skip to content

Commit

Permalink
adjust to new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Dec 6, 2023
1 parent 1970d9a commit 0311f27
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions update_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@
html = requests.get(url, verify=False, timeout=30)
soup = BeautifulSoup(html.content, "html.parser")
title = soup.find("h1").text
metas = soup.find_all("div", class_="metadata_list-item")
difficulty = [
item
for item in metas
if item.attrs.get("data-name") == "metadata_item-difficulty"
][0]
difficulty = difficulty.text.split()[-1]
score, level = difficulty[:3], difficulty[3:]
metas = soup.find("div", class_="metadata-difficulty-card")
difficulty = metas.text[: -len("Difficulty")]
if "-" not in difficulty:
score, level = difficulty[:3], difficulty[3:]
else:
score, level = difficulty[6:9], difficulty[9:]
cache[name] = (title, score, level)

total = len(solutions)
Expand Down

0 comments on commit 0311f27

Please sign in to comment.