From 536fb6ff4fdd295423b4b6d42b74a3e901282061 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 3 Oct 2022 07:56:51 +0530 Subject: [PATCH] Add cover to Guardian/Observer --- recipes/guardian.recipe | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/recipes/guardian.recipe b/recipes/guardian.recipe index 2ee68b031b..20113aad55 100644 --- a/recipes/guardian.recipe +++ b/recipes/guardian.recipe @@ -89,6 +89,21 @@ class Guardian(BasicNewsRecipe): br = BasicNewsRecipe.get_browser(self, *a, **kw) return br + def get_cover_url(self): + coverdate = date.today() + if 'observer' in self.base_url: + cover = ( + 'https://www.thepaperboy.com/frontpages/archive/The_Observer_' + + str(coverdate.day) + '_' + str(coverdate.month) + '_' + + str(coverdate.year) + '_400.jpg') + else: + cover = ( + 'https://www.thepaperboy.com/frontpages/archive/The_Guardian_' + + str(coverdate.day) + '_' + str(coverdate.month) + '_' + + str(coverdate.year) + '_400.jpg') + + return cover + def parse_section(self, url, title_prefix=''): feeds = [] soup = self.index_to_soup(url)