mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Web: Remove netcraft (which does not seem to want bots).
This commit is contained in:
parent
63a4285941
commit
2177429618
@ -208,30 +208,6 @@ class Web(callbacks.PluginRegexp):
|
|||||||
'within the first %S.'), size))
|
'within the first %S.'), size))
|
||||||
title = wrap(title, [getopts({'no-filter': ''}), 'httpUrl'])
|
title = wrap(title, [getopts({'no-filter': ''}), 'httpUrl'])
|
||||||
|
|
||||||
_netcraftre = re.compile(r'td align="left">\s+<a[^>]+>(.*?)<a href',
|
|
||||||
re.S | re.I)
|
|
||||||
@internationalizeDocstring
|
|
||||||
def netcraft(self, irc, msg, args, hostname):
|
|
||||||
"""<hostname|ip>
|
|
||||||
|
|
||||||
Returns Netcraft.com's determination of what operating system and
|
|
||||||
webserver is running on the host given.
|
|
||||||
"""
|
|
||||||
url = 'http://uptime.netcraft.com/up/graph/?host=' + hostname
|
|
||||||
html = utils.web.getUrl(url) \
|
|
||||||
.decode('utf8')
|
|
||||||
m = self._netcraftre.search(html)
|
|
||||||
if m:
|
|
||||||
html = m.group(1)
|
|
||||||
s = utils.web.htmlToText(html, tagReplace='').strip()
|
|
||||||
s = s.rstrip('-').strip()
|
|
||||||
irc.reply(s) # Snip off "the site"
|
|
||||||
elif 'We could not get any results' in html:
|
|
||||||
irc.reply(_('No results found for %s.') % hostname)
|
|
||||||
else:
|
|
||||||
irc.error(_('The format of page the was odd.'))
|
|
||||||
netcraft = wrap(netcraft, ['text'])
|
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def urlquote(self, irc, msg, args, text):
|
def urlquote(self, irc, msg, args, text):
|
||||||
"""<text>
|
"""<text>
|
||||||
|
@ -71,9 +71,6 @@ class WebTestCase(ChannelPluginTestCase):
|
|||||||
self.assertNotError(
|
self.assertNotError(
|
||||||
'title http://www.youtube.com/watch?v=x4BtiqPN4u8')
|
'title http://www.youtube.com/watch?v=x4BtiqPN4u8')
|
||||||
|
|
||||||
def testNetcraft(self):
|
|
||||||
self.assertNotError('netcraft slashdot.org')
|
|
||||||
|
|
||||||
def testTitleSnarfer(self):
|
def testTitleSnarfer(self):
|
||||||
try:
|
try:
|
||||||
conf.supybot.plugins.Web.titleSnarfer.setValue(True)
|
conf.supybot.plugins.Web.titleSnarfer.setValue(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user