Fix #1943193 [economist recipe TypeError: Argument must be bytes or unicode, got 'NoneType'](https://bugs.launchpad.net/calibre/+bug/1943193)

This commit is contained in:
Kovid Goyal 2021-09-10 09:18:03 +05:30
parent 56d79c597b
commit a0cc6d6c68
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ def process_node(node, html_parent):
ntype = node.get('type') ntype = node.get('type')
if ntype == 'tag': if ntype == 'tag':
c = html_parent.makeelement(node['name']) 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) html_parent.append(c)
for nc in node.get('children', ()): for nc in node.get('children', ()):
process_node(nc, c) process_node(nc, c)
@ -236,7 +236,7 @@ class Economist(BasicNewsRecipe):
def parse_index(self): def parse_index(self):
# return [('Articles', [{'title':'test', # 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: if edition_date:
url = 'https://www.economist.com/weeklyedition/' + edition_date url = 'https://www.economist.com/weeklyedition/' + edition_date

View File

@ -31,7 +31,7 @@ def process_node(node, html_parent):
ntype = node.get('type') ntype = node.get('type')
if ntype == 'tag': if ntype == 'tag':
c = html_parent.makeelement(node['name']) 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) html_parent.append(c)
for nc in node.get('children', ()): for nc in node.get('children', ()):
process_node(nc, c) process_node(nc, c)