diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-23 16:09:03 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-23 16:09:03 +0200 |
commit | 49053e6ddb5241ccf1bf6376bbfcfe7df7e59ac4 (patch) | |
tree | c2a431ba7e32c91cafa0f299e0fc6879a6d3edad | |
parent | self.html -> self.data (diff) | |
download | pyload-49053e6ddb5241ccf1bf6376bbfcfe7df7e59ac4.tar.xz |
Fix https://github.com/pyload/pyload/issues/2099
-rw-r--r-- | module/plugins/internal/utils.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/module/plugins/internal/utils.py b/module/plugins/internal/utils.py index e01baf30f..7382ef03f 100644 --- a/module/plugins/internal/utils.py +++ b/module/plugins/internal/utils.py @@ -14,7 +14,11 @@ import traceback import urllib import urlparse -import HTMLParser +try: + import HTMLParser + +except ImportError: #@TODO: Remove in 0.4.10 + import xml.sax.saxutils try: import simplejson as json @@ -26,7 +30,7 @@ except ImportError: class utils(object): __name__ = "utils" __type__ = "plugin" - __version__ = "0.07" + __version__ = "0.08" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -107,8 +111,12 @@ def html_unescape(text): """ Removes HTML or XML character references and entities from a text string """ - h = HTMLParser.HTMLParser() - return h.unescape(text) + try: + h = HTMLParser.HTMLParser() + return h.unescape(text) + + except Exception: #@TODO: Remove in 0.4.10 + return xml.sax.saxutils.unescape(text) def isiterable(obj): |