|
|
@@ -154,17 +154,18 @@ def query_tops(config): |
|
|
|
return posts |
|
|
|
|
|
|
|
def filter_posts(config, posts, filt): |
|
|
|
tp = config['top_posts'] |
|
|
|
ok = [] |
|
|
|
filt = set(filt) |
|
|
|
newfilt = set() |
|
|
|
|
|
|
|
for p in posts: |
|
|
|
if p['rid'] not in filt: |
|
|
|
ok.append(p) |
|
|
|
newfilt.add(p['rid']) |
|
|
|
|
|
|
|
if len(ok) > config['top_posts']: |
|
|
|
ok = ok[:config['top_posts']] |
|
|
|
if len(ok) <= tp and p['score'] >= config['min_score']: |
|
|
|
if p['rid'] not in filt: |
|
|
|
ok.append(p) |
|
|
|
newfilt.add(p['rid']) |
|
|
|
elif p['rid'] in filt: |
|
|
|
newfilt.add(p['rid']) |
|
|
|
|
|
|
|
return ok, list(newfilt) |
|
|
|
|
|
|
@@ -185,7 +186,6 @@ def main(): |
|
|
|
print('posting', p['rid'], '-', p['title']) |
|
|
|
make_post(masto, p) |
|
|
|
|
|
|
|
print(newrecents) |
|
|
|
save_recents(newrecents) |
|
|
|
|
|
|
|
if __name__ == '__main__': |