From ab92bd54419fc17ffac77a0464420ec4eedee90f Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 8 Mar 2024 03:08:18 +0000 Subject: [PATCH] Adjust score and comment thresholds --- apiserver/feeds/hackernews.py | 4 ++++ apiserver/feeds/lobsters.py | 4 ++++ apiserver/feeds/tildes.py | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apiserver/feeds/hackernews.py b/apiserver/feeds/hackernews.py index 91acd76..e4efb11 100644 --- a/apiserver/feeds/hackernews.py +++ b/apiserver/feeds/hackernews.py @@ -84,6 +84,10 @@ def story(ref): s['comments'] = list(filter(bool, s['comments'])) s['num_comments'] = comment_count(s) - 1 + if s['score'] < 25 and s['num_comments'] < 10: + logging.info('Score ({}) or num comments ({}) below threshold.'.format(s['score'], s['num_comments'])) + return False + if 'text' in r and r['text']: s['text'] = clean(r['text'] or '') diff --git a/apiserver/feeds/lobsters.py b/apiserver/feeds/lobsters.py index da50a74..c9bab25 100644 --- a/apiserver/feeds/lobsters.py +++ b/apiserver/feeds/lobsters.py @@ -103,6 +103,10 @@ def story(ref): s['comments'] = iter_comments(r['comments']) s['num_comments'] = r['comment_count'] + if s['score'] < 15 and s['num_comments'] < 10: + logging.info('Score ({}) or num comments ({}) below threshold.'.format(s['score'], s['num_comments'])) + return False + if 'description' in r and r['description']: s['text'] = clean(r['description'] or '') diff --git a/apiserver/feeds/tildes.py b/apiserver/feeds/tildes.py index ab486b9..5019adb 100644 --- a/apiserver/feeds/tildes.py +++ b/apiserver/feeds/tildes.py @@ -120,7 +120,7 @@ def story(ref): logging.info('Group ({}) not in whitelist.'.format(s['group'])) return False - if s['score'] < 15 and s['num_comments'] < 15: + if s['score'] < 15 and s['num_comments'] < 10: logging.info('Score ({}) or num comments ({}) below threshold.'.format(s['score'], s['num_comments'])) return False