From 832165e779b5bb52bbb844f0fe6c8f16d99f859a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 7 Feb 2004 12:11:03 +0000 Subject: [PATCH] Added cache command. --- plugins/Google.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugins/Google.py b/plugins/Google.py index ae46bcb2c..56b63802a 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -252,6 +252,22 @@ class Google(callbacks.PrivmsgCommandAndRegexp): categories and ' Categories include %s.' % categories) irc.reply(s) + _cacheUrlRe = re.compile('([^<]+)') + def cache(self, irc, msg, args): + """ + + Returns a link to the cached version of 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): """ [ ...]