Change decode html entities returned from tvdb api.

This commit is contained in:
Prinz23 2018-09-01 01:50:02 +02:00 committed by JackDandy
parent 8c85e7a9e3
commit 92fcdaf5df
2 changed files with 7 additions and 0 deletions

View file

@ -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):

View file

@ -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):