diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 91d8bd20..1e5f31d4 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -25,6 +25,8 @@ import re from sickbeard.helpers import getURL, tryInt import sickbeard +from lib.six.moves.html_parser import HTMLParser + from lib.dateutil.parser import parse from lib.cachecontrol import CacheControl, caches @@ -737,6 +739,8 @@ class Tvdb: return [self._clean_data(d) for d in data] if isinstance(data, dict): return {k: self._clean_data(v) for k, v in data.iteritems()} + if isinstance(data, basestring): + return HTMLParser().unescape(data).strip() return data if not isinstance(data, (str, unicode)) else data.strip().replace(u'&', u'&') def search(self, series): diff --git a/lib/tvdb_api_v1/tvdb_api.py b/lib/tvdb_api_v1/tvdb_api.py index 7e70c89a..5057a769 100644 --- a/lib/tvdb_api_v1/tvdb_api.py +++ b/lib/tvdb_api_v1/tvdb_api.py @@ -29,6 +29,7 @@ except ImportError: from lib.dateutil.parser import parse from lib.cachecontrol import CacheControl, caches +from lib.six.moves.html_parser import HTMLParser from lib.etreetodict import ConvertXmlToDict from tvdb_ui import BaseUI, ConsoleUI @@ -637,6 +638,8 @@ class TvdbV1: - Replaces & with & - Trailing whitespace """ + if isinstance(data, basestring): + return HTMLParser().unescape(data).strip() return data if not isinstance(data, basestring) else data.strip().replace(u'&', u'&') def _get_url_artwork(self, image):