Skip to content

Commit 1c46c5a

Browse files
committed
update tool
1 parent 3d7a68d commit 1c46c5a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: new.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import os
1717
import sys
1818
import json
19+
1920
import requests
21+
from bs4 import BeautifulSoup
2022

2123
TEMPLATE_FILE = './template.rs'
2224
PROBLEMS_URL = 'https://leetcode.com/api/problems/algorithms/'
@@ -86,7 +88,11 @@ def get_pid():
8688

8789

8890
def get_desc(problem):
89-
return problem.content
91+
return (BeautifulSoup(problem.content, features='html.parser')
92+
.get_text()
93+
.replace('\n\n', '\n')
94+
.replace('\n', '\n * ')
95+
)
9096

9197

9298
def parse_extra_use(code):

Diff for: requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
beautifulsoup4==4.7.1
12
certifi==2018.11.29
23
chardet==3.0.4
34
idna==2.8
45
requests==2.21.0
6+
soupsieve==1.8
57
urllib3==1.24.1

0 commit comments

Comments
 (0)