From a0cc6d6c68efe1e9e7479451aa9bfc4df0812bac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Sep 2021 09:18:03 +0530 Subject: [PATCH] Fix #1943193 [economist recipe TypeError: Argument must be bytes or unicode, got 'NoneType'](https://bugs.launchpad.net/calibre/+bug/1943193) --- recipes/economist.recipe | 4 ++-- recipes/economist_free.recipe | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index d89a446b11..25d7a6edf0 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -31,7 +31,7 @@ def process_node(node, html_parent): ntype = node.get('type') if ntype == 'tag': c = html_parent.makeelement(node['name']) - c.attrib.update(node.get('attribs', {})) + c.attrib.update({k: v or '' for k, v in node.get('attribs', {}).items()}) html_parent.append(c) for nc in node.get('children', ()): process_node(nc, c) @@ -236,7 +236,7 @@ class Economist(BasicNewsRecipe): def parse_index(self): # return [('Articles', [{'title':'test', - # 'url':'file:///t/raw.html' + # 'url':'https://www.economist.com/briefing/2021/09/11/how-america-wasted-its-unipolar-moment' # }])] if edition_date: url = 'https://www.economist.com/weeklyedition/' + edition_date diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index d89a446b11..f36aff4d05 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -31,7 +31,7 @@ def process_node(node, html_parent): ntype = node.get('type') if ntype == 'tag': c = html_parent.makeelement(node['name']) - c.attrib.update(node.get('attribs', {})) + c.attrib.update({k: v or '' for k, v in node.get('attribs', {}).items()}) html_parent.append(c) for nc in node.get('children', ()): process_node(nc, c)