소스 검색

Slightly tweaked algo again.

master
Trey Del Bonis 2 년 전
부모
커밋
48b3686c17
1개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 8
    5
      main.py

+ 8
- 5
main.py 파일 보기

@@ -131,7 +131,7 @@ def process_post(post):
}

def query_tops(config):
url = 'https://www.reddit.com/r/%s/top.json?sort=top&t=day' % config['subreddit']
url = 'https://www.reddit.com/r/%s/hot.json' % config['subreddit']
resp = requests.get(url, headers = {'User-agent': 'mastoreddit'})
resp.raise_for_status()
j = resp.json()
@@ -162,13 +162,16 @@ def filter_posts(config, posts, filt):
if len(ok) <= tp and p['score'] >= config['min_score']:
if p['rid'] not in filt:
ok.append(p)
newfilt.add(p['rid'])
else:
print('filtered out:', p['rid'], p['title'])
elif p['rid'] in filt:
newfilt.add(p['rid'])
else:
print('skipped:', p['rid'], p['title'])
continue

if p['rid'] in filt:
newfilt.add(p['rid'])
continue

print('ignoring for now:', p['rid'], p['title'])

return ok, list(newfilt)


Loading…
취소
저장