From d07a6cbc085344b5bd8a25a0d31ef641651f1c4d Mon Sep 17 00:00:00 2001 From: justcool393 Date: Mon, 17 Oct 2022 14:44:44 -0500 Subject: [PATCH] remove bot mentions --- files/helpers/offsitementions.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/files/helpers/offsitementions.py b/files/helpers/offsitementions.py index 149e671a6f..0804714b01 100644 --- a/files/helpers/offsitementions.py +++ b/files/helpers/offsitementions.py @@ -36,13 +36,12 @@ def get_mentions(queries): mentions = [] for kind, query in itertools.product(kinds, queries): try: - data = requests.get(f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true&q={query}&size=1', timeout=5).json()['data'] + # Special cases: PokemonGoRaids says 'Marsey' a lot unrelated to us. + # SubSimulatorGPT2 is just bots + data = requests.get(f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true&q={query}&subreddit=!PokemonGoRaids,!SubSimulatorGPT2&size=1', timeout=5).json()['data'] except: break for i in data: - # Special case: PokemonGoRaids says 'Marsey' a lot unrelated to us. - if i['subreddit'] == 'PokemonGoRaids': continue - if kind == 'comment': body = i["body"].replace('>', '> ') text = f'

{body}

'