]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob.py
Replies
[paperdoorknob] / paperdoorknob.py
index b88c02d73e64a604763ad5c8ca8785055496d53f..0c6ec856b50377f1b895a2dfe2d9681badf93dba 100644 (file)
@@ -7,6 +7,9 @@
 
 from argparse import ArgumentParser
 import os.path
+
+from typing import Iterable
+
 from bs4 import BeautifulSoup
 from bs4.element import Tag
 import requests
@@ -25,6 +28,11 @@ class Post:
         assert isinstance(text, Tag)
         return text
 
+    def replies(self) -> Iterable[Tag]:
+        replies = self._html.find_all("div", class_="post-reply")
+        assert all(isinstance(r, Tag) for r in replies)
+        return replies
+
 
 def command_line_parser() -> ArgumentParser:
     parser = ArgumentParser(prog='paperdoorknob', description='Print glowfic')