From e79fca6ecc76754b2d0e0786a424c190e8c9ab0b Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 31 Aug 2023 07:35:44 +0000 Subject: [PATCH] Replace "indent_level" with "depth" in lobsters API See: https://github.com/lobsters/lobsters/commit/fe09e5aa31993e09ed4ad255bb4a359f1e8a2d62 --- apiserver/feeds/lobsters.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/apiserver/feeds/lobsters.py b/apiserver/feeds/lobsters.py index 7214038..5b6201a 100644 --- a/apiserver/feeds/lobsters.py +++ b/apiserver/feeds/lobsters.py @@ -67,7 +67,7 @@ def iter_comments(flat_comments): parent_stack = [] for comment in flat_comments: c = make_comment(comment) - indent = comment['indent_level'] + indent = comment['depth'] if indent == 1: nested_comments.append(c) @@ -100,13 +100,7 @@ def story(ref): s['title'] = r.get('title', '') s['link'] = SITE_LINK(ref) s['url'] = r.get('url', '') - - try: - s['comments'] = iter_comments(r['comments']) - except TypeError: - logging.exception('TypeError iterating lobsters comments, skipping article.') - return False - + s['comments'] = iter_comments(r['comments']) s['num_comments'] = r['comment_count'] if 'description' in r and r['description']: