This commit is contained in:
Kovid Goyal 2025-07-25 07:58:46 +05:30
commit 0409a28e00
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -94,11 +94,11 @@ class TheWashingtonPost(BasicNewsRecipe):
] ]
def preprocess_raw_html(self, raw, url): def preprocess_raw_html(self, raw, url):
root = parse(raw)
if '/interactive/' in url: if '/interactive/' in url:
return ('<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>' return ('<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>'
'This article is supposed to be read in a browser.' 'This article is supposed to be read in a browser.'
'</em></article></body></html>') '</em></article></body></html>')
root = parse(raw)
m = root.xpath('//script[@id="__NEXT_DATA__"]') m = root.xpath('//script[@id="__NEXT_DATA__"]')
data = json.loads(m[0].text) data = json.loads(m[0].text)

View File

@ -81,11 +81,11 @@ class wapoprint(BasicNewsRecipe):
return feeds return feeds
def preprocess_raw_html(self, raw, url): def preprocess_raw_html(self, raw, url):
root = parse(raw)
if '/interactive/' in url: if '/interactive/' in url:
return ('<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>' return ('<html><body><article><h1>' + root.xpath('//h1')[0].text + '</h1><em>'
'This article is supposed to be read in a browser.' 'This article is supposed to be read in a browser.'
'</em></article></body></html>') '</em></article></body></html>')
root = parse(raw)
m = root.xpath('//script[@id="__NEXT_DATA__"]') m = root.xpath('//script[@id="__NEXT_DATA__"]')
data = json.loads(m[0].text) data = json.loads(m[0].text)