Skip to content

Commit 5973b9e

Browse files
committed
utils: Reimplement striphtml with beautifulsoup
1 parent a8ff6c5 commit 5973b9e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

jsb/utils/url.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import urllib.error
1919
import urllib.parse
2020
import urllib.request
21+
from bs4 import BeautifulSoup
22+
2123

2224
from jsb.lib.errors import URLNotEnabled
2325

@@ -458,6 +460,6 @@ def handle_data(self, data):
458460

459461
def striphtml(txt):
460462
"""strip html from txt."""
461-
stripper = Stripper()
462-
txt = stripper.strip(txt)
463+
soup = BeautifulSoup(txt)
464+
txt = soup.get_text()
463465
return txt

0 commit comments

Comments
 (0)