From bde48aa80dd596749416e3ff81a2b58da95d4ee5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Jan 2020 10:17:00 +0530 Subject: [PATCH] Replace entities in economist JSON text & seems to be used a lot --- recipes/economist.recipe | 2 ++ recipes/economist_free.recipe | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index cc2a4c65d8..e3176b9793 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -11,6 +11,7 @@ from collections import OrderedDict from html5_parser import parse from lxml import etree +from calibre import replace_entities from calibre.ebooks.BeautifulSoup import NavigableString, Tag from calibre.utils.cleantext import clean_ascii_chars from calibre.web.feeds.news import BasicNewsRecipe @@ -34,6 +35,7 @@ def process_node(node, html_parent): elif ntype == 'text': text = node.get('data') if text: + text = replace_entities(text) if len(html_parent): t = html_parent[-1] t.tail = (t.tail or '') + text diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index cc2a4c65d8..e3176b9793 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -11,6 +11,7 @@ from collections import OrderedDict from html5_parser import parse from lxml import etree +from calibre import replace_entities from calibre.ebooks.BeautifulSoup import NavigableString, Tag from calibre.utils.cleantext import clean_ascii_chars from calibre.web.feeds.news import BasicNewsRecipe @@ -34,6 +35,7 @@ def process_node(node, html_parent): elif ntype == 'text': text = node.get('data') if text: + text = replace_entities(text) if len(html_parent): t = html_parent[-1] t.tail = (t.tail or '') + text