From: Scott Worley Date: Fri, 24 Nov 2023 04:22:31 +0000 (-0800) Subject: Strip edit-boxes and footers X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/170e50a0efa18ed0f5f2ff644793469894983029?ds=sidebyside;hp=55958ec0820a10472e5091b105d730fa38172390 Strip edit-boxes and footers --- diff --git a/paperdoorknob.py b/paperdoorknob.py index 6cc76a2..fb2df1f 100644 --- a/paperdoorknob.py +++ b/paperdoorknob.py @@ -21,6 +21,10 @@ from xdg_base_dirs import xdg_cache_home 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 diff --git a/paperdoorknob_test.py b/paperdoorknob_test.py index 5fe1779..7658cf4 100644 --- a/paperdoorknob_test.py +++ b/paperdoorknob_test.py @@ -31,11 +31,15 @@ class FakeGlowficHTTPRequestHandler(BaseHTTPRequestHandler): body = b'''
+
We don't want edit boxes
This is glowfic +
+
We don't want edit boxes
You sure? +
Pretty sure.