class Post:
def __init__(self, html: BeautifulSoup) -> None:
self._html = html
+ for eb in self._html.find_all("div", class_="post-edit-box"):
+ eb.decompose()
+ for footer in self._html.find_all("div", class_="post-footer"):
+ footer.decompose()
def text(self) -> Tag:
body = self._html.body
body = b'''<html>
<body>
<div class="post-container post-post">
+ <div class="post-edit-box">We don't want edit boxes</div>
This is glowfic
+ <div class="post-footer">We don't want footers</div>
</div>
<div class="flat-post-replies">
<div class="post-container post-reply">
+ <div class="post-edit-box">We don't want edit boxes</div>
You sure?
+ <div class="post-footer">We don't want footers</div>
</div>
<div class="post-container post-reply">
Pretty sure.