From 416986eb763cb090c27f41922b9ff0b70b43bdb5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 30 Jun 2019 16:31:59 +0530 Subject: [PATCH] Handle malformed data from NYT --- recipes/nytimes.recipe | 2 +- recipes/nytimes_sub.recipe | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 8d984351ce..87c09c62d1 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -203,7 +203,7 @@ class NewYorkTimes(BasicNewsRecipe): m = pat.search(key) grouping, container, relation = map(int, m.groups()) asset = sdata['asset'] - if asset['typename'] == 'Article' and grouping == 0: + if asset and asset['typename'] == 'Article' and grouping == 0: if container not in sections: sections[container] = [] sections[container].append(asset['id'].split(':', 1)[1]) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 7c333152fd..ffdf42d62a 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -203,7 +203,7 @@ class NewYorkTimes(BasicNewsRecipe): m = pat.search(key) grouping, container, relation = map(int, m.groups()) asset = sdata['asset'] - if asset['typename'] == 'Article' and grouping == 0: + if asset and asset['typename'] == 'Article' and grouping == 0: if container not in sections: sections[container] = [] sections[container].append(asset['id'].split(':', 1)[1])