From 6839b2ebd71d1fb8c0c04cface59a963bd289916 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Fri, 27 Dec 2024 21:26:40 +0530 Subject: [PATCH] Update livemint.recipe cover --- recipes/livemint.recipe | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/recipes/livemint.recipe b/recipes/livemint.recipe index cc8511fba2..6b86d6e637 100644 --- a/recipes/livemint.recipe +++ b/recipes/livemint.recipe @@ -37,15 +37,11 @@ class LiveMint(BasicNewsRecipe): self.oldest_article = float(d) def get_cover_url(self): - today = date.today().strftime('%d/%m/%Y') - today = today.replace('/', '%2F') - raw = self.index_to_soup( - 'https://epaper.livemint.com/Home/GetAllpages?editionid=1&editiondate=' + today, - raw=True - ) - for cov in json.loads(raw): - if cov['NewsProPageTitle'].lower().startswith(('front', 'cover')): - return cov['HighResolution'] + soup = self.index_to_soup('https://epaper.livemint.com/') + cov = soup.findAll('img', attrs={'src': lambda x: x and x.startswith('/EPAPERIMAGES')}) + for x in cov: + if 'MINT_FRONT_1' in x['src']: + return 'https://epaper.livemint.com' + x['src'].replace('-S', '') extra_css = """ img {margin:0 auto;} @@ -149,6 +145,7 @@ class LiveMint(BasicNewsRecipe): ) if summ: summ['class'] = 'summary' + summ.name = 'p' for strong in soup.findAll('strong'): if strong.find('p'): strong.name = 'div'