mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Oops, forgot to update these for the protocols change.
This commit is contained in:
parent
3eedd04653
commit
21b1acd3f4
@ -90,7 +90,8 @@ class Http(callbacks.Privmsg):
|
|||||||
if not url.startswith('http://'):
|
if not url.startswith('http://'):
|
||||||
irc.error('Only HTTP urls are valid.')
|
irc.error('Only HTTP urls are valid.')
|
||||||
return
|
return
|
||||||
s = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
|
s = webutils.getUrl(url, size=size)
|
||||||
m = self._doctypeRe.search(s)
|
m = self._doctypeRe.search(s)
|
||||||
if m:
|
if m:
|
||||||
s = utils.normalizeWhitespace(m.group(0))
|
s = utils.normalizeWhitespace(m.group(0))
|
||||||
@ -113,13 +114,13 @@ class Http(callbacks.Privmsg):
|
|||||||
size = fd.headers['Content-Length']
|
size = fd.headers['Content-Length']
|
||||||
irc.reply('%s is %s bytes long.' % (url, size))
|
irc.reply('%s is %s bytes long.' % (url, size))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
s = fd.read(conf.supybot.httpPeekSize())
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
if len(s) != conf.supybot.httpPeekSize():
|
s = fd.read(size)
|
||||||
|
if len(s) != size:
|
||||||
irc.reply('%s is %s bytes long.' % (url, len(s)))
|
irc.reply('%s is %s bytes long.' % (url, len(s)))
|
||||||
else:
|
else:
|
||||||
irc.reply('The server didn\'t tell me how long %s is '
|
irc.reply('The server didn\'t tell me how long %s is '
|
||||||
'but it\'s longer than %s bytes.' %
|
'but it\'s longer than %s bytes.' % (url, size)
|
||||||
(url,conf.supybot.httpPeekSize()))
|
|
||||||
|
|
||||||
def title(self, irc, msg, args):
|
def title(self, irc, msg, args):
|
||||||
"""<url>
|
"""<url>
|
||||||
@ -129,13 +130,14 @@ class Http(callbacks.Privmsg):
|
|||||||
url = privmsgs.getArgs(args)
|
url = privmsgs.getArgs(args)
|
||||||
if '://' not in url:
|
if '://' not in url:
|
||||||
url = 'http://%s' % url
|
url = 'http://%s' % url
|
||||||
text = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
|
text = webutils.getUrl(url, size=size)
|
||||||
m = self._titleRe.search(text)
|
m = self._titleRe.search(text)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
irc.reply(utils.htmlToText(m.group(1).strip()))
|
irc.reply(utils.htmlToText(m.group(1).strip()))
|
||||||
else:
|
else:
|
||||||
irc.reply('That URL appears to have no HTML title '
|
irc.reply('That URL appears to have no HTML title '
|
||||||
'within the first %s bytes.'%conf.supybot.httpPeekSize())
|
'within the first %s bytes.' % size)
|
||||||
|
|
||||||
def freshmeat(self, irc, msg, args):
|
def freshmeat(self, irc, msg, args):
|
||||||
"""<project name>
|
"""<project name>
|
||||||
|
@ -198,7 +198,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
|
|||||||
if self.registryValue('titleSnarfer', channel):
|
if self.registryValue('titleSnarfer', channel):
|
||||||
url = match.group(0)
|
url = match.group(0)
|
||||||
try:
|
try:
|
||||||
text = webutils.getUrl(url, size=conf.supybot.httpPeekSize())
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
|
text = webutils.getUrl(url, size=size)
|
||||||
except webutils.WebError, e:
|
except webutils.WebError, e:
|
||||||
self.log.info('Couldn\'t snarf title of %s, %s.', url, e)
|
self.log.info('Couldn\'t snarf title of %s, %s.', url, e)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user