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): """ [ ...]