diff options
author | Adam Tauber <asciimoo@gmail.com> | 2015-01-22 17:43:45 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2015-01-22 17:43:45 +0100 |
commit | 699fe60e5072eeffebfb2f3b9b85cefe6dd1b7bc (patch) | |
tree | c7af3aa1e2fd63ec68e77602c72492e3011e3b96 /searx/utils.py | |
parent | 06186e72a9cb9af89193880b41394cc9be5c5b35 (diff) | |
download | searxng-699fe60e5072eeffebfb2f3b9b85cefe6dd1b7bc.tar.gz searxng-699fe60e5072eeffebfb2f3b9b85cefe6dd1b7bc.zip |
[fix] handle single closing element in HTMLTextExtractor
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py index 89128d506..f15f8a4bc 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): |