diff --git a/plugins/RSS/plugin.py b/plugins/RSS/plugin.py index 0f8be9f0c..d05f65a5e 100644 --- a/plugins/RSS/plugin.py +++ b/plugins/RSS/plugin.py @@ -262,7 +262,7 @@ class RSS(callbacks.Plugin): try: self.log.debug('Downloading new feed from %u', url) results = feedparser.parse(url) - if 'bozo_exception' in results: + if 'bozo_exception' in results and not results['entries']: raise results['bozo_exception'] except feedparser.sgmllib.SGMLParseError: self.log.exception('Uncaught exception from feedparser:') diff --git a/src/utils/web.py b/src/utils/web.py index da8d6521b..94313c900 100644 --- a/src/utils/web.py +++ b/src/utils/web.py @@ -189,8 +189,15 @@ class HtmlToText(HTMLParser, object): def htmlToText(s, tagReplace=' '): """Turns HTML into text. tagReplace is a string to replace HTML tags with. """ - if sys.version_info[0] >= 3 and isinstance(s, bytes): - s = s.decode() + try: + import chardet + except ImportError: + s = s.decode('utf8') + else: + u = chardet.universaldetector.UniversalDetector() + u.feed(s) + u.close() + s = s.decode(u.result['encoding']) x = HtmlToText(tagReplace) x.feed(s) return x.getText()