From e0b8b7bd64d63b3206b44258fc412c602c2357c7 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Mon, 28 Jun 2021 15:31:25 -0400 Subject: added try clause to link scraper --- app/links/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app/links') diff --git a/app/links/models.py b/app/links/models.py index 45d9c09..d7e04c4 100644 --- a/app/links/models.py +++ b/app/links/models.py @@ -37,9 +37,12 @@ def random_link(): def get_source(source): - url = "http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=json&u=%s" % (source) - r = requests.get(url, timeout=15.001) - data = r.json() + try: + url = "http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=json&u=%s" % (source) + r = requests.get(url, timeout=15.001) + data = r.json() + except: + data = "" return data -- cgit v1.2.3-70-g09d2