From 0214ce34aa8dbea74fe5e9cbf9086fe3ef8b8df8 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 2 Mar 2024 12:05:51 +0200 Subject: [PATCH] handle archived.moe outages --- files/helpers/offsite_mentions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/files/helpers/offsite_mentions.py b/files/helpers/offsite_mentions.py index db95d8f26..b72d64d8c 100644 --- a/files/helpers/offsite_mentions.py +++ b/files/helpers/offsite_mentions.py @@ -36,7 +36,7 @@ def reddit_mentions_task(): q = " or ".join(OFFSITE_NOTIF_QUERIES) url = f'https://api.pullpush.io/reddit/search/{kind}?q={q}' try: data = requests.get(url, headers=HEADERS, timeout=20).json()['data'] - except: return [] + except: return for thing in data: if not thing.get('permalink'): continue @@ -101,7 +101,8 @@ def fourchan_mentions_task(): queries = OFFSITE_NOTIF_QUERIES - {'r/drama'} for q in queries: url = f'https://archived.moe/_/api/chan/search?text={q}' - data = requests.get(url, headers=HEADERS, timeout=20, proxies=proxies).json()['0']['posts'] + try: data = requests.get(url, headers=HEADERS, timeout=20, proxies=proxies).json()['0']['posts'] + except: return for thing in data: board = thing['board']['shortname']