X-Git-Url: http://git.scottworley.com/paperdoorknob/blobdiff_plain/8be20b9d36c49271ed392038750dfba981c283b6..372211762c57033dfef33075bd593ec5d426f3c7:/domfilter.py?ds=inline diff --git a/domfilter.py b/domfilter.py index 22f96a1..f00721d 100644 --- a/domfilter.py +++ b/domfilter.py @@ -10,9 +10,14 @@ from typing import Any, Callable, List, Tuple from bs4.element import Tag +def _changeTag(tag: Tag, new_name: str) -> Tag: + tag.name = new_name + return tag + + DOMFilters: List[Tuple[str, Callable[[Tag], Any]]] = [ - ("NoEdit", lambda x: [eb.decompose() for eb in x.find_all("div", class_="post-edit-box")]), - ("NoFooter", lambda x: [foot.decompose() for foot in x.find_all("div", class_="post-footer")]), + ("Strike", lambda x: [_changeTag(span, 's') + for span in x.find_all("span", style="text-decoration: line-through;")]), ]