This commit is contained in:
unkn0wn 2025-07-24 11:39:32 +05:30 committed by GitHub
parent d353c5afe6
commit b8cdf762ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,7 +80,11 @@ class wapoprint(BasicNewsRecipe):
feeds.append((secname, articles))
return feeds
def preprocess_raw_html(self, raw, *a):
def preprocess_raw_html(self, raw, url):
if '/interactive/' in url:
return ('<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>'
'This article is supposed to be read in a browser.'
'</em></article></body></html>')
root = parse(raw)
m = root.xpath('//script[@id="__NEXT_DATA__"]')
@ -89,10 +93,7 @@ class wapoprint(BasicNewsRecipe):
text = data.get('label', {}).get('basic', {}).get('text', '')
label = f'<p class="time">{text}</p>' if text else ''
if data.get('headlines'):
title = '<h1>' + data['headlines']['basic'] + '</h1>'
elif data.get('metadata'):
title = '<h1>' + data['metadata']['headlines']['basic'] + '</h1>'
subhead = '<p class="subt">' + data['description'].get('basic', '') + '</h3>'
promo_img = ''