Added BeautifulSoup to html2text function

This commit is contained in:
2023-09-13 23:46:11 +04:00
parent b74bac45f5
commit fc0551f7dc
3 changed files with 34 additions and 7 deletions

View File

@@ -1,9 +1,6 @@
import re
from bs4 import BeautifulSoup
def html2text(html: str) -> str:
return re.sub(
re.compile('<.*?>'),
'',
html
)
soup = BeautifulSoup(html, 'html.parser')
return soup.get_text()