]> git.scottworley.com Git - paperdoorknob/commitdiff
Strip edit-boxes and footers
authorScott Worley <scottworley@scottworley.com>
Fri, 24 Nov 2023 04:22:31 +0000 (20:22 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:37:10 +0000 (17:37 -0800)
paperdoorknob.py
paperdoorknob_test.py

index 6cc76a2f56d465fdf0c897b601dfbaa25dd86d03..fb2df1f1cc1c7443bc6e07018bad7148eb12a5c6 100644 (file)
@@ -21,6 +21,10 @@ from xdg_base_dirs import xdg_cache_home
 class Post:
     def __init__(self, html: BeautifulSoup) -> None:
         self._html = html
 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
 
     def text(self) -> Tag:
         body = self._html.body
index 5fe17797b26336cd3c70b1e60b4889fc29e9ffd5..7658cf424f82e5485cdcf6a160d821f0bb1654a5 100644 (file)
@@ -31,11 +31,15 @@ class FakeGlowficHTTPRequestHandler(BaseHTTPRequestHandler):
         body = b'''<html>
   <body>
     <div class="post-container post-post">
         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
       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>
     <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?
         You sure?
+        <div class="post-footer">We don't want footers</div>
       </div>
       <div class="post-container post-reply">
         Pretty sure.
       </div>
       <div class="post-container post-reply">
         Pretty sure.