Skip to content

Commit 934b169

Browse files
committed
replace url with title slugs
1 parent c7ddac8 commit 934b169

File tree

2 files changed

+174
-176
lines changed

2 files changed

+174
-176
lines changed

cron/update_questions.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@
2424
print("Updating question metadata")
2525

2626
for question in questions["data"]:
27-
p = urlparse(question["url"])
28-
title_slug = p.path.rstrip('/').split('/')[-1]
29-
our_difficulty = question["difficulty"]
30-
variables = {"titleSlug": title_slug}
27+
variables = {"titleSlug": question["url"]}
3128

3229
response = requests.post("https://leetcode.com/graphql",
3330
json={"query": query, "variables": variables}
3431
)
3532

33+
our_difficulty = question["difficulty"]
3634
leetcode_difficulty = response.json()["data"]["question"]["difficulty"]
3735

3836
if leetcode_difficulty != our_difficulty:

0 commit comments

Comments
 (0)