diff --git a/searx/utils.py b/searx/utils.py index 89128d50..f15f8a4b 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -82,8 +82,12 @@ class HTMLTextExtractor(HTMLParser): self.tags.append(tag) def handle_endtag(self, tag): + if not self.tags: + return + if tag != self.tags[-1]: raise Exception("invalid html") + self.tags.pop() def is_valid_tag(self):