fix reddit mention notifs

master
Aevann1 2022-12-20 02:36:53 +02:00
parent f6c1f94614
commit bd02df4177
1 changed files with 3 additions and 2 deletions

View File

@ -50,14 +50,14 @@ def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False):
url = ( url = (
f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true' f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true'
f'&q={"%7C".join(queries)}' f'&q={"%7C".join(queries)}'
f'&subreddit=!{",!".join(exclude_subreddits)}' # f'&subreddit=!{",!".join(exclude_subreddits)}'
f'&after={after}' f'&after={after}'
f'&size={size}') f'&size={size}')
print(url, flush=True) print(url, flush=True)
data = requests.get(( data = requests.get((
f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true' f'https://api.pushshift.io/reddit/{kind}/search?html_decode=true'
f'&q={"%7C".join(queries)}' f'&q={"%7C".join(queries)}'
f'&subreddit=!{",!".join(exclude_subreddits)}' # f'&subreddit=!{",!".join(exclude_subreddits)}'
f'&after={after}' f'&after={after}'
f'&size={size}'), timeout=15).json()['data'] f'&size={size}'), timeout=15).json()['data']
except Exception as e: except Exception as e:
@ -65,6 +65,7 @@ def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False):
continue continue
for thing in data: for thing in data:
if thing['subreddit'] in exclude_subreddits: continue
if 'bot' in thing['author'].lower(): continue if 'bot' in thing['author'].lower(): continue
after = max(after, thing["created_utc"]) if thing["created_utc"] else after after = max(after, thing["created_utc"]) if thing["created_utc"] else after
if kind == 'comment': if kind == 'comment':