fix(api): Explicitly specficy html parser

This commit is contained in:
AaronBenDaniel
2025-06-10 10:58:42 -04:00
parent 1baeb3f975
commit b36dc92718
+2 -1
View File
@@ -10,13 +10,14 @@ from .vars import headers
def clean_tree(title: str, id: int, body: str) -> BeautifulSoup: def clean_tree(title: str, id: int, body: str) -> BeautifulSoup:
original_soup = BeautifulSoup(body) original_soup = BeautifulSoup(body, features="lxml")
new_soup = BeautifulSoup( new_soup = BeautifulSoup(
f""" f"""
<h1 class="chapter-title" id={id}>{title}</h1> <h1 class="chapter-title" id={id}>{title}</h1>
<section class="chapter-body"></section> <section class="chapter-body"></section>
""", """,
parser="html.parser", # head/body tags aren't generated parser="html.parser", # head/body tags aren't generated
features="lxml",
) )
insert_at = cast(Tag, new_soup.find("section")) insert_at = cast(Tag, new_soup.find("section"))