plugins/Web: Encountering an HTMLParser exception doesn't mean the title hasn't already been snarfed. Don't bail right away.

This commit is contained in:
James Vega 2005-06-29 19:05:20 +00:00
parent bd31b7f596
commit bc1451e898

View File

@ -88,8 +88,8 @@ class Web(callbacks.PluginRegexp):
try: try:
parser.feed(text) parser.feed(text)
except HTMLParser.HTMLParseError: except HTMLParser.HTMLParseError:
self.log.debug('Unable to parse %u', url) self.log.debug('Encountered a problem parsing %u. Title may '
return 'already be set, though', url)
if parser.title is not None: if parser.title is not None:
domain = utils.web.getDomain(url) domain = utils.web.getDomain(url)
title = utils.web.htmlToText(parser.title.strip()) title = utils.web.htmlToText(parser.title.strip())
@ -164,9 +164,8 @@ class Web(callbacks.PluginRegexp):
try: try:
parser.feed(text) parser.feed(text)
except HTMLParser.HTMLParseError: except HTMLParser.HTMLParseError:
irc.reply(format('That URL appears to have no HTML title within ' self.log.debug('Encountered a problem parsing %u. Title may '
'the first %i bytes.', size)) 'already be set, though', url)
return
if parser.title is not None: if parser.title is not None:
irc.reply(utils.web.htmlToText(parser.title.strip())) irc.reply(utils.web.htmlToText(parser.title.strip()))
else: else: