Fixed and finished the search function

This commit is contained in:
2025-12-31 17:57:57 +00:00
parent 53f1df5e86
commit 1f49db69c9
9 changed files with 360 additions and 214 deletions

View File

@@ -4,15 +4,11 @@ from bs4 import BeautifulSoup
def strip_html_tags(html):
soup = BeautifulSoup(html, "html.parser")
# Remove script and style elements completely
for tag in soup(["script", "style"]):
tag.decompose()
# Extract plain text
text = soup.get_text(separator="\n")
# Clean up whitespace
lines = [line.strip() for line in text.splitlines() if line.strip()]
return "\n".join(lines)