From 611370e719d3b014cd628855e1cddd2df1715d3b Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:16:40 +0530 Subject: [PATCH] Update livemint.recipe --- recipes/livemint.recipe | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/livemint.recipe b/recipes/livemint.recipe index 7147c72c78..c316b57250 100644 --- a/recipes/livemint.recipe +++ b/recipes/livemint.recipe @@ -83,7 +83,7 @@ class LiveMint(BasicNewsRecipe): return citem['content'] extra_css = ''' - img {display:block; margin:0 auto;} + img {margin:0 auto;} #img-cap {font-size:small; text-align:center;} .summary, .highlights, .synopsis { font-weight:normal !important; font-style:italic; color:#202020; @@ -128,6 +128,8 @@ class LiveMint(BasicNewsRecipe): ] def preprocess_raw_html(self, raw, *a): + # remove empty p tags + raw = re.sub(r'(

\s*)(<[^\/])', '\g<2>', re.sub(r'(

\s* \s*<\/p>)|(

\s*<\/p>)', '', raw)) if '' in raw: m = re.search(r'type="application/ld\+json">[^<]+?"@type": "NewsArticle"', raw) raw1 = raw[m.start():] @@ -137,8 +139,8 @@ class LiveMint(BasicNewsRecipe): body = data['articleBody'] + '

'\ + re.sub(r'(([a-z]|[^A-Z])\.|\.”)([A-Z]|“[A-Z])', r'\1

\3', value) body = '

' + body + '

' - raw = re.sub(r'
([^}]*)
', body, raw) - return raw + raw2 = re.sub(r'
([^}]*)
', body, raw) + return raw2 else: return raw