mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Change decode html entities returned from tvdb api.
This commit is contained in:
parent
8c85e7a9e3
commit
92fcdaf5df
2 changed files with 7 additions and 0 deletions
|
@ -25,6 +25,8 @@ import re
|
||||||
from sickbeard.helpers import getURL, tryInt
|
from sickbeard.helpers import getURL, tryInt
|
||||||
import sickbeard
|
import sickbeard
|
||||||
|
|
||||||
|
from lib.six.moves.html_parser import HTMLParser
|
||||||
|
|
||||||
from lib.dateutil.parser import parse
|
from lib.dateutil.parser import parse
|
||||||
from lib.cachecontrol import CacheControl, caches
|
from lib.cachecontrol import CacheControl, caches
|
||||||
|
|
||||||
|
@ -737,6 +739,8 @@ class Tvdb:
|
||||||
return [self._clean_data(d) for d in data]
|
return [self._clean_data(d) for d in data]
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
return {k: self._clean_data(v) for k, v in data.iteritems()}
|
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'&')
|
return data if not isinstance(data, (str, unicode)) else data.strip().replace(u'&', u'&')
|
||||||
|
|
||||||
def search(self, series):
|
def search(self, series):
|
||||||
|
|
|
@ -29,6 +29,7 @@ except ImportError:
|
||||||
|
|
||||||
from lib.dateutil.parser import parse
|
from lib.dateutil.parser import parse
|
||||||
from lib.cachecontrol import CacheControl, caches
|
from lib.cachecontrol import CacheControl, caches
|
||||||
|
from lib.six.moves.html_parser import HTMLParser
|
||||||
|
|
||||||
from lib.etreetodict import ConvertXmlToDict
|
from lib.etreetodict import ConvertXmlToDict
|
||||||
from tvdb_ui import BaseUI, ConsoleUI
|
from tvdb_ui import BaseUI, ConsoleUI
|
||||||
|
@ -637,6 +638,8 @@ class TvdbV1:
|
||||||
- Replaces & with &
|
- Replaces & with &
|
||||||
- Trailing whitespace
|
- Trailing whitespace
|
||||||
"""
|
"""
|
||||||
|
if isinstance(data, basestring):
|
||||||
|
return HTMLParser().unescape(data).strip()
|
||||||
return data if not isinstance(data, basestring) else data.strip().replace(u'&', u'&')
|
return data if not isinstance(data, basestring) else data.strip().replace(u'&', u'&')
|
||||||
|
|
||||||
def _get_url_artwork(self, image):
|
def _get_url_artwork(self, image):
|
||||||
|
|
Loading…
Reference in a new issue