From d8cc07223e58e8a1c3550947d91fa8d26a48ce33 Mon Sep 17 00:00:00 2001 From: pictuga Date: Tue, 23 Nov 2021 20:53:00 +0100 Subject: [PATCH] readabilite: fix bug when nothing above threshold --- morss/readabilite.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morss/readabilite.py b/morss/readabilite.py index 8cc5d53..63d6384 100644 --- a/morss/readabilite.py +++ b/morss/readabilite.py @@ -352,6 +352,10 @@ def get_article(data, url=None, encoding_in=None, encoding_out='unicode', debug= else: best = get_best_node(html, threshold) + if best is None: + # if threshold not met + return None + # clean up if not debug: keep_threshold = get_score(best) * 3/4