mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-06-06 22:15:22 -04:00
economist
This commit is contained in:
@@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
|
||||
def preprocess_raw_html(self, raw, url):
|
||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||
root = parse(raw)
|
||||
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>'
|
||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||
if script:
|
||||
try:
|
||||
|
||||
@@ -205,6 +205,10 @@ class Economist(BasicNewsRecipe):
|
||||
def preprocess_raw_html(self, raw, url):
|
||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||
root = parse(raw)
|
||||
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>'
|
||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||
if script:
|
||||
try:
|
||||
|
||||
@@ -201,6 +201,10 @@ class Economist(BasicNewsRecipe):
|
||||
def preprocess_raw_html(self, raw, url):
|
||||
# open('/t/raw.html', 'wb').write(raw.encode('utf-8'))
|
||||
root = parse(raw)
|
||||
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>'
|
||||
script = root.xpath('//script[@id="__NEXT_DATA__"]')
|
||||
if script:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user