Update business_standard_print.recipe

This commit is contained in:
unkn0w7n 2025-01-10 08:26:07 +05:30
parent dd6b924f5c
commit c8b55252f5

View File

@ -131,13 +131,16 @@ class BusinessStandardPrint(BasicNewsRecipe):
if 'alt_text' in data['featuredImageObj']: if 'alt_text' in data['featuredImageObj']:
caption = '<span>' + data['featuredImageObj']['alt_text'] + '</span></p>' caption = '<span>' + data['featuredImageObj']['alt_text'] + '</span></p>'
body = data['htmlContent'].replace('<br />\r\n\t\t&nbsp;', '<br>') body = data['htmlContent']
return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div><br>' + body + '</div></body></html>' return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div><br>' + body + '</div></body></html>'
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img'): for img in soup.findAll('img'):
img.attrs = {'src': img.get('src', '')} img.attrs = {'src': img.get('src', '')}
for x in soup.findAll('div'): for x in soup.findAll('div', 'p'):
x.attrs = {'class': x.get('class', '')} x.attrs = {'class': x.get('class', '')}
for attr in self.remove_attributes:
for x in soup.findAll(attrs={attr: True}):
del x[attr]
return soup return soup