Handle malformed data from NYT

This commit is contained in:
Kovid Goyal 2019-06-30 16:31:59 +05:30
parent 0f4c2c23bd
commit 416986eb76
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 2 deletions

View File

@ -203,7 +203,7 @@ class NewYorkTimes(BasicNewsRecipe):
m = pat.search(key) m = pat.search(key)
grouping, container, relation = map(int, m.groups()) grouping, container, relation = map(int, m.groups())
asset = sdata['asset'] asset = sdata['asset']
if asset['typename'] == 'Article' and grouping == 0: if asset and asset['typename'] == 'Article' and grouping == 0:
if container not in sections: if container not in sections:
sections[container] = [] sections[container] = []
sections[container].append(asset['id'].split(':', 1)[1]) sections[container].append(asset['id'].split(':', 1)[1])

View File

@ -203,7 +203,7 @@ class NewYorkTimes(BasicNewsRecipe):
m = pat.search(key) m = pat.search(key)
grouping, container, relation = map(int, m.groups()) grouping, container, relation = map(int, m.groups())
asset = sdata['asset'] asset = sdata['asset']
if asset['typename'] == 'Article' and grouping == 0: if asset and asset['typename'] == 'Article' and grouping == 0:
if container not in sections: if container not in sections:
sections[container] = [] sections[container] = []
sections[container].append(asset['id'].split(':', 1)[1]) sections[container].append(asset['id'].split(':', 1)[1])