From 76bc01c2c056d7eaa4c336841b359305c86de099 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 12 Feb 2022 02:05:05 +0200 Subject: [PATCH] fds --- files/routes/posts.py | 10 ++++++++-- files/templates/submission.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index ee3b5160c..03deb6efe 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -724,7 +724,10 @@ def thumbnail_thread(pid): for t in ("submission","comment"): word = random.choice(('rdrama','marsey')) - try: data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={word}&size=1').json()["data"] + try: + data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={word}&size=1') + if str(data) == "": data = data.json()["data"] + else: break except: break for i in data: @@ -773,7 +776,10 @@ def thumbnail_thread(pid): if SITE == 'pcmemes.net': for t in ("submission","comment"): - try: data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=pcmemes.net&size=1').json()["data"] + try: + data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=pcmemes.net&size=1').json()["data"] + if str(data) == "": data = data.json()["data"] + else: break except: break for i in data: diff --git a/files/templates/submission.html b/files/templates/submission.html index 064cc4972..3e3df2d15 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -255,7 +255,7 @@ {% if p.award_count("tilt") %} {% endif %}