mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Update economist.recipe
This commit is contained in:
parent
c33d89f0c5
commit
8a3606a69f
@ -126,6 +126,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
title = 'The Economist'
|
title = 'The Economist'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
|
masthead_url = 'https://www.livemint.com/lm-img/dev/economist-logo-oneline.png'
|
||||||
|
|
||||||
__author__ = "Kovid Goyal"
|
__author__ = "Kovid Goyal"
|
||||||
description = (
|
description = (
|
||||||
@ -156,6 +157,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
img {display:block; margin:0 auto;}
|
||||||
'''
|
'''
|
||||||
oldest_article = 7.0
|
oldest_article = 7.0
|
||||||
resolve_internal_links = True
|
resolve_internal_links = True
|
||||||
@ -251,6 +253,11 @@ class Economist(BasicNewsRecipe):
|
|||||||
x.text = x.text.upper()
|
x.text = x.text.upper()
|
||||||
x.tag = 'span'
|
x.tag = 'span'
|
||||||
x.set('style', 'font-variant: small-caps')
|
x.set('style', 'font-variant: small-caps')
|
||||||
|
for x in root.xpath('//figcaption'):
|
||||||
|
x.set('style', 'text-align:center; font-size:small;')
|
||||||
|
for x in root.xpath('//cite'):
|
||||||
|
x.tag = 'blockquote'
|
||||||
|
x.set('style', 'color:#404040;')
|
||||||
raw = etree.tostring(root, encoding='unicode')
|
raw = etree.tostring(root, encoding='unicode')
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
@ -295,6 +302,8 @@ class Economist(BasicNewsRecipe):
|
|||||||
if script_tag is not None:
|
if script_tag is not None:
|
||||||
data = json.loads(script_tag.string)
|
data = json.loads(script_tag.string)
|
||||||
# open('/t/raw.json', 'w').write(json.dumps(data, indent=2, sort_keys=True))
|
# open('/t/raw.json', 'w').write(json.dumps(data, indent=2, sort_keys=True))
|
||||||
|
self.title = 'The Economist | ' + safe_dict(data, "props", "pageProps", "content", "image", "main", "headline")
|
||||||
|
self.timefmt = ' [' + safe_dict(data, "props", "pageProps", "content", "datePublishedString") + ']'
|
||||||
self.cover_url = safe_dict(data, "props", "pageProps", "content", "image", "main", "url", "canonical")
|
self.cover_url = safe_dict(data, "props", "pageProps", "content", "image", "main", "url", "canonical")
|
||||||
self.log('Got cover:', self.cover_url)
|
self.log('Got cover:', self.cover_url)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user