mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-01 03:50:41 +01:00
RSS: Be compatible with new versions of feedparser.
This commit is contained in:
parent
c99fe9519e
commit
11df697b96
@ -31,7 +31,6 @@
|
|||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
import socket
|
import socket
|
||||||
import sgmllib
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
@ -45,7 +44,8 @@ from supybot.i18n import PluginInternationalization, internationalizeDocstring
|
|||||||
_ = PluginInternationalization('RSS')
|
_ = PluginInternationalization('RSS')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
feedparser = utils.python.universalImport('feedparser', 'local.feedparser')
|
feedparser = utils.python.universalImport('feedparser.feedparser',
|
||||||
|
'local.feedparser.feedparser', 'feedparser', 'local.feedparser')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise callbacks.Error, \
|
raise callbacks.Error, \
|
||||||
'You the feedparser module installed to use this plugin. ' \
|
'You the feedparser module installed to use this plugin. ' \
|
||||||
@ -261,7 +261,7 @@ class RSS(callbacks.Plugin):
|
|||||||
results = feedparser.parse(url)
|
results = feedparser.parse(url)
|
||||||
if 'bozo_exception' in results:
|
if 'bozo_exception' in results:
|
||||||
raise results['bozo_exception']
|
raise results['bozo_exception']
|
||||||
except sgmllib.SGMLParseError:
|
except feedparser.sgmllib.SGMLParseError:
|
||||||
self.log.exception('Uncaught exception from feedparser:')
|
self.log.exception('Uncaught exception from feedparser:')
|
||||||
raise callbacks.Error, 'Invalid (unparsable) RSS feed.'
|
raise callbacks.Error, 'Invalid (unparsable) RSS feed.'
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user