diff --git a/books.py b/books.py index 47f77fe..8b56fa9 100644 --- a/books.py +++ b/books.py @@ -53,6 +53,12 @@ class MyChapter(Chapter): # return new element-tree return etree + def replace_images(self, image_dir: str, timeout: int = 10): + super().replace_images(image_dir, timeout) + for img in self.etree.xpath(".//img"): + if img.attrib["src"].startswith("http"): + img.getparent().remove(img) + def async_wrap(func): @wraps(func)