From 89440f77c3d7f98ea47ba618c100d26114cad59f Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sun, 21 Apr 2024 22:47:32 +0530 Subject: [PATCH] Update economist --- recipes/economist.recipe | 50 ++++++++++++++++------------------------ recipes/el_correo.recipe | 2 ++ 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index e6dcd3acb8..c9243f4cc6 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -64,10 +64,13 @@ def load_article_from_json(raw, root): for child in tuple(body): body.remove(child) article = E(body, 'article') - E(article, 'h4', data['subheadline'], style='color: red; margin: 0') - E(article, 'h1', data['headline'], style='font-size: x-large') - E(article, 'div', data['description'], style='font-style: italic') - E(article, 'div', (data['datePublishedString'] or '') + ' | ' + (data['dateline'] or ''), style='color: gray; margin: 1em') + E(article, 'div', data['subheadline'] , style='color: red; font-size:small; font-weight:bold;') + E(article, 'h1', data['headline']) + E(article, 'div', data['description'], style='font-style: italic; color:#202020;') + if data['dateline'] is None: + E(article, 'p', (data['datePublishedString'] or ''), style='color: gray; font-size:small;') + else: + E(article, 'p', (data['datePublishedString'] or '') + ' | ' + (data['dateline']), style='color: gray; font-size:small;') main_image_url = safe_dict(data, 'image', 'main', 'url').get('canonical') if main_image_url: div = E(article, 'div') @@ -129,31 +132,9 @@ class Economist(BasicNewsRecipe): ' perspective. Best downloaded on Friday mornings (GMT)' ) extra_css = ''' - .headline {font-size: x-large;} - h2 { font-size: small; } - h1 { font-size: medium; } - em.Bold {font-weight:bold;font-style:normal;} - em.Italic {font-style:italic;} - p.xhead {font-weight:bold;} - .pullquote { - float: right; - font-size: larger; - font-weight: bold; - font-style: italic; - page-break-inside:avoid; - border-bottom: 3px solid black; - border-top: 3px solid black; - width: 228px; - margin: 0px 0px 10px 15px; - padding: 7px 0px 9px; - } - .flytitle-and-title__flytitle { - display: block; - font-size: smaller; - color: red; - } + em { color:#202020; } img {display:block; margin:0 auto;} - ''' + ''' oldest_article = 7.0 resolve_internal_links = True remove_tags = [ @@ -206,7 +187,7 @@ class Economist(BasicNewsRecipe): # open('/t/raw.html', 'wb').write(raw.encode('utf-8')) root = parse(raw) if '/interactive/' in url: - return '