diff options
-rw-r--r-- | prolog/engine.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/prolog/engine.py b/prolog/engine.py index c0fd58c..f6ce103 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -1,14 +1,14 @@ #!/usr/bin/python3 import collections +import html import http.client import json import re import urllib -import xml.etree.ElementTree -def strip_html(html_str): - return ''.join(xml.etree.ElementTree.fromstring(html_str).itertext()) +def strip_html(text): + return html.unescape(re.sub(r'</?[a-z]+[^>]*>', '', text)) # Create a new pengine, initialize it with [code] and return Prolog's reply. # The engine is destroyed after answering one query. If [query] is given, the |