X-Git-Url: http://git.scottworley.com/paperdoorknob/blobdiff_plain/39db9a10878f8bac785178a85b2f548f4b24684b..62043b2bafbcb57beae7559235bd6984b6275b55:/glowfic.py?ds=inline diff --git a/glowfic.py b/glowfic.py index 065c715..8561cd7 100644 --- a/glowfic.py +++ b/glowfic.py @@ -89,13 +89,25 @@ def makeChunk(chunk_dom: Tag, image_store: ImageStore) -> Chunk: assert tag is None or isinstance(tag, Tag) return tag + def stripHREF(tag: Tag) -> None: + for c in tag.findChildren("a"): + if "href" in c.attrs: + del c.attrs["href"] + + def getMeta(css_class: str) -> Tag | None: + tag = getByClass(css_class) + if tag is None: + return None + stripHREF(tag) + return tag + content = chunk_dom.findChild('div', class_='post-content') assert isinstance(content, Tag) return Chunk(getIcon(), - getByClass('post-character'), - getByClass('post-screenname'), - getByClass('post-author'), + getMeta('post-character'), + getMeta('post-screenname'), + getMeta('post-author'), content)