From 594f59529ba5eed1ae9591b9a7b5f29eb7ef3b06 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 12 Jan 2023 14:23:00 +0100 Subject: [PATCH] Fix volume 7 --- books.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)