Skip to content

Commit be38af9

Browse files
committed
fix problem slug and 404 bug
1 parent ace5f4b commit be38af9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/ojhtml2markdown.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ def content(self):
2424

2525

2626
def leet_lint_url(url):
27-
problem_slug = url.strip('/')[-1]
27+
problem_slug = url.strip('/').split('/')[-1]
2828
leetcode_url = 'https://leetcode.com/problems/{}/'.format(problem_slug)
2929
lintcode_url = 'http://www.lintcode.com/en/problem/{}/'.format(problem_slug)
3030
urls = {}
3131
for url in [leetcode_url, lintcode_url]:
3232
response = requests.head(url)
33-
if response.status_code == 200:
33+
print(response)
34+
if response.status_code != 404:
3435
if url.startswith('https://leetcode'):
3536
urls['leetcode'] = url
3637
elif url.startswith('http://www.lintcode'):
3738
urls['lintcode'] = url
39+
else:
40+
print(url)
3841
return urls
3942

4043

0 commit comments

Comments
 (0)