From 3246b525565456abe47adf872804ee348f0e37b8 Mon Sep 17 00:00:00 2001
From: Dmitriy Lyalyuev
Date: Thu, 27 Oct 2022 16:31:26 +0300
Subject: [PATCH] feat: truncate url
---
later42/libs/content.py | 13 +++++++------
later42/templates/index.html | 4 +---
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/later42/libs/content.py b/later42/libs/content.py
index 5cad6c1..29cde73 100644
--- a/later42/libs/content.py
+++ b/later42/libs/content.py
@@ -13,9 +13,10 @@ def sanitize_img_size(html: str):
def get_content(url: str):
- url = settings.READABILITY_HOST.rstrip(
- '/') + '/api/content/v1/parser?url=' + url
- try:
- return requests.get(url).json()
- except KeyError:
- return None
+ if settings.READABILITY_HOST:
+ url = settings.READABILITY_HOST.rstrip(
+ '/') + '/api/content/v1/parser?url=' + url
+ try:
+ return requests.get(url).json()
+ except KeyError:
+ return None
diff --git a/later42/templates/index.html b/later42/templates/index.html
index 298fd4b..2977b3c 100644
--- a/later42/templates/index.html
+++ b/later42/templates/index.html
@@ -21,9 +21,7 @@
{% endif %}
-
- {{ url.url }}
-
+ {{ url.url|urlizetrunc:70 }}