mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-15 07:04:53 +01:00
Merge pull request #1175 from Ban3/python350-htmlparser-fixes
Web & utils.web: Fix for HTMLParser in Python 3.5.0
This commit is contained in:
commit
9f10f08b2e
@ -155,9 +155,10 @@ class Web(callbacks.PluginRegexp):
|
||||
else:
|
||||
return None
|
||||
parser.feed(text)
|
||||
parser.close()
|
||||
title = parser.title
|
||||
if title:
|
||||
title = utils.web.htmlToText(parser.title.strip())
|
||||
title = utils.web.htmlToText(title.strip())
|
||||
elif raiseErrors:
|
||||
if len(text) < size:
|
||||
irc.reply(_('That URL appears to have no HTML title.'))
|
||||
|
@ -67,7 +67,7 @@ class WebTestCase(ChannelPluginTestCase):
|
||||
'title http://www.youtube.com/watch?v=x4BtiqPN4u8')
|
||||
self.assertResponse(
|
||||
'title http://www.thefreedictionary.com/don%27t',
|
||||
"don't - definition of don't by The Free Dictionary")
|
||||
"Don't - definition of don't by The Free Dictionary")
|
||||
|
||||
def testTitleSnarfer(self):
|
||||
try:
|
||||
|
@ -254,6 +254,7 @@ def htmlToText(s, tagReplace=' '):
|
||||
pass
|
||||
x = HtmlToText(tagReplace)
|
||||
x.feed(s)
|
||||
x.close()
|
||||
return x.getText()
|
||||
|
||||
def mungeEmail(s):
|
||||
|
Loading…
Reference in New Issue
Block a user