From 87a0130f14e226c3fe0cd0246dfdcaa5f05ce4a7 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:35:47 +0530 Subject: [PATCH] Update Project Syndicate --- recipes/financial_times.recipe | 2 ++ recipes/livemint.recipe | 5 ++++- recipes/project_syndicate.recipe | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/recipes/financial_times.recipe b/recipes/financial_times.recipe index 61f05d7284..ad9a8e639c 100644 --- a/recipes/financial_times.recipe +++ b/recipes/financial_times.recipe @@ -132,4 +132,6 @@ class ft(BasicNewsRecipe): for con in soup.findAll(attrs={'class':'n-content-layout__slot'}): if con.find('figure'): con['id'] = 'fig' + if h3 := soup.find(**classes('o-topper__standfirst')): + h3.name = 'h3' return soup diff --git a/recipes/livemint.recipe b/recipes/livemint.recipe index 3831728eb4..675981205b 100644 --- a/recipes/livemint.recipe +++ b/recipes/livemint.recipe @@ -98,7 +98,7 @@ class LiveMint(BasicNewsRecipe): classes( 'trendingSimilarHeight moreNews mobAppDownload label msgError msgOk taboolaHeight' ' socialHolder imgbig disclamerText disqus-comment-count openinApp2 lastAdSlot' - ' datePublish sepStory premiumSlider moreStory' + ' datePublish sepStory premiumSlider moreStory Joinus' ) ] @@ -149,6 +149,9 @@ class LiveMint(BasicNewsRecipe): span.extract() for img in soup.findAll('img', attrs={'data-src': True}): img['src'] = img['data-src'] + if wa := soup.find(**classes('autobacklink-topic')): + if p := wa.findParent('p'): + p.extract() return soup def populate_article_metadata(self, article, soup, first): diff --git a/recipes/project_syndicate.recipe b/recipes/project_syndicate.recipe index fdf3289965..c38fbc5c09 100644 --- a/recipes/project_syndicate.recipe +++ b/recipes/project_syndicate.recipe @@ -61,9 +61,10 @@ class projectsynd(BasicNewsRecipe): def preprocess_html(self, soup): for img in soup.findAll('img', attrs={'old-src':True}): img['src'] = img['old-src'].replace('medium', 'xlarge') - if abst := soup.find(attrs={'itemprop':'abstract'}).find('div'): - abst.name = 'p' - abst['class'] = 'sub' + if abst := soup.find(attrs={'itemprop':'abstract'}): + if div := abst.find('div'): + div.name = 'p' + div['class'] = 'sub' for div in soup.findAll('div', attrs={'data-line-id':True}): div.name = 'p' for a in soup.findAll('a', href=True):