From 632d028e4c29144d0d5dc7d4fb55a1729cdf58e2 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 13 Jul 2023 22:54:36 +0000 Subject: [PATCH] Add Tildes group whitelist --- apiserver/feeds/tildes.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apiserver/feeds/tildes.py b/apiserver/feeds/tildes.py index e57c0a7..ab486b9 100644 --- a/apiserver/feeds/tildes.py +++ b/apiserver/feeds/tildes.py @@ -107,7 +107,20 @@ def story(ref): ch = a.find('header', class_='topic-comments-header') s['num_comments'] = int(ch.h2.string.split(' ')[0]) if ch else 0 - if s['score'] < 32 and s['num_comments'] < 24: + if s['group'].split('.')[0] not in [ + '~arts', + '~comp', + '~creative', + '~design', + '~engineering', + '~finance', + '~science', + '~tech', + ]: + logging.info('Group ({}) not in whitelist.'.format(s['group'])) + return False + + if s['score'] < 15 and s['num_comments'] < 15: logging.info('Score ({}) or num comments ({}) below threshold.'.format(s['score'], s['num_comments'])) return False