From 72e2232469cc0b1582350bedfd146fde47f11ffa Mon Sep 17 00:00:00 2001 From: Jason Schwarzenberger Date: Thu, 26 Nov 2020 11:17:25 +1300 Subject: [PATCH] fix substack comments. --- apiserver/feeds/substack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apiserver/feeds/substack.py b/apiserver/feeds/substack.py index 18da671..9136782 100644 --- a/apiserver/feeds/substack.py +++ b/apiserver/feeds/substack.py @@ -84,7 +84,7 @@ class Publication: s['link'] = r.get('canonical_url', '') s['url'] = r.get('canonical_url', '') comments = json(lambda x: api_comments(x, self.BASE_DOMAIN), r.get('id'), headers={'Referer': self.BASE_DOMAIN}) - s['comments'] = [comment(i) for i in comments.get('comments')] + s['comments'] = [] if not comments else [comment(i) for i in comments.get('comments')] s['comments'] = list(filter(bool, s['comments'])) s['num_comments'] = r.get('comment_count', 0) @@ -155,8 +155,8 @@ class Top: s['title'] = r.get('title', '') s['link'] = r.get('canonical_url', '') s['url'] = r.get('canonical_url', '') - comments = json(lambda x: api_comments(x, base_url), r.get('id'), headers={'Referer': SUBSTACK_REFERER}) - s['comments'] = [comment(i) for i in comments.get('comments')] + comments = json(lambda x: api_comments(x, base_url), r.get('id'), headers={'Referer': base_url}) + s['comments'] = [] if not comments else [comment(i) for i in comments.get('comments')] s['comments'] = list(filter(bool, s['comments'])) s['num_comments'] = r.get('comment_count', 0)