mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Added cache command.
This commit is contained in:
parent
1a22cd530e
commit
832165e779
@ -252,6 +252,22 @@ class Google(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
categories and ' Categories include %s.' % categories)
|
categories and ' Categories include %s.' % categories)
|
||||||
irc.reply(s)
|
irc.reply(s)
|
||||||
|
|
||||||
|
_cacheUrlRe = re.compile('<code>([^<]+)</code>')
|
||||||
|
def cache(self, irc, msg, args):
|
||||||
|
"""<url>
|
||||||
|
|
||||||
|
Returns a link to the cached version of <url> if it is available.
|
||||||
|
"""
|
||||||
|
url = privmsgs.getArgs(args)
|
||||||
|
html = google.doGetCachedPage(url)
|
||||||
|
m = self._cacheUrlRe.search(html)
|
||||||
|
if m is not None:
|
||||||
|
url = m.group(1)
|
||||||
|
url = utils.htmlToText(url)
|
||||||
|
irc.reply(url)
|
||||||
|
else:
|
||||||
|
irc.error('Google seems to have no cache for that site.')
|
||||||
|
|
||||||
def fight(self, irc, msg, args):
|
def fight(self, irc, msg, args):
|
||||||
"""<search string> <search string> [<search string> ...]
|
"""<search string> <search string> [<search string> ...]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user