From 6da24d32a07506a7ea20fb923ffdbe15baaa2f3d Mon Sep 17 00:00:00 2001 From: Sophist Date: Sat, 8 Jul 2017 12:35:32 +0100 Subject: [PATCH 1/3] Correct local links to images --- recipes/private_eye.recipe | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/recipes/private_eye.recipe b/recipes/private_eye.recipe index 02798eca90..594ba5ab7d 100644 --- a/recipes/private_eye.recipe +++ b/recipes/private_eye.recipe @@ -235,6 +235,14 @@ It offers a unique blend of humour, social and political observations and invest return self.page_index + + def postprocess_html(self, soup, first): + for figure in soup.findAll('a', attrs = {'href' : lambda x: x and ('jpg' in x or 'png' in x or 'gif' in x)}): + # makes sure that the link points to the absolute web address + if figure['href'].startswith('/'): + figure['href'] = self.fix_url(figure['href']) + return soup + def postprocess_book(self, oeb, opts, log): m = oeb.metadata m.clear('title') From ab24e12d80aa422f32e9256b74fe7df65c94e4f8 Mon Sep 17 00:00:00 2001 From: Sophist Date: Sat, 8 Jul 2017 12:39:51 +0100 Subject: [PATCH 2/3] Pre-process not post-process --- recipes/private_eye.recipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/private_eye.recipe b/recipes/private_eye.recipe index 594ba5ab7d..f07571a297 100644 --- a/recipes/private_eye.recipe +++ b/recipes/private_eye.recipe @@ -236,7 +236,7 @@ It offers a unique blend of humour, social and political observations and invest return self.page_index - def postprocess_html(self, soup, first): + def preprocess_html(self, soup): for figure in soup.findAll('a', attrs = {'href' : lambda x: x and ('jpg' in x or 'png' in x or 'gif' in x)}): # makes sure that the link points to the absolute web address if figure['href'].startswith('/'): From 6144b1ec47d43be84072a538b2693793d83fd5f0 Mon Sep 17 00:00:00 2001 From: Sophist Date: Sat, 8 Jul 2017 12:40:30 +0100 Subject: [PATCH 3/3] Remove spurious blank line --- recipes/private_eye.recipe | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/private_eye.recipe b/recipes/private_eye.recipe index f07571a297..54d9b79dc9 100644 --- a/recipes/private_eye.recipe +++ b/recipes/private_eye.recipe @@ -235,7 +235,6 @@ It offers a unique blend of humour, social and political observations and invest return self.page_index - def preprocess_html(self, soup): for figure in soup.findAll('a', attrs = {'href' : lambda x: x and ('jpg' in x or 'png' in x or 'gif' in x)}): # makes sure that the link points to the absolute web address