summaryrefslogtreecommitdiff
path: root/app/links
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2021-06-28 15:31:25 -0400
committerluxagraf <sng@luxagraf.net>2021-06-28 15:31:25 -0400
commite0b8b7bd64d63b3206b44258fc412c602c2357c7 (patch)
tree77c9454bfec09507c19d1acac8f37f8ae09586c5 /app/links
parentcd2bd06e220fb9c7ed2a89c962d3904e08358109 (diff)
added try clause to link scraper
Diffstat (limited to 'app/links')
-rw-r--r--app/links/models.py9
1 files changed, 6 insertions, 3 deletions
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