Add cover to Guardian/Observer

This commit is contained in:
Kovid Goyal 2022-10-03 07:56:51 +05:30
parent 5808b696a7
commit 536fb6ff4f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -89,6 +89,21 @@ class Guardian(BasicNewsRecipe):
br = BasicNewsRecipe.get_browser(self, *a, **kw) br = BasicNewsRecipe.get_browser(self, *a, **kw)
return br 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=''): def parse_section(self, url, title_prefix=''):
feeds = [] feeds = []
soup = self.index_to_soup(url) soup = self.index_to_soup(url)